The entity class may now decide when it's default
This commit is contained in:
parent
941478c574
commit
8c5c35c725
@ -6,6 +6,7 @@ public class Lang
|
|||||||
public static final String permDoThat = "do that";
|
public static final String permDoThat = "do that";
|
||||||
|
|
||||||
public static final String commandSenderMustBePlayer = "<b>This command can only be used by ingame players.";
|
public static final String commandSenderMustBePlayer = "<b>This command can only be used by ingame players.";
|
||||||
|
public static final String commandSenderMusntBePlayer = "<b>This command can not be used by ingame players.";
|
||||||
public static final String commandToFewArgs = "<b>To few arguments. <i>Use like this:";
|
public static final String commandToFewArgs = "<b>To few arguments. <i>Use like this:";
|
||||||
public static final String commandToManyArgs = "<b>Strange arguments %s<b>.";
|
public static final String commandToManyArgs = "<b>Strange arguments %s<b>.";
|
||||||
public static final String commandToManyArgs2 = "<i>Use the command like this:";
|
public static final String commandToManyArgs2 = "<i>Use the command like this:";
|
||||||
|
36
src/com/massivecraft/mcore/cmd/req/ReqIsntPlayer.java
Normal file
36
src/com/massivecraft/mcore/cmd/req/ReqIsntPlayer.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package com.massivecraft.mcore.cmd.req;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.massivecraft.mcore.Lang;
|
||||||
|
import com.massivecraft.mcore.cmd.MCommand;
|
||||||
|
import com.massivecraft.mcore.util.SenderUtil;
|
||||||
|
|
||||||
|
public class ReqIsntPlayer extends ReqAbstract
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// INSTANCE & CONSTRUCT
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
private static ReqIsntPlayer i = new ReqIsntPlayer();
|
||||||
|
public static ReqIsntPlayer get() { return i; }
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// OVERRIDE
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(CommandSender sender, MCommand command)
|
||||||
|
{
|
||||||
|
return !SenderUtil.isPlayer(sender);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createErrorMessage(CommandSender sender, MCommand command)
|
||||||
|
{
|
||||||
|
return Lang.commandSenderMusntBePlayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -133,7 +133,18 @@ public class Coll<E, L extends Comparable<? super L>> implements CollInterface<E
|
|||||||
|
|
||||||
// Should that instance be saved or not?
|
// Should that instance be saved or not?
|
||||||
// If it is default it should not be saved.
|
// If it is default it should not be saved.
|
||||||
@Override public boolean isDefault(E entity) { return false; }
|
@SuppressWarnings("rawtypes")
|
||||||
|
@Override public boolean isDefault(E entity)
|
||||||
|
{
|
||||||
|
if (entity instanceof Entity)
|
||||||
|
{
|
||||||
|
return ((Entity)entity).isDefault();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// COPY AND CREATE
|
// COPY AND CREATE
|
||||||
|
@ -102,6 +102,11 @@ public abstract class Entity<E extends Entity<E, L>, L extends Comparable<? supe
|
|||||||
return (E) this;
|
return (E) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDefault()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(E that)
|
public int compareTo(E that)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user