MassiveCore - Heavy Refactoring and Command improvements
This commit is contained in:
parent
5c5bb87aee
commit
9667e27fcb
@ -13,12 +13,15 @@ public class Lang
|
||||
public static final String COMMAND_SENDER_MUST_BE_PLAYER = "<b>This command can only be used by ingame players.";
|
||||
public static final String COMMAND_SENDER_MUSNT_BE_PLAYER = "<b>This command can not be used by ingame players.";
|
||||
public static final String COMMAND_TITLES_MUST_BE_AVAILABLE = "<b>This command requires the Minecraft 1.8 titles.";
|
||||
public static final String COMMAND_TOO_FEW_ARGS = "<b>Not enough command input. <i>You should use it like this:";
|
||||
public static final String COMMAND_TOO_MANY_ARGS = "<b>Too much command input %s<b>.";
|
||||
public static final String COMMAND_TOO_MANY_ARGS2 = "<i>You should use the command like this:";
|
||||
public static final String COMMAND_TOO_FEW_ARGUMENTS = "<b>Not enough command input. <i>You should use it like this:";
|
||||
public static final String COMMAND_TOO_MANY_ARGUMENTS = "<b>Too much command input %s<b>.";
|
||||
public static final String COMMAND_TOO_MANY_ARGUMENTS2 = "<i>You should use the command like this:";
|
||||
|
||||
public static final Mson COMMAND_REPLACEMENT = mson("REPLACEMENT");
|
||||
public static final Mson COMMAND_NO_SUCH_SUB = mson("Couldn't find the command ", COMMAND_REPLACEMENT).color(ChatColor.YELLOW);
|
||||
public static final Mson COMMAND_SUGGEST_SUB = mson("Maybe you could try ", COMMAND_REPLACEMENT).color(ChatColor.YELLOW);
|
||||
public static final Mson COMMAND_GET_HELP = mson("Use ", COMMAND_REPLACEMENT, " to see commands.").color(ChatColor.YELLOW);
|
||||
|
||||
public static final Mson COMMAND_CHILD_AMBIGUOUS = mson("The sub command ", COMMAND_REPLACEMENT, " is ambiguous.").color(ChatColor.YELLOW);
|
||||
public static final Mson COMMAND_CHILD_NONE = mson("The sub command ", COMMAND_REPLACEMENT, " couldn't be found.").color(ChatColor.YELLOW);
|
||||
public static final Mson COMMAND_CHILD_HELP = mson("Use ", COMMAND_REPLACEMENT, " to see all commands.").color(ChatColor.YELLOW);
|
||||
|
||||
public static final String COMMAND_TOO_MANY_TAB_SUGGESTIONS = "<h>%d <b>tab completions available. Be more specific and try again.";
|
||||
}
|
||||
|
@ -11,9 +11,9 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.arg.ARPS;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARSenderId;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARWorldId;
|
||||
import com.massivecraft.massivecore.cmd.type.TypePS;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeSenderId;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeWorldId;
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
import com.massivecraft.massivecore.event.EventMassiveCoreDestination;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
@ -56,7 +56,7 @@ public class MassiveCoreEngineDestination extends EngineAbstract
|
||||
{
|
||||
try
|
||||
{
|
||||
PS ps = ARPS.get().read(event.getArg(), event.getSender());
|
||||
PS ps = TypePS.get().read(event.getArg(), event.getSender());
|
||||
Destination destination = new DestinationSimple(ps);
|
||||
event.setDestination(destination);
|
||||
}
|
||||
@ -144,7 +144,7 @@ public class MassiveCoreEngineDestination extends EngineAbstract
|
||||
String worldId;
|
||||
if (rest != null)
|
||||
{
|
||||
worldId = ARWorldId.get().read(rest, sender);
|
||||
worldId = TypeWorldId.get().read(rest, sender);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -158,7 +158,7 @@ public class MassiveCoreEngineDestination extends EngineAbstract
|
||||
// World Implicit
|
||||
try
|
||||
{
|
||||
String worldId = ARWorldId.get().read(arg, sender);
|
||||
String worldId = TypeWorldId.get().read(arg, sender);
|
||||
return new DestinationWorld(worldId);
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -172,7 +172,7 @@ public class MassiveCoreEngineDestination extends EngineAbstract
|
||||
String playerId;
|
||||
if (rest != null)
|
||||
{
|
||||
playerId = ARSenderId.get().read(rest, sender);
|
||||
playerId = TypeSenderId.get().read(rest, sender);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -185,7 +185,7 @@ public class MassiveCoreEngineDestination extends EngineAbstract
|
||||
// Player Implicit
|
||||
try
|
||||
{
|
||||
String playerId = ARSenderId.get().read(arg, sender);
|
||||
String playerId = TypeSenderId.get().read(arg, sender);
|
||||
return new DestinationPlayer(playerId);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -143,7 +143,7 @@ public class MassiveCoreEngineMain extends EngineAbstract
|
||||
if (MUtil.isntPlayer(watcher)) return;
|
||||
|
||||
// Get the lowercased token predicate
|
||||
Predictate<String> predictate = PredictateStartsWithIgnoreCase.get(event.getLastToken());
|
||||
Predicate<String> predicate = PredicateStartsWithIgnoreCase.get(event.getLastToken());
|
||||
|
||||
// Create a case insensitive set to check for already added stuff
|
||||
Set<String> current = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
||||
@ -153,7 +153,7 @@ public class MassiveCoreEngineMain extends EngineAbstract
|
||||
// TODO: Should this only be players? Would a player actually want to tab-complete @console?
|
||||
for (String senderName : IdUtil.getNames(SenderPresence.ONLINE, SenderType.ANY))
|
||||
{
|
||||
if (!predictate.apply(senderName)) continue;
|
||||
if (!predicate.apply(senderName)) continue;
|
||||
if (current.contains(senderName)) continue;
|
||||
if (!Mixin.canSee(watcher, senderName)) continue;
|
||||
|
||||
|
@ -8,7 +8,7 @@ import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.arg.ARUniverse;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeUniverse;
|
||||
import com.massivecraft.massivecore.store.Entity;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
|
||||
@ -170,9 +170,9 @@ public class Multiverse extends Entity<Multiverse>
|
||||
// ARG READERS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public ARUniverse argReaderUniverse()
|
||||
public TypeUniverse typeUniverse()
|
||||
{
|
||||
return new ARUniverse(this);
|
||||
return new TypeUniverse(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.massivecraft.massivecore;
|
||||
|
||||
public interface Predictate<T>
|
||||
public interface Predicate<T>
|
||||
{
|
||||
public boolean apply(T type);
|
||||
}
|
49
src/com/massivecraft/massivecore/PredicateAnd.java
Normal file
49
src/com/massivecraft/massivecore/PredicateAnd.java
Normal file
@ -0,0 +1,49 @@
|
||||
package com.massivecraft.massivecore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class PredicateAnd<T> implements Predicate<T>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
@SafeVarargs
|
||||
public static <T> PredicateAnd<T> get(Predicate<T>... predicates) { return new PredicateAnd<T>(predicates); }
|
||||
@SafeVarargs
|
||||
public PredicateAnd(Predicate<T>... predicates)
|
||||
{
|
||||
this(Arrays.asList(predicates));
|
||||
}
|
||||
|
||||
public static <T> PredicateAnd<T> get(Collection<Predicate<T>> predicates) { return new PredicateAnd<T>(predicates); }
|
||||
public PredicateAnd(Collection<Predicate<T>> predicates)
|
||||
{
|
||||
this.predicates = Collections.unmodifiableList(new ArrayList<Predicate<T>>(predicates));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private final List<Predicate<T>> predicates;
|
||||
public List<Predicate<T>> getPredicates() { return this.predicates; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public boolean apply(T type)
|
||||
{
|
||||
for (Predicate<T> predicate : this.getPredicates())
|
||||
{
|
||||
if (!predicate.apply(type)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
package com.massivecraft.massivecore;
|
||||
|
||||
public class PredictateIsRegistered implements Predictate<Registerable>
|
||||
public class PredicateIsRegistered implements Predicate<Registerable>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static PredictateIsRegistered i = new PredictateIsRegistered();
|
||||
public static PredictateIsRegistered get() { return i; }
|
||||
private static PredicateIsRegistered i = new PredicateIsRegistered();
|
||||
public static PredicateIsRegistered get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -2,14 +2,14 @@ package com.massivecraft.massivecore;
|
||||
|
||||
import com.massivecraft.massivecore.store.Entity;
|
||||
|
||||
public class PredictateIsntDefaultEntity implements Predictate<Entity<?>>
|
||||
public class PredicateIsntDefaultEntity implements Predicate<Entity<?>>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static PredictateIsntDefaultEntity i = new PredictateIsntDefaultEntity();
|
||||
public static PredictateIsntDefaultEntity get() { return i; }
|
||||
private static PredicateIsntDefaultEntity i = new PredicateIsntDefaultEntity();
|
||||
public static PredicateIsntDefaultEntity get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.massivecore;
|
||||
|
||||
// Inspired by: String#regionMatches(ignoreCase, toffset, other, ooffset, len)
|
||||
public class PredictateStartsWithIgnoreCase implements Predictate<String>
|
||||
public class PredicateStartsWithIgnoreCase implements Predicate<String>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
@ -14,8 +14,8 @@ public class PredictateStartsWithIgnoreCase implements Predictate<String>
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static PredictateStartsWithIgnoreCase get(String prefix) { return new PredictateStartsWithIgnoreCase(prefix); }
|
||||
public PredictateStartsWithIgnoreCase(String prefix)
|
||||
public static PredicateStartsWithIgnoreCase get(String prefix) { return new PredicateStartsWithIgnoreCase(prefix); }
|
||||
public PredicateStartsWithIgnoreCase(String prefix)
|
||||
{
|
||||
if (prefix == null) throw new NullPointerException("prefix");
|
||||
this.prefixLower = prefix.toLowerCase();
|
@ -1,49 +0,0 @@
|
||||
package com.massivecraft.massivecore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class PredictateAnd<T> implements Predictate<T>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
@SafeVarargs
|
||||
public static <T> PredictateAnd<T> get(Predictate<T>... predictates) { return new PredictateAnd<T>(predictates); }
|
||||
@SafeVarargs
|
||||
public PredictateAnd(Predictate<T>... predictates)
|
||||
{
|
||||
this(Arrays.asList(predictates));
|
||||
}
|
||||
|
||||
public static <T> PredictateAnd<T> get(Collection<Predictate<T>> predictates) { return new PredictateAnd<T>(predictates); }
|
||||
public PredictateAnd(Collection<Predictate<T>> predictates)
|
||||
{
|
||||
this.predictates = Collections.unmodifiableList(new ArrayList<Predictate<T>>(predictates));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private final List<Predictate<T>> predictates;
|
||||
public List<Predictate<T>> getPredictates() { return this.predictates; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public boolean apply(T type)
|
||||
{
|
||||
for (Predictate<T> predictate : this.getPredictates())
|
||||
{
|
||||
if (!predictate.apply(type)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -7,8 +7,8 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.arg.ARFloat;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARSound;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeFloat;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeSound;
|
||||
|
||||
public final class SoundEffect implements Cloneable, Serializable
|
||||
{
|
||||
@ -67,18 +67,18 @@ public final class SoundEffect implements Cloneable, Serializable
|
||||
soundString = soundString.trim();
|
||||
|
||||
String[] parts = soundString.split("[^a-zA-Z0-9_.]+");
|
||||
Sound sound = ARSound.get().read(parts[0]);
|
||||
Sound sound = TypeSound.get().read(parts[0]);
|
||||
|
||||
float volume = 1.0f;
|
||||
if (parts.length >= 2)
|
||||
{
|
||||
volume = ARFloat.get().read(parts[1]);
|
||||
volume = TypeFloat.get().read(parts[1]);
|
||||
}
|
||||
|
||||
float pitch = 1.0f;
|
||||
if (parts.length >= 3)
|
||||
{
|
||||
pitch = ARFloat.get().read(parts[2]);
|
||||
pitch = TypeFloat.get().read(parts[2]);
|
||||
}
|
||||
|
||||
return SoundEffect.valueOf(sound, volume, pitch);
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.massivecore.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.VisibilityMode;
|
||||
import com.massivecraft.massivecore.cmd.Visibility;
|
||||
|
||||
|
||||
public class DeprecatedCommand extends MassiveCommand
|
||||
@ -24,11 +24,11 @@ public class DeprecatedCommand extends MassiveCommand
|
||||
// Aliases
|
||||
this.setAliases(aliases);
|
||||
|
||||
// Args
|
||||
this.setGivingErrorOnTooManyArgs(false);
|
||||
// Parameters
|
||||
this.setOverflowSensitive(false);
|
||||
|
||||
// Visibility
|
||||
this.setVisibilityMode(VisibilityMode.INVISIBLE);
|
||||
this.setVisibility(Visibility.INVISIBLE);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -39,7 +39,7 @@ public class DeprecatedCommand extends MassiveCommand
|
||||
public void perform()
|
||||
{
|
||||
msg("<i>Use this new command instead:");
|
||||
message(target.getUseageTemplate(true));
|
||||
message(target.getTemplate(true));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ public class HelpCommand extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("?", "h", "help");
|
||||
|
||||
// Args
|
||||
this.addArg(ArgSetting.getPage());
|
||||
// Parameters
|
||||
this.addParameter(Parameter.getPage());
|
||||
|
||||
// Other
|
||||
this.setDesc("");
|
||||
@ -41,34 +41,34 @@ public class HelpCommand extends MassiveCommand
|
||||
int page = this.readArg();
|
||||
|
||||
// Get parent command
|
||||
if ( ! this.hasParentCommand()) return;
|
||||
MassiveCommand parentCommand = this.getParentCommand();
|
||||
if ( ! this.hasParent()) return;
|
||||
MassiveCommand parent = this.getParent();
|
||||
|
||||
// Create Lines
|
||||
List<Mson> lines = new ArrayList<Mson>();
|
||||
for (String helpline : parentCommand.getHelp())
|
||||
for (String helpline : parent.getHelp())
|
||||
{
|
||||
lines.add(Mson.parse("<a>#<i> " + helpline));
|
||||
}
|
||||
|
||||
for (MassiveCommand subCommand : parentCommand.getSubCommands())
|
||||
for (MassiveCommand child : parent.getChildren())
|
||||
{
|
||||
if ( ! subCommand.isVisibleTo(sender)) continue;
|
||||
lines.add(subCommand.getUseageTemplate(this.getCommandChain(), true, true, sender));
|
||||
if ( ! child.isVisibleTo(sender)) continue;
|
||||
lines.add(child.getTemplate(this.getChain(), true, true, sender));
|
||||
}
|
||||
|
||||
// Send Lines
|
||||
message(Txt.getPage(lines, page, "Help for command \"" + parentCommand.getAliases().get(0) + "\"", this));
|
||||
message(Txt.getPage(lines, page, "Help for command \"" + parent.getAliases().get(0) + "\"", this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisibleTo(CommandSender sender)
|
||||
{
|
||||
boolean visible = super.isVisibleTo(sender);
|
||||
if ( ! (this.hasParentCommand() && visible)) return visible;
|
||||
if ( ! (this.hasParent() && visible)) return visible;
|
||||
|
||||
int pageHeight = (sender instanceof Player) ? Txt.PAGEHEIGHT_PLAYER : Txt.PAGEHEIGHT_CONSOLE;
|
||||
int size = this.getParentCommand().getSubCommands().size();
|
||||
int size = this.getParent().getChildren().size();
|
||||
|
||||
if (size <= pageHeight)
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,7 @@ public class MassiveCoreBukkitCommand extends Command implements PluginIdentifia
|
||||
super(
|
||||
name,
|
||||
massiveCommand.getDesc(),
|
||||
massiveCommand.getUseageTemplate().toPlain(true),
|
||||
massiveCommand.getTemplate().toPlain(true),
|
||||
Collections.<String>emptyList() // We don't use aliases
|
||||
);
|
||||
this.massiveCommand = massiveCommand;
|
||||
@ -65,7 +65,7 @@ public class MassiveCoreBukkitCommand extends Command implements PluginIdentifia
|
||||
public List<String> createArgList(String[] args)
|
||||
{
|
||||
List<String> ret;
|
||||
if (this.getMassiveCommand().isUsingTokenizer())
|
||||
if (this.getMassiveCommand().isTokenizing())
|
||||
{
|
||||
ret = Txt.tokenizeArguments(Txt.implode(args, " "));
|
||||
}
|
||||
@ -74,7 +74,7 @@ public class MassiveCoreBukkitCommand extends Command implements PluginIdentifia
|
||||
ret = MUtil.list(args);
|
||||
}
|
||||
|
||||
if (this.getMassiveCommand().isUsingSmartQuotesRemoval())
|
||||
if (this.getMassiveCommand().isUnsmart())
|
||||
{
|
||||
List<String> oldArgList = ret;
|
||||
ret = new ArrayList<String>(oldArgList.size());
|
||||
|
@ -5,11 +5,11 @@ import static com.massivecraft.massivecore.mson.Mson.mson;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.arg.AR;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARInteger;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeInteger;
|
||||
import com.massivecraft.massivecore.cmd.type.Type;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
|
||||
public class ArgSetting<T>
|
||||
public class Parameter<T>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTANTS
|
||||
@ -24,16 +24,16 @@ public class ArgSetting<T>
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
protected AR<T> reader;
|
||||
public AR<T> getReader() { return reader; }
|
||||
public ArgSetting<T> setReader(AR<T> reader) { this.reader = reader; return this; }
|
||||
protected Type<T> type;
|
||||
public Type<T> getType() { return type; }
|
||||
public Parameter<T> setType(Type<T> type) { this.type = type; return this; }
|
||||
|
||||
protected String name;
|
||||
public String getName() { return name; }
|
||||
public ArgSetting<T> setName(String name) { this.name = name; return this; }
|
||||
public Parameter<T> setName(String name) { this.name = name; return this; }
|
||||
|
||||
protected String defaultDesc = null;
|
||||
public ArgSetting<T> setDefaultDesc(String defaultDesc) { this.defaultDesc = defaultDesc; return this; }
|
||||
public Parameter<T> setDefaultDesc(String defaultDesc) { this.defaultDesc = defaultDesc; return this; }
|
||||
public String getDefaultDesc()
|
||||
{
|
||||
if (this.defaultDesc != null) return defaultDesc;
|
||||
@ -43,7 +43,7 @@ public class ArgSetting<T>
|
||||
|
||||
protected T defaultValue = null;
|
||||
public T getDefaultValue() { return defaultValue; }
|
||||
public ArgSetting<T> setDefaultValue(T defaultValue)
|
||||
public Parameter<T> setDefaultValue(T defaultValue)
|
||||
{
|
||||
this.defaultValue = defaultValue;
|
||||
this.defaultValueSet = true;
|
||||
@ -65,7 +65,7 @@ public class ArgSetting<T>
|
||||
// That might the case if the arg is a player. and default is oneself.
|
||||
protected boolean requiredFromConsole = false;
|
||||
public boolean isRequiredFromConsole() { return requiredFromConsole; }
|
||||
public ArgSetting<T> setRequiredFromConsole(boolean requiredFromConsole) { this.requiredFromConsole = requiredFromConsole; return this; }
|
||||
public Parameter<T> setRequiredFromConsole(boolean requiredFromConsole) { this.requiredFromConsole = requiredFromConsole; return this; }
|
||||
|
||||
// An optional description of this argument.
|
||||
// Examples:
|
||||
@ -74,7 +74,7 @@ public class ArgSetting<T>
|
||||
// 3. "the amount of money to pay"
|
||||
protected String desc = null;
|
||||
public String getDesc() { return desc; }
|
||||
public ArgSetting<T> setDesc(String desc) { this.desc = desc; return this; }
|
||||
public Parameter<T> setDesc(String desc) { this.desc = desc; return this; }
|
||||
|
||||
public boolean hasDesc() { return this.getDesc() != null; }
|
||||
|
||||
@ -86,13 +86,13 @@ public class ArgSetting<T>
|
||||
// description must not be set in the constructor.
|
||||
|
||||
// All
|
||||
public ArgSetting(T defaultValue, AR<T> reader, boolean requiredFromConsole, String name, String defaultDesc)
|
||||
public Parameter(T defaultValue, Type<T> type, boolean requiredFromConsole, String name, String defaultDesc)
|
||||
{
|
||||
// Null checks
|
||||
if (reader == null) throw new IllegalArgumentException("reader mustn't be null");
|
||||
if (type == null) throw new IllegalArgumentException("type mustn't be null");
|
||||
if (name == null) throw new IllegalArgumentException("name mustn't be null");
|
||||
|
||||
this.setReader(reader);
|
||||
this.setType(type);
|
||||
this.setRequiredFromConsole(requiredFromConsole);
|
||||
this.setName(name);
|
||||
this.setDefaultDesc(defaultDesc);
|
||||
@ -101,64 +101,48 @@ public class ArgSetting<T>
|
||||
|
||||
// Without defaultValue
|
||||
@SuppressWarnings("unchecked")
|
||||
public ArgSetting(AR<T> reader, boolean requiredFromConsole, String name, String defaultDesc)
|
||||
public Parameter(Type<T> type, boolean requiredFromConsole, String name, String defaultDesc)
|
||||
{
|
||||
this((T) DEFAULT_VALUE_DEFAULT, reader, requiredFromConsole, name, defaultDesc);
|
||||
this((T) DEFAULT_VALUE_DEFAULT, type, requiredFromConsole, name, defaultDesc);
|
||||
|
||||
// In fact the default value is not set.
|
||||
this.defaultValueSet = false;
|
||||
}
|
||||
|
||||
// Without reqFromConsole.
|
||||
public ArgSetting(T defaultValue, AR<T> reader, String name, String defaultDesc)
|
||||
public Parameter(T defaultValue, Type<T> type, String name, String defaultDesc)
|
||||
{
|
||||
this(defaultValue, reader, REQUIRED_FROM_CONSOLE_DEFAULT, name, defaultDesc);
|
||||
this(defaultValue, type, REQUIRED_FROM_CONSOLE_DEFAULT, name, defaultDesc);
|
||||
}
|
||||
|
||||
// Without defaultDesc.
|
||||
public ArgSetting(T defaultValue, AR<T> reader, boolean requiredFromConsole, String name)
|
||||
public Parameter(T defaultValue, Type<T> type, boolean requiredFromConsole, String name)
|
||||
{
|
||||
this(defaultValue, reader, requiredFromConsole, name, DEFAULT_DESC_DEFAULT);
|
||||
this(defaultValue, type, requiredFromConsole, name, DEFAULT_DESC_DEFAULT);
|
||||
}
|
||||
|
||||
// Without defaultValue & reqFromConsole.
|
||||
public ArgSetting(AR<T> reader, String name, String defaultDesc)
|
||||
public Parameter(Type<T> type, String name, String defaultDesc)
|
||||
{
|
||||
this(reader, REQUIRED_FROM_CONSOLE_DEFAULT, name, defaultDesc);
|
||||
this(type, REQUIRED_FROM_CONSOLE_DEFAULT, name, defaultDesc);
|
||||
}
|
||||
|
||||
// Without defaultValue & defaultDesc.
|
||||
public ArgSetting(AR<T> reader, boolean requiredFromConsole, String name)
|
||||
public Parameter(Type<T> type, boolean requiredFromConsole, String name)
|
||||
{
|
||||
this(reader, requiredFromConsole, name, DEFAULT_DESC_DEFAULT);
|
||||
this(type, requiredFromConsole, name, DEFAULT_DESC_DEFAULT);
|
||||
}
|
||||
|
||||
// Without reqFromConsole and defaultDesc.
|
||||
public ArgSetting(T defaultValue, AR<T> reader, String name)
|
||||
public Parameter(T defaultValue, Type<T> type, String name)
|
||||
{
|
||||
this(defaultValue, reader, REQUIRED_FROM_CONSOLE_DEFAULT, name, DEFAULT_DESC_DEFAULT);
|
||||
this(defaultValue, type, REQUIRED_FROM_CONSOLE_DEFAULT, name, DEFAULT_DESC_DEFAULT);
|
||||
}
|
||||
|
||||
// Without defaultValue, reqFromConsole and defaultDesc.
|
||||
public ArgSetting(AR<T> reader, String name)
|
||||
public Parameter(Type<T> type, String name)
|
||||
{
|
||||
this(reader, REQUIRED_FROM_CONSOLE_DEFAULT, name, DEFAULT_DESC_DEFAULT);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// STATIC FACTORY (DEPRECATED)
|
||||
// -------------------------------------------- //
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Deprecated
|
||||
public static ArgSetting of(AR<?> reader, boolean requiredFromConsole, String name, String def)
|
||||
{
|
||||
// Null checks
|
||||
if (reader == null) throw new IllegalArgumentException("reader mustn't be null");
|
||||
if (name == null) throw new IllegalArgumentException("name mustn't be null");
|
||||
|
||||
// Create
|
||||
return new ArgSetting(reader, requiredFromConsole, name, def);
|
||||
this(type, REQUIRED_FROM_CONSOLE_DEFAULT, name, DEFAULT_DESC_DEFAULT);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -179,7 +163,7 @@ public class ArgSetting<T>
|
||||
return ! this.isRequiredFor(sender);
|
||||
}
|
||||
|
||||
public Mson getUseageTemplateDisplayFor(CommandSender sender)
|
||||
public Mson getTemplate(CommandSender sender)
|
||||
{
|
||||
Mson ret;
|
||||
|
||||
@ -198,14 +182,14 @@ public class ArgSetting<T>
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// COMMONLY USED ARG SETTINGS
|
||||
// COMMONLY USED PARAMETERS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static ArgSetting<Integer> getPage()
|
||||
public static Parameter<Integer> getPage()
|
||||
{
|
||||
// We can't use a singletone, because people might
|
||||
// want to set a description.
|
||||
return new ArgSetting<Integer>(1, ARInteger.get(), "page", "1");
|
||||
return new Parameter<Integer>(1, TypeInteger.get(), "page", "1");
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package com.massivecraft.massivecore.cmd;
|
||||
|
||||
public enum VisibilityMode
|
||||
public enum Visibility
|
||||
{
|
||||
VISIBLE, // Visible commands are visible to anyone. Even those who don't have permission to use it or is of invalid sender type.
|
||||
SECRET, // Secret commands are visible only to those who can use the command. These commands are usually some kind of admin commands.
|
@ -27,15 +27,15 @@ public class CmdMassiveCore extends MassiveCommand
|
||||
|
||||
public CmdMassiveCore()
|
||||
{
|
||||
// SubCommands
|
||||
this.addSubCommand(this.cmdMassiveCoreUsys);
|
||||
this.addSubCommand(this.cmdMassiveCoreMStore);
|
||||
this.addSubCommand(this.cmdMassiveCoreId);
|
||||
this.addSubCommand(this.cmdMassiveCoreTest);
|
||||
this.addSubCommand(this.cmdMassiveCoreHearsound);
|
||||
this.addSubCommand(this.cmdMassiveCoreBuffer);
|
||||
this.addSubCommand(this.cmdMassiveCoreCmdurl);
|
||||
this.addSubCommand(this.cmdMassiveCoreVersion);
|
||||
// Children
|
||||
this.addChild(this.cmdMassiveCoreUsys);
|
||||
this.addChild(this.cmdMassiveCoreMStore);
|
||||
this.addChild(this.cmdMassiveCoreId);
|
||||
this.addChild(this.cmdMassiveCoreTest);
|
||||
this.addChild(this.cmdMassiveCoreHearsound);
|
||||
this.addChild(this.cmdMassiveCoreBuffer);
|
||||
this.addChild(this.cmdMassiveCoreCmdurl);
|
||||
this.addChild(this.cmdMassiveCoreVersion);
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.BASECOMMAND.node));
|
||||
|
@ -22,12 +22,12 @@ public class CmdMassiveCoreBuffer extends MassiveCommand
|
||||
|
||||
public CmdMassiveCoreBuffer()
|
||||
{
|
||||
// SubCommands
|
||||
this.addSubCommand(this.cmdMassiveCoreBufferPrint);
|
||||
this.addSubCommand(this.cmdMassiveCoreBufferClear);
|
||||
this.addSubCommand(this.cmdMassiveCoreBufferSet);
|
||||
this.addSubCommand(this.cmdMassiveCoreBufferAdd);
|
||||
this.addSubCommand(this.cmdMassiveCoreBufferWhitespace);
|
||||
// Children
|
||||
this.addChild(this.cmdMassiveCoreBufferPrint);
|
||||
this.addChild(this.cmdMassiveCoreBufferClear);
|
||||
this.addChild(this.cmdMassiveCoreBufferSet);
|
||||
this.addChild(this.cmdMassiveCoreBufferAdd);
|
||||
this.addChild(this.cmdMassiveCoreBufferWhitespace);
|
||||
|
||||
// Aliases
|
||||
this.addAliases("buffer");
|
||||
|
@ -4,8 +4,8 @@ import com.massivecraft.massivecore.MassiveCoreEngineVariable;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeString;
|
||||
|
||||
public class CmdMassiveCoreBufferAdd extends MassiveCommand
|
||||
{
|
||||
@ -18,8 +18,8 @@ public class CmdMassiveCoreBufferAdd extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("a", "add");
|
||||
|
||||
// Args
|
||||
this.addArg(ARString.get(), "text", true).setDesc("the text to add to your buffer");
|
||||
// Parameters
|
||||
this.addParameter(TypeString.get(), "text", true).setDesc("the text to add to your buffer");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.BUFFER_ADD.node));
|
||||
|
@ -4,8 +4,8 @@ import com.massivecraft.massivecore.MassiveCoreEngineVariable;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeString;
|
||||
|
||||
public class CmdMassiveCoreBufferSet extends MassiveCommand
|
||||
{
|
||||
@ -18,8 +18,8 @@ public class CmdMassiveCoreBufferSet extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("s", "set");
|
||||
|
||||
// Args
|
||||
this.addArg(ARString.get(), "text", true).setDesc("the text to set your buffer to");
|
||||
// Parameters
|
||||
this.addParameter(TypeString.get(), "text", true).setDesc("the text to set your buffer to");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.BUFFER_SET.node));
|
||||
|
@ -4,8 +4,8 @@ import com.massivecraft.massivecore.MassiveCoreEngineVariable;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARInteger;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeInteger;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class CmdMassiveCoreBufferWhitespace extends MassiveCommand
|
||||
@ -19,8 +19,8 @@ public class CmdMassiveCoreBufferWhitespace extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("w", "whitespace");
|
||||
|
||||
// Args
|
||||
this.addArg(1, ARInteger.get(), "times").setDesc("the amount of whitespace to add to your buffer");
|
||||
// Parameters
|
||||
this.addParameter(1, TypeInteger.get(), "times").setDesc("the amount of whitespace to add to your buffer");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.BUFFER_WHITESPACE.node));
|
||||
|
@ -11,9 +11,9 @@ import com.massivecraft.massivecore.MassiveCore;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeString;
|
||||
import com.massivecraft.massivecore.mixin.Mixin;
|
||||
import com.massivecraft.massivecore.util.WebUtil;
|
||||
|
||||
@ -28,8 +28,8 @@ public class CmdMassiveCoreCmdurl extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("cmdurl");
|
||||
|
||||
// Args
|
||||
this.addArg(ARString.get(), "url").setDesc("the url to load");
|
||||
// Parameters
|
||||
this.addParameter(TypeString.get(), "url").setDesc("the url to load");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.CMDURL.node));
|
||||
|
@ -6,10 +6,10 @@ import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.SoundEffect;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARList;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARSoundEffect;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeList;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeSoundEffect;
|
||||
|
||||
public class CmdMassiveCoreHearsound extends MassiveCommand
|
||||
{
|
||||
@ -22,8 +22,8 @@ public class CmdMassiveCoreHearsound extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("hearsound", "hearsounds");
|
||||
|
||||
// Args
|
||||
this.addArg(ARList.get(ARSoundEffect.get()), "sound(s)", true).setDesc("the sounds to hear");
|
||||
// Parameters
|
||||
this.addParameter(TypeList.get(TypeSoundEffect.get()), "sound(s)", true).setDesc("the sounds to hear");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.HEARSOUND.node));
|
||||
|
@ -20,12 +20,12 @@ public class CmdMassiveCoreStore extends MassiveCommand
|
||||
|
||||
public CmdMassiveCoreStore()
|
||||
{
|
||||
// SubCommands
|
||||
this.addSubCommand(this.cmdMassiveCoreStoreStats);
|
||||
this.addSubCommand(this.cmdMassiveCoreStoreListcolls);
|
||||
this.addSubCommand(this.cmdMassiveCoreStoreCopydb);
|
||||
// Children
|
||||
this.addChild(this.cmdMassiveCoreStoreStats);
|
||||
this.addChild(this.cmdMassiveCoreStoreListcolls);
|
||||
this.addChild(this.cmdMassiveCoreStoreCopydb);
|
||||
|
||||
// Args
|
||||
// Parameters
|
||||
this.addAliases("store");
|
||||
|
||||
// Requirements
|
||||
|
@ -8,8 +8,8 @@ import com.massivecraft.massivecore.MassiveCore;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeString;
|
||||
import com.massivecraft.massivecore.store.Coll;
|
||||
import com.massivecraft.massivecore.store.Db;
|
||||
import com.massivecraft.massivecore.store.MStore;
|
||||
@ -26,9 +26,9 @@ public class CmdMassiveCoreStoreCopydb extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("copydb");
|
||||
|
||||
// Args
|
||||
this.addArg(ARString.get(), "from").setDesc("the database to copy from");
|
||||
this.addArg(ARString.get(), "to").setDesc("the database to copy to");
|
||||
// Parameters
|
||||
this.addParameter(TypeString.get(), "from").setDesc("the database to copy from");
|
||||
this.addParameter(TypeString.get(), "to").setDesc("the database to copy to");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.STORE_COPYDB.node));
|
||||
|
@ -8,8 +8,8 @@ import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.NaturalOrderComparator;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeString;
|
||||
import com.massivecraft.massivecore.store.Coll;
|
||||
import com.massivecraft.massivecore.store.Db;
|
||||
import com.massivecraft.massivecore.store.MStore;
|
||||
@ -26,8 +26,8 @@ public class CmdMassiveCoreStoreListcolls extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("listcolls");
|
||||
|
||||
// Args
|
||||
this.addArg(ARString.get(), "db", ConfServer.dburi).setDesc("the database to list colls from");
|
||||
// Parameters
|
||||
this.addParameter(TypeString.get(), "db", ConfServer.dburi).setDesc("the database to list colls from");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.STORE_LISTCOLLS.node));
|
||||
|
@ -5,8 +5,8 @@ import java.util.Map.Entry;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARColl;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeColl;
|
||||
import com.massivecraft.massivecore.store.Coll;
|
||||
import com.massivecraft.massivecore.store.ExamineThread;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
@ -23,8 +23,8 @@ public class CmdMassiveCoreStoreStats extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("stats");
|
||||
|
||||
// Args
|
||||
this.addArg(ARColl.get(), "coll", Coll.TOTAL).setDesc("the coll to show info about");
|
||||
// Parameters
|
||||
this.addParameter(TypeColl.get(), "coll", Coll.TOTAL).setDesc("the coll to show info about");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.STORE_STATS.node));
|
||||
|
@ -21,11 +21,11 @@ public class CmdMassiveCoreUsys extends MassiveCommand
|
||||
|
||||
public CmdMassiveCoreUsys()
|
||||
{
|
||||
// SubCommands
|
||||
this.addSubCommand(this.cmdMassiveCoreUsysMultiverse);
|
||||
this.addSubCommand(this.cmdMassiveCoreUsysUniverse);
|
||||
this.addSubCommand(this.cmdMassiveCoreUsysWorld);
|
||||
this.addSubCommand(this.cmdMassiveCoreUsysAspect);
|
||||
// Children
|
||||
this.addChild(this.cmdMassiveCoreUsysMultiverse);
|
||||
this.addChild(this.cmdMassiveCoreUsysUniverse);
|
||||
this.addChild(this.cmdMassiveCoreUsysWorld);
|
||||
this.addChild(this.cmdMassiveCoreUsysAspect);
|
||||
|
||||
// Aliases
|
||||
this.addAliases("usys");
|
||||
|
@ -20,10 +20,10 @@ public class CmdMassiveCoreUsysAspect extends MassiveCommand
|
||||
|
||||
public CmdMassiveCoreUsysAspect()
|
||||
{
|
||||
// SubCommands
|
||||
this.addSubCommand(this.cmdMassiveCoreUsysAspectList);
|
||||
this.addSubCommand(this.cmdMassiveCoreUsysAspectShow);
|
||||
this.addSubCommand(this.cmdMassiveCoreUsysAspectUse);
|
||||
// Children
|
||||
this.addChild(this.cmdMassiveCoreUsysAspectList);
|
||||
this.addChild(this.cmdMassiveCoreUsysAspectShow);
|
||||
this.addChild(this.cmdMassiveCoreUsysAspectUse);
|
||||
|
||||
// Aliases
|
||||
this.addAliases("a", "aspect");
|
||||
|
@ -4,7 +4,7 @@ import com.massivecraft.massivecore.Aspect;
|
||||
import com.massivecraft.massivecore.AspectColl;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.ArgSetting;
|
||||
import com.massivecraft.massivecore.cmd.Parameter;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.pager.Pager;
|
||||
@ -22,8 +22,8 @@ public class CmdMassiveCoreUsysAspectList extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("l", "list");
|
||||
|
||||
// Args
|
||||
this.addArg(ArgSetting.getPage()).setDesc("the page in the aspect list");
|
||||
// Parameters
|
||||
this.addParameter(Parameter.getPage()).setDesc("the page in the aspect list");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_ASPECT_LIST.node));
|
||||
|
@ -4,8 +4,8 @@ import com.massivecraft.massivecore.Aspect;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARAspect;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeAspect;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class CmdMassiveCoreUsysAspectShow extends MassiveCommand
|
||||
@ -19,8 +19,8 @@ public class CmdMassiveCoreUsysAspectShow extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("s", "show");
|
||||
|
||||
// Args
|
||||
this.addArg(ARAspect.get(), "aspect").setDesc("the aspect to show info about");
|
||||
// Parameters
|
||||
this.addParameter(TypeAspect.get(), "aspect").setDesc("the aspect to show info about");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_ASPECT_SHOW.node));
|
||||
|
@ -5,9 +5,9 @@ import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARAspect;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeAspect;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeMultiverse;
|
||||
|
||||
public class CmdMassiveCoreUsysAspectUse extends MassiveCommand
|
||||
{
|
||||
@ -20,9 +20,9 @@ public class CmdMassiveCoreUsysAspectUse extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("u", "use");
|
||||
|
||||
// Args
|
||||
this.addArg(ARAspect.get(), "aspect").setDesc("the aspect to modify");
|
||||
this.addArg(ARMultiverse.get(), "multiverse").setDesc("the multiverse which the aspect should use");
|
||||
// Parameters
|
||||
this.addParameter(TypeAspect.get(), "aspect").setDesc("the aspect to modify");
|
||||
this.addParameter(TypeMultiverse.get(), "multiverse").setDesc("the multiverse which the aspect should use");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_ASPECT_USE.node));
|
||||
|
@ -21,11 +21,11 @@ public class CmdMassiveCoreUsysMultiverse extends MassiveCommand
|
||||
|
||||
public CmdMassiveCoreUsysMultiverse()
|
||||
{
|
||||
// SubCommands
|
||||
this.addSubCommand(this.cmdMassiveCoreUsysMultiverseList);
|
||||
this.addSubCommand(this.cmdMassiveCoreUsysMultiverseShow);
|
||||
this.addSubCommand(this.cmdMassiveCoreUsysMultiverseNew);
|
||||
this.addSubCommand(this.cmdMassiveCoreUsysMultiverseDel);
|
||||
// Children
|
||||
this.addChild(this.cmdMassiveCoreUsysMultiverseList);
|
||||
this.addChild(this.cmdMassiveCoreUsysMultiverseShow);
|
||||
this.addChild(this.cmdMassiveCoreUsysMultiverseNew);
|
||||
this.addChild(this.cmdMassiveCoreUsysMultiverseDel);
|
||||
|
||||
// Aliases
|
||||
this.addAliases("m", "multiverse");
|
||||
|
@ -5,8 +5,8 @@ import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeMultiverse;
|
||||
|
||||
public class CmdMassiveCoreUsysMultiverseDel extends MassiveCommand
|
||||
{
|
||||
@ -19,8 +19,8 @@ public class CmdMassiveCoreUsysMultiverseDel extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("d", "del");
|
||||
|
||||
// Args
|
||||
this.addArg(ARMultiverse.get(), "multiverse").setDesc("the multiverse to delete");
|
||||
// Parameters
|
||||
this.addParameter(TypeMultiverse.get(), "multiverse").setDesc("the multiverse to delete");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_DEL.node));
|
||||
|
@ -4,7 +4,7 @@ import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.MultiverseColl;
|
||||
import com.massivecraft.massivecore.cmd.ArgSetting;
|
||||
import com.massivecraft.massivecore.cmd.Parameter;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.pager.Pager;
|
||||
@ -22,8 +22,8 @@ public class CmdMassiveCoreUsysMultiverseList extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("l", "list");
|
||||
|
||||
// Args
|
||||
this.addArg(ArgSetting.getPage());
|
||||
// Parameters
|
||||
this.addParameter(Parameter.getPage());
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_LIST.node));
|
||||
|
@ -4,8 +4,8 @@ import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.MultiverseColl;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeString;
|
||||
|
||||
public class CmdMassiveCoreUsysMultiverseNew extends MassiveCommand
|
||||
{
|
||||
@ -18,8 +18,8 @@ public class CmdMassiveCoreUsysMultiverseNew extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("n", "new");
|
||||
|
||||
// Args
|
||||
this.addArg(ARString.get(), "multiverse").setDesc("name of multiverse to create");
|
||||
// Parameters
|
||||
this.addParameter(TypeString.get(), "multiverse").setDesc("name of multiverse to create");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_NEW.node));
|
||||
|
@ -9,8 +9,8 @@ import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeMultiverse;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class CmdMassiveCoreUsysMultiverseShow extends MassiveCommand
|
||||
@ -24,8 +24,8 @@ public class CmdMassiveCoreUsysMultiverseShow extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("s", "show");
|
||||
|
||||
// Args
|
||||
this.addArg(ARMultiverse.get(), "multiverse").setDesc("the multiverse to show info about");
|
||||
// Parameters
|
||||
this.addParameter(TypeMultiverse.get(), "multiverse").setDesc("the multiverse to show info about");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_SHOW.node));
|
||||
|
@ -20,10 +20,10 @@ public class CmdMassiveCoreUsysUniverse extends MassiveCommand
|
||||
|
||||
public CmdMassiveCoreUsysUniverse()
|
||||
{
|
||||
// SubCommands
|
||||
this.addSubCommand(this.cmdMassiveCoreUsysUniverseNew);
|
||||
this.addSubCommand(this.cmdMassiveCoreUsysUniverseDel);
|
||||
this.addSubCommand(this.cmdMassiveCoreUsysUniverseClear);
|
||||
// Children
|
||||
this.addChild(this.cmdMassiveCoreUsysUniverseNew);
|
||||
this.addChild(this.cmdMassiveCoreUsysUniverseDel);
|
||||
this.addChild(this.cmdMassiveCoreUsysUniverseClear);
|
||||
|
||||
// Aliases
|
||||
this.addAliases("u", "universe");
|
||||
|
@ -5,9 +5,9 @@ import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeString;
|
||||
|
||||
public class CmdMassiveCoreUsysUniverseClear extends MassiveCommand
|
||||
{
|
||||
@ -20,9 +20,9 @@ public class CmdMassiveCoreUsysUniverseClear extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("c", "clear");
|
||||
|
||||
// Args
|
||||
this.addArg(ARString.get(), "universe").setDesc("the universe to clear");
|
||||
this.addArg(ARMultiverse.get(), "multiverse").setDesc("the multiverse of the universe to clear");
|
||||
// Parameters
|
||||
this.addParameter(TypeString.get(), "universe").setDesc("the universe to clear");
|
||||
this.addParameter(TypeMultiverse.get(), "multiverse").setDesc("the multiverse of the universe to clear");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_UNIVERSE_CLEAR.node));
|
||||
|
@ -5,9 +5,9 @@ import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeString;
|
||||
|
||||
public class CmdMassiveCoreUsysUniverseDel extends MassiveCommand
|
||||
{
|
||||
@ -20,9 +20,9 @@ public class CmdMassiveCoreUsysUniverseDel extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("d", "del");
|
||||
|
||||
// Args
|
||||
this.addArg(ARString.get(), "universe").setDesc("the universe to delete");
|
||||
this.addArg(ARMultiverse.get(), "multiverse").setDesc("the multiverse of the universe to delete");
|
||||
// Parameters
|
||||
this.addParameter(TypeString.get(), "universe").setDesc("the universe to delete");
|
||||
this.addParameter(TypeMultiverse.get(), "multiverse").setDesc("the multiverse of the universe to delete");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_DEL.node));
|
||||
|
@ -4,9 +4,9 @@ import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeString;
|
||||
|
||||
public class CmdMassiveCoreUsysUniverseNew extends MassiveCommand
|
||||
{
|
||||
@ -19,9 +19,9 @@ public class CmdMassiveCoreUsysUniverseNew extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("n", "new");
|
||||
|
||||
// Args
|
||||
this.addArg(ARString.get(), "universe").setDesc("name of universe to create");
|
||||
this.addArg(ARMultiverse.get(), "multiverse").setDesc("the multiverse of the universe to create");
|
||||
// Parameters
|
||||
this.addParameter(TypeString.get(), "universe").setDesc("name of universe to create");
|
||||
this.addParameter(TypeMultiverse.get(), "multiverse").setDesc("the multiverse of the universe to create");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_UNIVERSE_NEW.node));
|
||||
|
@ -4,9 +4,9 @@ import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.type.TypeString;
|
||||
|
||||
public class CmdMassiveCoreUsysWorld extends MassiveCommand
|
||||
{
|
||||
@ -19,10 +19,10 @@ public class CmdMassiveCoreUsysWorld extends MassiveCommand
|
||||
// Aliases
|
||||
this.addAliases("w", "world");
|
||||
|
||||
// Args
|
||||
this.addArg(ARString.get(), "world").setDesc("the world to move");
|
||||
this.addArg(ARString.get(), "universe").setDesc("the universe to move the world ro");
|
||||
this.addArg(ARMultiverse.get(), "multiverse").setDesc("the multiverse of the universe to move the world to");
|
||||
// Parameters
|
||||
this.addParameter(TypeString.get(), "world").setDesc("the world to move");
|
||||
this.addParameter(TypeString.get(), "universe").setDesc("the universe to move the world ro");
|
||||
this.addParameter(TypeMultiverse.get(), "multiverse").setDesc("the multiverse of the universe to move the world to");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_WORLD.node));
|
||||
|
@ -2,10 +2,10 @@ package com.massivecraft.massivecore.cmd.req;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.Predictate;
|
||||
import com.massivecraft.massivecore.Predicate;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
|
||||
public interface Req extends Predictate<CommandSender>
|
||||
public interface Req extends Predicate<CommandSender>
|
||||
{
|
||||
public boolean apply(CommandSender sender, MassiveCommand command);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public interface AR<T>
|
||||
public interface Type<T>
|
||||
{
|
||||
// Human friendly name
|
||||
public String getTypeName();
|
||||
@ -28,7 +28,7 @@ public interface AR<T>
|
||||
public List<String> getTabListFiltered(CommandSender sender, String arg);
|
||||
|
||||
// Sometimes we put a space after a tab completion.
|
||||
// That would however not make sense with all ArgReaders.
|
||||
// That would however not make sense with all Types.
|
||||
// Default is true;
|
||||
public boolean allowSpaceAfterTab();
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -12,7 +12,7 @@ import org.bukkit.command.CommandSender;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public abstract class ARAbstract<T> implements AR<T>
|
||||
public abstract class TypeAbstract<T> implements Type<T>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE: READ
|
||||
@ -61,10 +61,10 @@ public abstract class ARAbstract<T> implements AR<T>
|
||||
@Override
|
||||
public String getTypeName()
|
||||
{
|
||||
int prefixLength = "AR".length();
|
||||
int prefixLength = "Type".length();
|
||||
String name = this.getClass().getSimpleName();
|
||||
|
||||
// We don't want the "AR" part
|
||||
// We don't want the "Type" part
|
||||
name = name.substring(prefixLength);
|
||||
|
||||
// We split at uppercase letters, because most class names are camel-case.
|
@ -1,11 +1,11 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public abstract class ARAbstractException<T> extends ARAbstract<T>
|
||||
public abstract class TypeAbstractException<T> extends TypeAbstract<T>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// ABSTRACT
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -6,7 +6,7 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public abstract class ARAbstractNumber<T extends Number> extends ARAbstractPrimitive<T>
|
||||
public abstract class TypeAbstractNumber<T extends Number> extends TypeAbstractPrimitive<T>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTANTS
|
@ -1,10 +1,10 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public abstract class ARAbstractPrimitive<T> extends ARAbstractException<T>
|
||||
public abstract class TypeAbstractPrimitive<T> extends TypeAbstractException<T>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public abstract class ARAbstractSelect<T> extends ARAbstract<T>
|
||||
public abstract class TypeAbstractSelect<T> extends TypeAbstract<T>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTANT
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -7,41 +7,41 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public final class ARAll
|
||||
public final class TypeAll
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> AR<Collection<T>> get(AR<?> inner)
|
||||
public static <T> Type<Collection<T>> get(Type<?> inner)
|
||||
{
|
||||
if (inner instanceof ARCollection) return new ARAllCollection<T>((ARCollection<? extends Collection<T>>) inner);
|
||||
if (inner instanceof ARAllAble) return new ARAllDefault<T>((ARAllAble<T>) inner);
|
||||
throw new IllegalArgumentException("innerArgReader must be an instance of either ARCollection or ARAllAble");
|
||||
if (inner instanceof TypeCollection) return new TypeAllCollection<T>((TypeCollection<? extends Collection<T>>) inner);
|
||||
if (inner instanceof TypeAllAble) return new TypeAllDefault<T>((TypeAllAble<T>) inner);
|
||||
throw new IllegalArgumentException("innerType must be an instance of either TypeCollection or TypeAllAble");
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// AR ALL DEFAULT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static class ARAllDefault<T> extends ARWrapper<Collection<T>>
|
||||
private static class TypeAllDefault<T> extends TypeWrapper<Collection<T>>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
protected ARAllAble<T> innerArgReader;
|
||||
@Override public ARAllAble<T> getInnerArgReader() { return this.innerArgReader; }
|
||||
protected TypeAllAble<T> innerType;
|
||||
@Override public TypeAllAble<T> getInnerType() { return this.innerType; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public ARAllDefault(ARAllAble<T> inner)
|
||||
public TypeAllDefault(TypeAllAble<T> inner)
|
||||
{
|
||||
if (inner == null) throw new IllegalArgumentException("innerArgReader musn't be null");
|
||||
this.innerArgReader = inner;
|
||||
if (inner == null) throw new IllegalArgumentException("innerType musn't be null");
|
||||
this.innerType = inner;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -51,16 +51,16 @@ public final class ARAll
|
||||
@Override
|
||||
public Collection<T> read(String arg, CommandSender sender) throws MassiveException
|
||||
{
|
||||
if ("all".equalsIgnoreCase(arg)) return getInnerArgReader().getAll(sender);
|
||||
if ("all".equalsIgnoreCase(arg)) return getInnerType().getAll(sender);
|
||||
|
||||
T innerRet = getInnerArgReader().read(arg, sender);
|
||||
T innerRet = getInnerType().read(arg, sender);
|
||||
return Collections.singletonList(innerRet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(String arg, CommandSender sender)
|
||||
{
|
||||
return "all".equalsIgnoreCase(arg) || this.getInnerArgReader().isValid(arg, sender);
|
||||
return "all".equalsIgnoreCase(arg) || this.getInnerType().isValid(arg, sender);
|
||||
}
|
||||
|
||||
}
|
||||
@ -69,24 +69,24 @@ public final class ARAll
|
||||
// AR ALL COLLECTION
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static class ARAllCollection<T> extends ARWrapper<Collection<T>>
|
||||
private static class TypeAllCollection<T> extends TypeWrapper<Collection<T>>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
protected ARCollection<? extends Collection<T>> innerArgReader;
|
||||
@Override public ARCollection<? extends Collection<T>> getInnerArgReader() { return this.innerArgReader; }
|
||||
protected TypeCollection<? extends Collection<T>> innerType;
|
||||
@Override public TypeCollection<? extends Collection<T>> getInnerType() { return this.innerType; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public ARAllCollection(ARCollection<? extends Collection<T>> inner)
|
||||
public TypeAllCollection(TypeCollection<? extends Collection<T>> inner)
|
||||
{
|
||||
if (inner == null) throw new IllegalArgumentException("innerArgReader musn't be null");
|
||||
if ( !(inner.getInnerArgReader() instanceof ARAllAble)) throw new IllegalArgumentException("innerArgReaders innerArgReader must implement ARAllAble");
|
||||
this.innerArgReader = inner;
|
||||
if (inner == null) throw new IllegalArgumentException("innerType musn't be null");
|
||||
if ( !(inner.getInnerType() instanceof TypeAllAble)) throw new IllegalArgumentException("innerType must implement ARAllAble");
|
||||
this.innerType = inner;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -99,17 +99,17 @@ public final class ARAll
|
||||
if ("all".equalsIgnoreCase(arg))
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
ARAllAble<T> innersInner = (ARAllAble<T>) getInnerArgReader().getInnerArgReader();
|
||||
TypeAllAble<T> innersInner = (TypeAllAble<T>) getInnerType().getInnerType();
|
||||
return innersInner.getAll(sender);
|
||||
}
|
||||
|
||||
return getInnerArgReader().read(arg, sender);
|
||||
return getInnerType().read(arg, sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(String arg, CommandSender sender)
|
||||
{
|
||||
return "all".equalsIgnoreCase(arg) || this.getInnerArgReader().isValid(arg, sender);
|
||||
return "all".equalsIgnoreCase(arg) || this.getInnerType().isValid(arg, sender);
|
||||
}
|
||||
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public interface ARAllAble<T> extends AR<T>
|
||||
public interface TypeAllAble<T> extends Type<T>
|
||||
{
|
||||
public Collection<T> getAll(CommandSender sender);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@ -8,14 +8,14 @@ import com.massivecraft.massivecore.Aspect;
|
||||
import com.massivecraft.massivecore.AspectColl;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
|
||||
public class ARAspect extends ARAbstractSelect<Aspect>
|
||||
public class TypeAspect extends TypeAbstractSelect<Aspect>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARAspect i = new ARAspect();
|
||||
public static ARAspect get() { return i; }
|
||||
private static TypeAspect i = new TypeAspect();
|
||||
public static TypeAspect get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -8,14 +8,14 @@ import java.util.List;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class ARBiome extends ARAbstractSelect<Biome> implements ARAllAble<Biome>
|
||||
public class TypeBiome extends TypeAbstractSelect<Biome> implements TypeAllAble<Biome>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARBiome i = new ARBiome();
|
||||
public static ARBiome get() { return i; }
|
||||
private static TypeBiome i = new TypeBiome();
|
||||
public static TypeBiome get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
|
||||
public class ARBoolean extends ARAbstractPrimitive<Boolean>
|
||||
public class TypeBoolean extends TypeAbstractPrimitive<Boolean>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTANTS
|
||||
@ -29,8 +29,8 @@ public class ARBoolean extends ARAbstractPrimitive<Boolean>
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARBoolean i = new ARBoolean();
|
||||
public static ARBoolean get() { return i; }
|
||||
private static TypeBoolean i = new TypeBoolean();
|
||||
public static TypeBoolean get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,15 +1,15 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class ARByte extends ARAbstractNumber<Byte>
|
||||
public class TypeByte extends TypeAbstractNumber<Byte>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARByte i = new ARByte();
|
||||
public static ARByte get() { return i; }
|
||||
private static TypeByte i = new TypeByte();
|
||||
public static TypeByte get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -8,14 +8,14 @@ import java.util.List;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class ARChatColor extends ARAbstractSelect<ChatColor> implements ARAllAble<ChatColor>
|
||||
public class TypeChatColor extends TypeAbstractSelect<ChatColor> implements TypeAllAble<ChatColor>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARChatColor i = new ARChatColor();
|
||||
public static ARChatColor get() { return i; }
|
||||
private static TypeChatColor i = new TypeChatColor();
|
||||
public static TypeChatColor get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@ -6,14 +6,14 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.store.Coll;
|
||||
|
||||
public class ARColl extends ARAbstractSelect<Coll<?>> implements ARAllAble<Coll<?>>
|
||||
public class TypeColl extends TypeAbstractSelect<Coll<?>> implements TypeAllAble<Coll<?>>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARColl i = new ARColl();
|
||||
public static ARColl get() { return i; }
|
||||
private static TypeColl i = new TypeColl();
|
||||
public static TypeColl get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public abstract class ARCollection<E extends Collection<?>> extends ARWrapper<E>
|
||||
public abstract class TypeCollection<E extends Collection<?>> extends TypeWrapper<E>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
@ -18,7 +18,7 @@ public abstract class ARCollection<E extends Collection<?>> extends ARWrapper<E>
|
||||
{
|
||||
// Because we accept multiple arguments of the same type.
|
||||
// The passed arg might be more than one. We only want the latest.
|
||||
return this.getInnerArgReader().getTabList(sender, getLastArg(arg));
|
||||
return this.getInnerType().getTabList(sender, getLastArg(arg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -26,7 +26,7 @@ public abstract class ARCollection<E extends Collection<?>> extends ARWrapper<E>
|
||||
{
|
||||
// Because we accept multiple arguments of the same type.
|
||||
// The passed arg might be more than one. We only want the latest.
|
||||
return this.getInnerArgReader().getTabListFiltered(sender, getLastArg(arg));
|
||||
return this.getInnerType().getTabListFiltered(sender, getLastArg(arg));
|
||||
}
|
||||
|
||||
public static String getLastArg(String str)
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -9,27 +9,27 @@ import org.bukkit.command.CommandSender;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
|
||||
public class ARCombined extends ARAbstract<List<?>>
|
||||
public class TypeCombined extends TypeAbstract<List<?>>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
protected List<AR<?>> inners;
|
||||
public List<AR<?>> getInners() { return this.inners; }
|
||||
protected List<Type<?>> inners;
|
||||
public List<Type<?>> getInners() { return this.inners; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static ARCombined get(Collection<AR<?>> inners) { return new ARCombined(inners); }
|
||||
public static ARCombined get(AR<?>... inners) { return new ARCombined(inners); }
|
||||
public static TypeCombined get(Collection<Type<?>> inners) { return new TypeCombined(inners); }
|
||||
public static TypeCombined get(Type<?>... inners) { return new TypeCombined(inners); }
|
||||
|
||||
public ARCombined(Collection<AR<?>> inners)
|
||||
public TypeCombined(Collection<Type<?>> inners)
|
||||
{
|
||||
this.inners = new MassiveList<AR<?>>(inners);
|
||||
this.inners = new MassiveList<Type<?>>(inners);
|
||||
}
|
||||
public ARCombined(AR<?>... inners)
|
||||
public TypeCombined(Type<?>... inners)
|
||||
{
|
||||
this(Arrays.asList(inners));
|
||||
}
|
||||
@ -62,9 +62,9 @@ public class ARCombined extends ARAbstract<List<?>>
|
||||
for (int i = 0; i < parts.size(); i++)
|
||||
{
|
||||
String part = parts.get(i);
|
||||
AR<?> argReader = this.getInners().get(i);
|
||||
Type<?> type = this.getInners().get(i);
|
||||
|
||||
Object asdf = argReader.read(part, sender);
|
||||
Object asdf = type.read(part, sender);
|
||||
|
||||
ret.add(asdf);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -8,7 +8,7 @@ import java.util.Date;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class ARDate extends ARAbstractPrimitive<Date>
|
||||
public class TypeDate extends TypeAbstractPrimitive<Date>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTANTS
|
||||
@ -20,8 +20,8 @@ public class ARDate extends ARAbstractPrimitive<Date>
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARDate i = new ARDate();
|
||||
public static ARDate get() { return i; }
|
||||
private static TypeDate i = new TypeDate();
|
||||
public static TypeDate get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@ -9,14 +9,14 @@ import com.massivecraft.massivecore.event.EventMassiveCoreDestination;
|
||||
import com.massivecraft.massivecore.event.EventMassiveCoreDestinationTabList;
|
||||
import com.massivecraft.massivecore.teleport.Destination;
|
||||
|
||||
public class ARDestination extends ARAbstract<Destination>
|
||||
public class TypeDestination extends TypeAbstract<Destination>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARDestination i = new ARDestination();
|
||||
public static ARDestination get() { return i; }
|
||||
private static TypeDestination i = new TypeDestination();
|
||||
public static TypeDestination get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -10,7 +10,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
|
||||
public class ARDifficulty extends ARAbstractSelect<Difficulty> implements ARAllAble<Difficulty>
|
||||
public class TypeDifficulty extends TypeAbstractSelect<Difficulty> implements TypeAllAble<Difficulty>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTANTS
|
||||
@ -22,8 +22,8 @@ public class ARDifficulty extends ARAbstractSelect<Difficulty> implements ARAllA
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARDifficulty i = new ARDifficulty();
|
||||
public static ARDifficulty get() { return i; }
|
||||
private static TypeDifficulty i = new TypeDifficulty();
|
||||
public static TypeDifficulty get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,15 +1,15 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class ARDouble extends ARAbstractNumber<Double>
|
||||
public class TypeDouble extends TypeAbstractNumber<Double>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARDouble i = new ARDouble();
|
||||
public static ARDouble get() { return i; }
|
||||
private static TypeDouble i = new TypeDouble();
|
||||
public static TypeDouble get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -8,14 +8,14 @@ import java.util.List;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class AREntityType extends ARAbstractSelect<EntityType> implements ARAllAble<EntityType>
|
||||
public class TypeEntityType extends TypeAbstractSelect<EntityType> implements TypeAllAble<EntityType>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static AREntityType i = new AREntityType();
|
||||
public static AREntityType get() { return i; }
|
||||
private static TypeEntityType i = new TypeEntityType();
|
||||
public static TypeEntityType get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class AREnum<T> extends ARAbstractSelect<T> implements ARAllAble<T>
|
||||
public class TypeEnum<T> extends TypeAbstractSelect<T> implements TypeAllAble<T>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELD
|
||||
@ -21,12 +21,12 @@ public class AREnum<T> extends ARAbstractSelect<T> implements ARAllAble<T>
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static <T> AREnum<T> get(Class<T> clazz)
|
||||
public static <T> TypeEnum<T> get(Class<T> clazz)
|
||||
{
|
||||
return new AREnum<T>(clazz);
|
||||
return new TypeEnum<T>(clazz);
|
||||
}
|
||||
|
||||
public AREnum(Class<T> clazz)
|
||||
public TypeEnum(Class<T> clazz)
|
||||
{
|
||||
if ( ! clazz.isEnum()) throw new IllegalArgumentException("passed clazz param must be an enum");
|
||||
this.clazz = clazz;
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
|
||||
public class AREnvironment extends ARAbstractSelect<Environment> implements ARAllAble<Environment>
|
||||
public class TypeEnvironment extends TypeAbstractSelect<Environment> implements TypeAllAble<Environment>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTANTS
|
||||
@ -23,8 +23,8 @@ public class AREnvironment extends ARAbstractSelect<Environment> implements ARAl
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static AREnvironment i = new AREnvironment();
|
||||
public static AREnvironment get() { return i; }
|
||||
private static TypeEnvironment i = new TypeEnvironment();
|
||||
public static TypeEnvironment get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,15 +1,15 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class ARFloat extends ARAbstractNumber<Float>
|
||||
public class TypeFloat extends TypeAbstractNumber<Float>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARFloat i = new ARFloat();
|
||||
public static ARFloat get() { return i; }
|
||||
private static TypeFloat i = new TypeFloat();
|
||||
public static TypeFloat get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -10,14 +10,14 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class ARGameMode extends ARAbstractSelect<GameMode> implements ARAllAble<GameMode>
|
||||
public class TypeGameMode extends TypeAbstractSelect<GameMode> implements TypeAllAble<GameMode>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARGameMode i = new ARGameMode();
|
||||
public static ARGameMode get() { return i; }
|
||||
private static TypeGameMode i = new TypeGameMode();
|
||||
public static TypeGameMode get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,15 +1,15 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class ARInteger extends ARAbstractNumber<Integer>
|
||||
public class TypeInteger extends TypeAbstractNumber<Integer>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARInteger i = new ARInteger();
|
||||
public static ARInteger get() { return i; }
|
||||
private static TypeInteger i = new TypeInteger();
|
||||
public static TypeInteger get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -8,28 +8,28 @@ import org.bukkit.command.CommandSender;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class ARList<E> extends ARCollection<List<E>>
|
||||
public class TypeList<E> extends TypeCollection<List<E>>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
protected AR<E> elementArgReader;
|
||||
public AR<E> getElementArgReader() { return this.elementArgReader; }
|
||||
@Override public AR<E> getInnerArgReader() { return this.getElementArgReader(); }
|
||||
protected Type<E> elementType;
|
||||
public Type<E> getElementType() { return this.elementType; }
|
||||
@Override public Type<E> getInnerType() { return this.getElementType(); }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static <E> ARList<E> get(AR<E> elementArgReader)
|
||||
public static <E> TypeList<E> get(Type<E> elementType)
|
||||
{
|
||||
return new ARList<E>(elementArgReader);
|
||||
return new TypeList<E>(elementType);
|
||||
}
|
||||
|
||||
public ARList(AR<E> elementArgReader)
|
||||
public TypeList(Type<E> elementType)
|
||||
{
|
||||
this.elementArgReader = elementArgReader;
|
||||
this.elementType = elementType;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -49,7 +49,7 @@ public class ARList<E> extends ARCollection<List<E>>
|
||||
// For Each
|
||||
for (String elementArg : elementArgs)
|
||||
{
|
||||
E element = this.getElementArgReader().read(elementArg, sender);
|
||||
E element = this.getElementType().read(elementArg, sender);
|
||||
|
||||
ret.add(element);
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class ARLong extends ARAbstractNumber<Long>
|
||||
public class TypeLong extends TypeAbstractNumber<Long>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARLong i = new ARLong();
|
||||
public static ARLong get() { return i; }
|
||||
private static TypeLong i = new TypeLong();
|
||||
public static TypeLong get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -10,14 +10,14 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public class ARMaterial extends ARAbstract<Material> implements ARAllAble<Material>
|
||||
public class TypeMaterial extends TypeAbstract<Material> implements TypeAllAble<Material>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARMaterial i = new ARMaterial();
|
||||
public static ARMaterial get() { return i; }
|
||||
private static TypeMaterial i = new TypeMaterial();
|
||||
public static TypeMaterial get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -7,14 +7,14 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.util.TimeDiffUtil;
|
||||
|
||||
public class ARMillisDiff extends ARAbstractException<Long>
|
||||
public class TypeMillisDiff extends TypeAbstractException<Long>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARMillisDiff i = new ARMillisDiff();
|
||||
public static ARMillisDiff get() { return i; }
|
||||
private static TypeMillisDiff i = new TypeMillisDiff();
|
||||
public static TypeMillisDiff get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@ -8,14 +8,14 @@ import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.MultiverseColl;
|
||||
|
||||
public class ARMultiverse extends ARAbstractSelect<Multiverse>
|
||||
public class TypeMultiverse extends TypeAbstractSelect<Multiverse>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARMultiverse i = new ARMultiverse();
|
||||
public static ARMultiverse get() { return i; }
|
||||
private static TypeMultiverse i = new TypeMultiverse();
|
||||
public static TypeMultiverse get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -11,14 +11,14 @@ import com.massivecraft.massivecore.MassiveCore;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
|
||||
public class ARNullable<T> extends ARAbstract<T>
|
||||
public class TypeNullable<T> extends TypeAbstract<T>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
protected AR<T> innerArgReader;
|
||||
public AR<T> getInnerArgReader() { return this.innerArgReader; }
|
||||
protected Type<T> innerType;
|
||||
public Type<T> getInnerType() { return this.innerType; }
|
||||
|
||||
protected Collection<String> nulls;
|
||||
public Collection<String> getNulls() { return this.nulls; }
|
||||
@ -27,40 +27,40 @@ public class ARNullable<T> extends ARAbstract<T>
|
||||
// INSTANCE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static <T> ARNullable<T> get(AR<T> inner, Collection<String> nulls)
|
||||
public static <T> TypeNullable<T> get(Type<T> inner, Collection<String> nulls)
|
||||
{
|
||||
return new ARNullable<T>(inner, nulls);
|
||||
return new TypeNullable<T>(inner, nulls);
|
||||
}
|
||||
|
||||
public static <T> ARNullable<T> get(AR<T> inner, String... nulls)
|
||||
public static <T> TypeNullable<T> get(Type<T> inner, String... nulls)
|
||||
{
|
||||
return new ARNullable<T>(inner, nulls);
|
||||
return new TypeNullable<T>(inner, nulls);
|
||||
}
|
||||
|
||||
public static <T> ARNullable<T> get(AR<T> inner)
|
||||
public static <T> TypeNullable<T> get(Type<T> inner)
|
||||
{
|
||||
return new ARNullable<T>(inner);
|
||||
return new TypeNullable<T>(inner);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public ARNullable(AR<T> inner, Collection<String> nulls)
|
||||
public TypeNullable(Type<T> inner, Collection<String> nulls)
|
||||
{
|
||||
if (inner == null) throw new NullPointerException("inner");
|
||||
if (nulls == null) nulls = Collections.emptySet();
|
||||
|
||||
this.innerArgReader = inner;
|
||||
this.innerType = inner;
|
||||
this.nulls = nulls;
|
||||
}
|
||||
|
||||
public ARNullable(AR<T> inner, String... nulls)
|
||||
public TypeNullable(Type<T> inner, String... nulls)
|
||||
{
|
||||
this(inner, Arrays.asList(nulls));
|
||||
}
|
||||
|
||||
public ARNullable(AR<T> inner)
|
||||
public TypeNullable(Type<T> inner)
|
||||
{
|
||||
this(inner, MassiveCore.NOTHING_REMOVE);
|
||||
}
|
||||
@ -72,7 +72,7 @@ public class ARNullable<T> extends ARAbstract<T>
|
||||
@Override
|
||||
public String getTypeName()
|
||||
{
|
||||
return this.getInnerArgReader().getTypeName();
|
||||
return this.getInnerType().getTypeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -82,7 +82,7 @@ public class ARNullable<T> extends ARAbstract<T>
|
||||
if (this.getNulls().contains(arg)) return null;
|
||||
|
||||
// Inner
|
||||
return this.getInnerArgReader().read(arg, sender);
|
||||
return this.getInnerType().read(arg, sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,7 +92,7 @@ public class ARNullable<T> extends ARAbstract<T>
|
||||
List<String> ret = new MassiveList<String>(this.getNulls());
|
||||
|
||||
// Fill Ret
|
||||
ret.addAll(this.getInnerArgReader().getTabList(sender, arg));
|
||||
ret.addAll(this.getInnerType().getTabList(sender, arg));
|
||||
|
||||
// Return Ret
|
||||
return ret;
|
||||
@ -101,7 +101,7 @@ public class ARNullable<T> extends ARAbstract<T>
|
||||
@Override
|
||||
public boolean allowSpaceAfterTab()
|
||||
{
|
||||
return this.getInnerArgReader().allowSpaceAfterTab();
|
||||
return this.getInnerType().allowSpaceAfterTab();
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -12,14 +12,14 @@ import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.ps.PSBuilder;
|
||||
|
||||
public class ARPS extends ARAbstract<PS>
|
||||
public class TypePS extends TypeAbstract<PS>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARPS i = new ARPS();
|
||||
public static ARPS get() { return i; }
|
||||
private static TypePS i = new TypePS();
|
||||
public static TypePS get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
@ -51,10 +51,10 @@ public class ARPS extends ARAbstract<PS>
|
||||
{
|
||||
try
|
||||
{
|
||||
String world = ARWorldId.get().read(parts.get(0), sender);
|
||||
double locationX = ARDouble.get().read(parts.get(1), sender);
|
||||
double locationY = ARDouble.get().read(parts.get(2), sender);
|
||||
double locationZ = ARDouble.get().read(parts.get(3), sender);
|
||||
String world = TypeWorldId.get().read(parts.get(0), sender);
|
||||
double locationX = TypeDouble.get().read(parts.get(1), sender);
|
||||
double locationY = TypeDouble.get().read(parts.get(2), sender);
|
||||
double locationZ = TypeDouble.get().read(parts.get(3), sender);
|
||||
return new PSBuilder(senderPs).world(world).locationX(locationX).locationY(locationY).locationZ(locationZ).build();
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -64,10 +64,10 @@ public class ARPS extends ARAbstract<PS>
|
||||
|
||||
try
|
||||
{
|
||||
double locationX = ARDouble.get().read(parts.get(0), sender);
|
||||
double locationY = ARDouble.get().read(parts.get(1), sender);
|
||||
double locationZ = ARDouble.get().read(parts.get(2), sender);
|
||||
String world = ARWorldId.get().read(parts.get(3), sender);
|
||||
double locationX = TypeDouble.get().read(parts.get(0), sender);
|
||||
double locationY = TypeDouble.get().read(parts.get(1), sender);
|
||||
double locationZ = TypeDouble.get().read(parts.get(2), sender);
|
||||
String world = TypeWorldId.get().read(parts.get(3), sender);
|
||||
return new PSBuilder(senderPs).world(world).locationX(locationX).locationY(locationY).locationZ(locationZ).build();
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -79,9 +79,9 @@ public class ARPS extends ARAbstract<PS>
|
||||
{
|
||||
try
|
||||
{
|
||||
double locationX = ARDouble.get().read(parts.get(0), sender);
|
||||
double locationY = ARDouble.get().read(parts.get(1), sender);
|
||||
double locationZ = ARDouble.get().read(parts.get(2), sender);
|
||||
double locationX = TypeDouble.get().read(parts.get(0), sender);
|
||||
double locationY = TypeDouble.get().read(parts.get(1), sender);
|
||||
double locationZ = TypeDouble.get().read(parts.get(2), sender);
|
||||
return new PSBuilder(senderPs).locationX(locationX).locationY(locationY).locationZ(locationZ).build();
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -100,98 +100,98 @@ public class ARPS extends ARAbstract<PS>
|
||||
value = getValue(part, PS.NAME_SERIALIZED_WORLD, PS.NAME_FULL_WORLD);
|
||||
if (value != null)
|
||||
{
|
||||
ret.world(ARWorldId.get().read(value, sender));
|
||||
ret.world(TypeWorldId.get().read(value, sender));
|
||||
something = true;
|
||||
}
|
||||
|
||||
value = getValue(part, PS.NAME_SERIALIZED_BLOCKX, PS.NAME_FULL_BLOCKX);
|
||||
if (value != null)
|
||||
{
|
||||
ret.blockX(ARInteger.get().read(value, sender));
|
||||
ret.blockX(TypeInteger.get().read(value, sender));
|
||||
something = true;
|
||||
}
|
||||
|
||||
value = getValue(part, PS.NAME_SERIALIZED_BLOCKY, PS.NAME_FULL_BLOCKY);
|
||||
if (value != null)
|
||||
{
|
||||
ret.blockY(ARInteger.get().read(value, sender));
|
||||
ret.blockY(TypeInteger.get().read(value, sender));
|
||||
something = true;
|
||||
}
|
||||
|
||||
value = getValue(part, PS.NAME_SERIALIZED_BLOCKZ, PS.NAME_FULL_BLOCKZ);
|
||||
if (value != null)
|
||||
{
|
||||
ret.blockZ(ARInteger.get().read(value, sender));
|
||||
ret.blockZ(TypeInteger.get().read(value, sender));
|
||||
something = true;
|
||||
}
|
||||
|
||||
value = getValue(part, PS.NAME_SERIALIZED_LOCATIONX, PS.NAME_FULL_LOCATIONX, "x");
|
||||
if (value != null)
|
||||
{
|
||||
ret.locationX(ARDouble.get().read(value, sender));
|
||||
ret.locationX(TypeDouble.get().read(value, sender));
|
||||
something = true;
|
||||
}
|
||||
|
||||
value = getValue(part, PS.NAME_SERIALIZED_LOCATIONY, PS.NAME_FULL_LOCATIONY, "y");
|
||||
if (value != null)
|
||||
{
|
||||
ret.locationY(ARDouble.get().read(value, sender));
|
||||
ret.locationY(TypeDouble.get().read(value, sender));
|
||||
something = true;
|
||||
}
|
||||
|
||||
value = getValue(part, PS.NAME_SERIALIZED_LOCATIONZ, PS.NAME_FULL_LOCATIONZ, "z");
|
||||
if (value != null)
|
||||
{
|
||||
ret.locationZ(ARDouble.get().read(value, sender));
|
||||
ret.locationZ(TypeDouble.get().read(value, sender));
|
||||
something = true;
|
||||
}
|
||||
|
||||
value = getValue(part, PS.NAME_SERIALIZED_CHUNKX, PS.NAME_FULL_CHUNKX);
|
||||
if (value != null)
|
||||
{
|
||||
ret.chunkX(ARInteger.get().read(value, sender));
|
||||
ret.chunkX(TypeInteger.get().read(value, sender));
|
||||
something = true;
|
||||
}
|
||||
|
||||
value = getValue(part, PS.NAME_SERIALIZED_CHUNKZ, PS.NAME_FULL_CHUNKZ);
|
||||
if (value != null)
|
||||
{
|
||||
ret.chunkZ(ARInteger.get().read(value, sender));
|
||||
ret.chunkZ(TypeInteger.get().read(value, sender));
|
||||
something = true;
|
||||
}
|
||||
|
||||
value = getValue(part, PS.NAME_SERIALIZED_PITCH, PS.NAME_FULL_PITCH);
|
||||
if (value != null)
|
||||
{
|
||||
ret.pitch(ARFloat.get().read(value, sender));
|
||||
ret.pitch(TypeFloat.get().read(value, sender));
|
||||
something = true;
|
||||
}
|
||||
|
||||
value = getValue(part, PS.NAME_SERIALIZED_YAW, PS.NAME_FULL_YAW);
|
||||
if (value != null)
|
||||
{
|
||||
ret.yaw(ARFloat.get().read(value, sender));
|
||||
ret.yaw(TypeFloat.get().read(value, sender));
|
||||
something = true;
|
||||
}
|
||||
|
||||
value = getValue(part, PS.NAME_SERIALIZED_VELOCITYX, PS.NAME_FULL_VELOCITYX);
|
||||
if (value != null)
|
||||
{
|
||||
ret.velocityX(ARDouble.get().read(value, sender));
|
||||
ret.velocityX(TypeDouble.get().read(value, sender));
|
||||
something = true;
|
||||
}
|
||||
|
||||
value = getValue(part, PS.NAME_SERIALIZED_VELOCITYY, PS.NAME_FULL_VELOCITYY);
|
||||
if (value != null)
|
||||
{
|
||||
ret.velocityY(ARDouble.get().read(value, sender));
|
||||
ret.velocityY(TypeDouble.get().read(value, sender));
|
||||
something = true;
|
||||
}
|
||||
|
||||
value = getValue(part, PS.NAME_SERIALIZED_VELOCITYZ, PS.NAME_FULL_VELOCITYZ);
|
||||
if (value != null)
|
||||
{
|
||||
ret.velocityZ(ARDouble.get().read(value, sender));
|
||||
ret.velocityZ(TypeDouble.get().read(value, sender));
|
||||
something = true;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
@ -10,14 +10,14 @@ import org.bukkit.permissions.Permission;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public class ARPermission extends ARAbstract<Permission> implements ARAllAble<Permission>
|
||||
public class TypePermission extends TypeAbstract<Permission> implements TypeAllAble<Permission>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARPermission i = new ARPermission();
|
||||
public static ARPermission get() { return i; }
|
||||
private static TypePermission i = new TypePermission();
|
||||
public static TypePermission get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -7,15 +7,15 @@ import com.massivecraft.massivecore.SenderType;
|
||||
import com.massivecraft.massivecore.store.SenderIdSourceMixinAllSenderIds;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
|
||||
public class ARPlayer extends ARSenderIdAbstract<Player>
|
||||
public class TypePlayer extends TypeSenderIdAbstract<Player>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static final ARPlayer i = new ARPlayer();
|
||||
public static ARPlayer get() { return i; }
|
||||
private ARPlayer()
|
||||
private static final TypePlayer i = new TypePlayer();
|
||||
public static TypePlayer get() { return i; }
|
||||
private TypePlayer()
|
||||
{
|
||||
super(SenderIdSourceMixinAllSenderIds.get(), SenderPresence.LOCAL, SenderType.PLAYER);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -10,14 +10,14 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
|
||||
public class ARPotionEffectType extends ARAbstractSelect<PotionEffectType> implements ARAllAble<PotionEffectType>
|
||||
public class TypePotionEffectType extends TypeAbstractSelect<PotionEffectType> implements TypeAllAble<PotionEffectType>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARPotionEffectType i = new ARPotionEffectType();
|
||||
public static ARPotionEffectType get() { return i; }
|
||||
private static TypePotionEffectType i = new TypePotionEffectType();
|
||||
public static TypePotionEffectType get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -9,25 +9,25 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.PotionEffectWrap;
|
||||
|
||||
public class ARPotionEffectWrap extends ARAbstract<PotionEffectWrap>
|
||||
public class TypePotionEffectWrap extends TypeAbstract<PotionEffectWrap>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARPotionEffectWrap i = new ARPotionEffectWrap();
|
||||
public static ARPotionEffectWrap get() { return i; }
|
||||
private static TypePotionEffectWrap i = new TypePotionEffectWrap();
|
||||
public static TypePotionEffectWrap get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
protected final ARCombined combined = new ARCombined(
|
||||
ARPotionEffectType.get(),
|
||||
ARInteger.get(),
|
||||
ARInteger.get(),
|
||||
ARBoolean.get(),
|
||||
ARBoolean.get()
|
||||
protected final TypeCombined combined = new TypeCombined(
|
||||
TypePotionEffectType.get(),
|
||||
TypeInteger.get(),
|
||||
TypeInteger.get(),
|
||||
TypeBoolean.get(),
|
||||
TypeBoolean.get()
|
||||
);
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -81,7 +81,7 @@ public class ARPotionEffectWrap extends ARAbstract<PotionEffectWrap>
|
||||
@Override
|
||||
public Collection<String> getTabList(CommandSender sender, String arg)
|
||||
{
|
||||
return ARPotionEffectType.get().getTabList(sender, arg);
|
||||
return TypePotionEffectType.get().getTabList(sender, arg);
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@ -7,15 +7,15 @@ import com.massivecraft.massivecore.SenderType;
|
||||
import com.massivecraft.massivecore.store.SenderIdSourceMixinAllSenderIds;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
|
||||
public class ARSender extends ARSenderIdAbstract<CommandSender>
|
||||
public class TypeSender extends TypeSenderIdAbstract<CommandSender>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static final ARSender i = new ARSender();
|
||||
public static ARSender get() { return i; }
|
||||
private ARSender()
|
||||
private static final TypeSender i = new TypeSender();
|
||||
public static TypeSender get() { return i; }
|
||||
private TypeSender()
|
||||
{
|
||||
super(SenderIdSourceMixinAllSenderIds.get(), SenderPresence.LOCAL, SenderType.ANY);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -8,7 +8,7 @@ import com.massivecraft.massivecore.SenderType;
|
||||
import com.massivecraft.massivecore.store.SenderColl;
|
||||
import com.massivecraft.massivecore.store.SenderEntity;
|
||||
|
||||
public class ARSenderEntity<T extends SenderEntity<T>> extends ARSenderIdAbstract<T> implements ARAllAble<T>
|
||||
public class TypeSenderEntity<T extends SenderEntity<T>> extends TypeSenderIdAbstract<T> implements TypeAllAble<T>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
@ -20,19 +20,19 @@ public class ARSenderEntity<T extends SenderEntity<T>> extends ARSenderIdAbstrac
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private ARSenderEntity(SenderColl<T> coll, SenderPresence presence, SenderType type)
|
||||
private TypeSenderEntity(SenderColl<T> coll, SenderPresence presence, SenderType type)
|
||||
{
|
||||
super(coll, presence, type);
|
||||
this.coll = coll;
|
||||
}
|
||||
|
||||
private ARSenderEntity(SenderColl<T> coll, SenderPresence presence)
|
||||
private TypeSenderEntity(SenderColl<T> coll, SenderPresence presence)
|
||||
{
|
||||
super(coll, presence);
|
||||
this.coll = coll;
|
||||
}
|
||||
|
||||
private ARSenderEntity(SenderColl<T> coll)
|
||||
private TypeSenderEntity(SenderColl<T> coll)
|
||||
{
|
||||
super(coll);
|
||||
this.coll = coll;
|
||||
@ -42,9 +42,9 @@ public class ARSenderEntity<T extends SenderEntity<T>> extends ARSenderIdAbstrac
|
||||
// GET
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static <T extends SenderEntity<T>> ARSenderEntity<T> get(SenderColl<T> coll, SenderPresence presence, SenderType type) { return new ARSenderEntity<T>(coll, presence, type); }
|
||||
public static <T extends SenderEntity<T>> ARSenderEntity<T> get(SenderColl<T> coll, SenderPresence presence) { return new ARSenderEntity<T>(coll, presence); }
|
||||
public static <T extends SenderEntity<T>> ARSenderEntity<T> get(SenderColl<T> coll) { return new ARSenderEntity<T>(coll); }
|
||||
public static <T extends SenderEntity<T>> TypeSenderEntity<T> get(SenderColl<T> coll, SenderPresence presence, SenderType type) { return new TypeSenderEntity<T>(coll, presence, type); }
|
||||
public static <T extends SenderEntity<T>> TypeSenderEntity<T> get(SenderColl<T> coll, SenderPresence presence) { return new TypeSenderEntity<T>(coll, presence); }
|
||||
public static <T extends SenderEntity<T>> TypeSenderEntity<T> get(SenderColl<T> coll) { return new TypeSenderEntity<T>(coll); }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,27 +1,27 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import com.massivecraft.massivecore.SenderPresence;
|
||||
import com.massivecraft.massivecore.SenderType;
|
||||
import com.massivecraft.massivecore.store.SenderIdSource;
|
||||
import com.massivecraft.massivecore.store.SenderIdSourceMixinAllSenderIds;
|
||||
|
||||
public class ARSenderId extends ARSenderIdAbstract<String>
|
||||
public class TypeSenderId extends TypeSenderIdAbstract<String>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private ARSenderId(SenderIdSource source, SenderPresence presence, SenderType type)
|
||||
private TypeSenderId(SenderIdSource source, SenderPresence presence, SenderType type)
|
||||
{
|
||||
super(source, presence, type);
|
||||
}
|
||||
|
||||
private ARSenderId(SenderIdSource source, SenderPresence presence)
|
||||
private TypeSenderId(SenderIdSource source, SenderPresence presence)
|
||||
{
|
||||
super(source, presence);
|
||||
}
|
||||
|
||||
private ARSenderId(SenderIdSource source)
|
||||
private TypeSenderId(SenderIdSource source)
|
||||
{
|
||||
super(source);
|
||||
}
|
||||
@ -30,16 +30,16 @@ public class ARSenderId extends ARSenderIdAbstract<String>
|
||||
// INSTANCE
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static final ARSenderId i = new ARSenderId(SenderIdSourceMixinAllSenderIds.get());
|
||||
public static ARSenderId get() { return i; }
|
||||
private static final TypeSenderId i = new TypeSenderId(SenderIdSourceMixinAllSenderIds.get());
|
||||
public static TypeSenderId get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// GET
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static ARSenderId get(SenderIdSource source, SenderPresence presence, SenderType type) { return new ARSenderId(source, presence, type); }
|
||||
public static ARSenderId get(SenderIdSource source, SenderPresence presence) { return new ARSenderId(source, presence); }
|
||||
public static ARSenderId get(SenderIdSource source) { return new ARSenderId(source); }
|
||||
public static TypeSenderId get(SenderIdSource source, SenderPresence presence, SenderType type) { return new TypeSenderId(source, presence, type); }
|
||||
public static TypeSenderId get(SenderIdSource source, SenderPresence presence) { return new TypeSenderId(source, presence); }
|
||||
public static TypeSenderId get(SenderIdSource source) { return new TypeSenderId(source); }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -15,7 +15,7 @@ import com.massivecraft.massivecore.store.SenderIdSource;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
|
||||
public abstract class ARSenderIdAbstract<T> extends ARAbstract<T>
|
||||
public abstract class TypeSenderIdAbstract<T> extends TypeAbstract<T>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
@ -29,7 +29,7 @@ public abstract class ARSenderIdAbstract<T> extends ARAbstract<T>
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public ARSenderIdAbstract(SenderIdSource source, SenderPresence presence, SenderType type)
|
||||
public TypeSenderIdAbstract(SenderIdSource source, SenderPresence presence, SenderType type)
|
||||
{
|
||||
if (source == null) throw new NullPointerException("source");
|
||||
if (presence == null) throw new NullPointerException("presence");
|
||||
@ -40,12 +40,12 @@ public abstract class ARSenderIdAbstract<T> extends ARAbstract<T>
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public ARSenderIdAbstract(SenderIdSource source, SenderPresence presence)
|
||||
public TypeSenderIdAbstract(SenderIdSource source, SenderPresence presence)
|
||||
{
|
||||
this(source, presence, SenderType.ANY);
|
||||
}
|
||||
|
||||
public ARSenderIdAbstract(SenderIdSource source)
|
||||
public TypeSenderIdAbstract(SenderIdSource source)
|
||||
{
|
||||
this(source, SenderPresence.ANY);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
@ -10,15 +10,15 @@ import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.mixin.Mixin;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class ARSet<E> extends ARCollection<Set<E>>
|
||||
public class TypeSet<E> extends TypeCollection<Set<E>>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
protected final AR<E> elementArgReader;
|
||||
public AR<E> getElementArgReader() { return this.elementArgReader; }
|
||||
@Override public AR<E> getInnerArgReader() { return this.getElementArgReader(); }
|
||||
protected final Type<E> elementType;
|
||||
public Type<E> getElementType() { return this.elementType; }
|
||||
@Override public Type<E> getInnerType() { return this.getElementType(); }
|
||||
|
||||
protected final boolean warnOnDuplicates;
|
||||
public boolean getWarnOnDuplicate() { return warnOnDuplicates; }
|
||||
@ -27,14 +27,14 @@ public class ARSet<E> extends ARCollection<Set<E>>
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static <E> ARSet<E> get(AR<E> elementArgReader, boolean warnOnDuplicates)
|
||||
public static <E> TypeSet<E> get(Type<E> elementType, boolean warnOnDuplicates)
|
||||
{
|
||||
return new ARSet<E>(elementArgReader, warnOnDuplicates);
|
||||
return new TypeSet<E>(elementType, warnOnDuplicates);
|
||||
}
|
||||
|
||||
public ARSet(AR<E> elementArgReader, boolean warnOnDuplicates)
|
||||
public TypeSet(Type<E> elementType, boolean warnOnDuplicates)
|
||||
{
|
||||
this.elementArgReader = elementArgReader;
|
||||
this.elementType = elementType;
|
||||
this.warnOnDuplicates = warnOnDuplicates;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ public class ARSet<E> extends ARCollection<Set<E>>
|
||||
@Override
|
||||
public String getTypeName()
|
||||
{
|
||||
return elementArgReader.getTypeName();
|
||||
return elementType.getTypeName();
|
||||
}
|
||||
|
||||
// NOTE: Must be used with argConcatFrom and setErrorOnTooManyArgs(false).
|
||||
@ -63,7 +63,7 @@ public class ARSet<E> extends ARCollection<Set<E>>
|
||||
// For Each
|
||||
for (String elementArg : elementArgs)
|
||||
{
|
||||
E element = this.getElementArgReader().read(elementArg, sender);
|
||||
E element = this.getElementType().read(elementArg, sender);
|
||||
|
||||
duplicates = ( ! ret.add(element) || duplicates);
|
||||
}
|
||||
@ -80,7 +80,7 @@ public class ARSet<E> extends ARCollection<Set<E>>
|
||||
@Override
|
||||
public Collection<String> getTabList(CommandSender sender, String arg)
|
||||
{
|
||||
return elementArgReader.getTabList(sender, arg);
|
||||
return elementType.getTabList(sender, arg);
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -10,14 +10,14 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public class ARSound extends ARAbstract<Sound> implements ARAllAble<Sound>
|
||||
public class TypeSound extends TypeAbstract<Sound> implements TypeAllAble<Sound>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARSound i = new ARSound();
|
||||
public static ARSound get() { return i; }
|
||||
private static TypeSound i = new TypeSound();
|
||||
public static TypeSound get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
@ -8,14 +8,14 @@ import org.bukkit.command.CommandSender;
|
||||
import com.massivecraft.massivecore.SoundEffect;
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
|
||||
public class ARSoundEffect extends ARAbstractException<SoundEffect>
|
||||
public class TypeSoundEffect extends TypeAbstractException<SoundEffect>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARSoundEffect i = new ARSoundEffect();
|
||||
public static ARSoundEffect get() { return i; }
|
||||
private static TypeSoundEffect i = new TypeSoundEffect();
|
||||
public static TypeSoundEffect get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
@ -32,7 +32,7 @@ public class ARSoundEffect extends ARAbstractException<SoundEffect>
|
||||
{
|
||||
Set<String> ret = new MassiveSet<String>();
|
||||
|
||||
for (String str : ARSound.get().getTabList(sender, arg))
|
||||
for (String str : TypeSound.get().getTabList(sender, arg))
|
||||
{
|
||||
ret.add(str + "-");
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class ARString extends ARAbstract<String>
|
||||
public class TypeString extends TypeAbstract<String>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARString i = new ARString();
|
||||
public static ARString get() { return i; }
|
||||
private static TypeString i = new TypeString();
|
||||
public static TypeString get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -19,14 +19,14 @@ import com.massivecraft.massivecore.util.Txt;
|
||||
// We return the command without leading slash.
|
||||
// If the player supplies a leading slash we assume they mean some WorldEdit double slash first.
|
||||
// Then we test without if nothing found.
|
||||
public class ARStringCommand extends ARAbstract<String>
|
||||
public class TypeStringCommand extends TypeAbstract<String>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARStringCommand i = new ARStringCommand();
|
||||
public static ARStringCommand get() { return i; }
|
||||
private static TypeStringCommand i = new TypeStringCommand();
|
||||
public static TypeStringCommand get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -11,7 +11,7 @@ import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class ARUniverse extends ARAbstract<String>
|
||||
public class TypeUniverse extends TypeAbstract<String>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
@ -30,11 +30,11 @@ public class ARUniverse extends ARAbstract<String>
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static ARUniverse get(Aspect aspect) { return new ARUniverse(aspect); }
|
||||
public static ARUniverse get(Multiverse multiverse) { return new ARUniverse(multiverse); }
|
||||
public static TypeUniverse get(Aspect aspect) { return new TypeUniverse(aspect); }
|
||||
public static TypeUniverse get(Multiverse multiverse) { return new TypeUniverse(multiverse); }
|
||||
|
||||
public ARUniverse(Aspect aspect) { this.aspect = aspect; }
|
||||
public ARUniverse(Multiverse multiverse) { this.multiverse = multiverse; }
|
||||
public TypeUniverse(Aspect aspect) { this.aspect = aspect; }
|
||||
public TypeUniverse(Multiverse multiverse) { this.multiverse = multiverse; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@ -8,14 +8,14 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public class ARWorld extends ARAbstract<World>
|
||||
public class TypeWorld extends TypeAbstract<World>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARWorld i = new ARWorld();
|
||||
public static ARWorld get() { return i; }
|
||||
private static TypeWorld i = new TypeWorld();
|
||||
public static TypeWorld get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
@ -24,7 +24,7 @@ public class ARWorld extends ARAbstract<World>
|
||||
@Override
|
||||
public World read(String arg, CommandSender sender) throws MassiveException
|
||||
{
|
||||
String worldId = ARWorldId.get().read(arg, sender);
|
||||
String worldId = TypeWorldId.get().read(arg, sender);
|
||||
|
||||
World ret = Bukkit.getWorld(worldId);
|
||||
|
||||
@ -39,7 +39,7 @@ public class ARWorld extends ARAbstract<World>
|
||||
@Override
|
||||
public Collection<String> getTabList(CommandSender sender, String arg)
|
||||
{
|
||||
return ARWorldId.get().getTabList(sender, arg);
|
||||
return TypeWorldId.get().getTabList(sender, arg);
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -8,14 +8,14 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.mixin.Mixin;
|
||||
|
||||
public class ARWorldId extends ARAbstractSelect<String> implements ARAllAble<String>
|
||||
public class TypeWorldId extends TypeAbstractSelect<String> implements TypeAllAble<String>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARWorldId i = new ARWorldId();
|
||||
public static ARWorldId get() { return i; }
|
||||
private static TypeWorldId i = new TypeWorldId();
|
||||
public static TypeWorldId get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
|
||||
public class ARWorldType extends ARAbstractSelect<WorldType>
|
||||
public class TypeWorldType extends TypeAbstractSelect<WorldType>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTANTS
|
||||
@ -21,8 +21,8 @@ public class ARWorldType extends ARAbstractSelect<WorldType>
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ARWorldType i = new ARWorldType();
|
||||
public static ARWorldType get() { return i; }
|
||||
private static TypeWorldType i = new TypeWorldType();
|
||||
public static TypeWorldType get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
@ -1,16 +1,16 @@
|
||||
package com.massivecraft.massivecore.cmd.arg;
|
||||
package com.massivecraft.massivecore.cmd.type;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public abstract class ARWrapper<T> extends ARAbstract<T>
|
||||
public abstract class TypeWrapper<T> extends TypeAbstract<T>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// ABSTRACT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public abstract AR<?> getInnerArgReader();
|
||||
public abstract Type<?> getInnerType();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
@ -19,25 +19,25 @@ public abstract class ARWrapper<T> extends ARAbstract<T>
|
||||
@Override
|
||||
public String getTypeName()
|
||||
{
|
||||
return this.getInnerArgReader().getTypeName();
|
||||
return this.getInnerType().getTypeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(String arg, CommandSender sender)
|
||||
{
|
||||
return this.getInnerArgReader().isValid(arg, sender);
|
||||
return this.getInnerType().isValid(arg, sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getTabList(CommandSender sender, String arg)
|
||||
{
|
||||
return this.getInnerArgReader().getTabList(sender, arg);
|
||||
return this.getInnerType().getTabList(sender, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowSpaceAfterTab()
|
||||
{
|
||||
return this.getInnerArgReader().allowSpaceAfterTab();
|
||||
return this.getInnerType().allowSpaceAfterTab();
|
||||
}
|
||||
|
||||
}
|
@ -4,7 +4,7 @@ import java.util.Collection;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.Predictate;
|
||||
import com.massivecraft.massivecore.Predicate;
|
||||
|
||||
public interface MessageMixin
|
||||
{
|
||||
@ -19,9 +19,9 @@ public interface MessageMixin
|
||||
public boolean msgAll(Collection<String> msgs);
|
||||
|
||||
// Predicate
|
||||
public boolean msgPredictate(Predictate<CommandSender> predictate, String msg);
|
||||
public boolean msgPredictate(Predictate<CommandSender> predictate, String msg, Object... args);
|
||||
public boolean msgPredictate(Predictate<CommandSender> predictate, Collection<String> msgs);
|
||||
public boolean msgPredicate(Predicate<CommandSender> predicate, String msg);
|
||||
public boolean msgPredicate(Predicate<CommandSender> predicate, String msg, Object... args);
|
||||
public boolean msgPredicate(Predicate<CommandSender> predicate, Collection<String> msgs);
|
||||
|
||||
// One
|
||||
public boolean msgOne(Object sendeeObject, String msg);
|
||||
@ -38,9 +38,9 @@ public interface MessageMixin
|
||||
public boolean messageAll(Collection<?> messages);
|
||||
|
||||
// Predicate
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, Object message);
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, Object... messages);
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, Collection<?> messages);
|
||||
public boolean messagePredicate(Predicate<CommandSender> predicate, Object message);
|
||||
public boolean messagePredicate(Predicate<CommandSender> predicate, Object... messages);
|
||||
public boolean messagePredicate(Predicate<CommandSender> predicate, Collection<?> messages);
|
||||
|
||||
// One
|
||||
public boolean messageOne(Object sendeeObject, Object message);
|
||||
|
@ -6,7 +6,7 @@ import java.util.Collections;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.Predictate;
|
||||
import com.massivecraft.massivecore.Predicate;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public abstract class MessageMixinAbstract implements MessageMixin
|
||||
@ -35,23 +35,23 @@ public abstract class MessageMixinAbstract implements MessageMixin
|
||||
return this.messageAll(Txt.parse(msgs));
|
||||
}
|
||||
|
||||
// Predictate
|
||||
// Predicate
|
||||
@Override
|
||||
public boolean msgPredictate(Predictate<CommandSender> predictate, String msg)
|
||||
public boolean msgPredicate(Predicate<CommandSender> predicate, String msg)
|
||||
{
|
||||
return this.messagePredictate(predictate, Txt.parse(msg));
|
||||
return this.messagePredicate(predicate, Txt.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean msgPredictate(Predictate<CommandSender> predictate, String msg, Object... args)
|
||||
public boolean msgPredicate(Predicate<CommandSender> predicate, String msg, Object... args)
|
||||
{
|
||||
return this.messagePredictate(predictate, Txt.parse(msg, args));
|
||||
return this.messagePredicate(predicate, Txt.parse(msg, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean msgPredictate(Predictate<CommandSender> predictate, Collection<String> msgs)
|
||||
public boolean msgPredicate(Predicate<CommandSender> predicate, Collection<String> msgs)
|
||||
{
|
||||
return this.messagePredictate(predictate, Txt.parse(msgs));
|
||||
return this.messagePredicate(predicate, Txt.parse(msgs));
|
||||
}
|
||||
|
||||
// One
|
||||
@ -92,15 +92,15 @@ public abstract class MessageMixinAbstract implements MessageMixin
|
||||
|
||||
// Predicate
|
||||
@Override
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, Object message)
|
||||
public boolean messagePredicate(Predicate<CommandSender> predicate, Object message)
|
||||
{
|
||||
return this.messagePredictate(predictate, Collections.singleton(message));
|
||||
return this.messagePredicate(predicate, Collections.singleton(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, Object... messages)
|
||||
public boolean messagePredicate(Predicate<CommandSender> predicate, Object... messages)
|
||||
{
|
||||
return this.messagePredictate(predictate, Arrays.asList(messages));
|
||||
return this.messagePredicate(predicate, Arrays.asList(messages));
|
||||
}
|
||||
|
||||
// One
|
||||
|
@ -5,7 +5,7 @@ import java.util.Collection;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.massivecraft.massivecore.Predictate;
|
||||
import com.massivecraft.massivecore.Predicate;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.nms.NmsPacket;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
@ -45,10 +45,10 @@ public class MessageMixinDefault extends MessageMixinAbstract
|
||||
// Predicate
|
||||
// NOTE: Targets messageOne
|
||||
@Override
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, Collection<?> messages)
|
||||
public boolean messagePredicate(Predicate<CommandSender> predicate, Collection<?> messages)
|
||||
{
|
||||
// Check Predicate
|
||||
if (predictate == null) return false;
|
||||
if (predicate == null) return false;
|
||||
|
||||
// Check Messages
|
||||
if (messages == null) return false;
|
||||
@ -57,7 +57,7 @@ public class MessageMixinDefault extends MessageMixinAbstract
|
||||
// Here
|
||||
for (CommandSender sender : IdUtil.getLocalSenders())
|
||||
{
|
||||
if (!predictate.apply(sender)) continue;
|
||||
if (!predicate.apply(sender)) continue;
|
||||
this.messageOne(sender, messages);
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.permissions.Permissible;
|
||||
|
||||
import com.massivecraft.massivecore.Predictate;
|
||||
import com.massivecraft.massivecore.Predicate;
|
||||
import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
@ -255,19 +255,19 @@ public class Mixin
|
||||
}
|
||||
|
||||
// MSG: Predicate
|
||||
public static boolean msgPredictate(Predictate<CommandSender> predictate, String msg)
|
||||
public static boolean msgPredicate(Predicate<CommandSender> predicate, String msg)
|
||||
{
|
||||
return getMessageMixin().msgPredictate(predictate, msg);
|
||||
return getMessageMixin().msgPredicate(predicate, msg);
|
||||
}
|
||||
|
||||
public static boolean msgPredictate(Predictate<CommandSender> predictate, String msg, Object... args)
|
||||
public static boolean msgPredicate(Predicate<CommandSender> predicate, String msg, Object... args)
|
||||
{
|
||||
return getMessageMixin().msgPredictate(predictate, msg, args);
|
||||
return getMessageMixin().msgPredicate(predicate, msg, args);
|
||||
}
|
||||
|
||||
public static boolean msgPredictate(Predictate<CommandSender> predictate, Collection<String> msgs)
|
||||
public static boolean msgPredicate(Predicate<CommandSender> predicate, Collection<String> msgs)
|
||||
{
|
||||
return getMessageMixin().msgPredictate(predictate, msgs);
|
||||
return getMessageMixin().msgPredicate(predicate, msgs);
|
||||
}
|
||||
|
||||
// MSG: One
|
||||
@ -303,19 +303,19 @@ public class Mixin
|
||||
}
|
||||
|
||||
// MESSAGE: Predicate
|
||||
public static boolean messagePredictate(Predictate<CommandSender> predictate, Object message)
|
||||
public static boolean messagePredicate(Predicate<CommandSender> predicate, Object message)
|
||||
{
|
||||
return getMessageMixin().messagePredictate(predictate, message);
|
||||
return getMessageMixin().messagePredicate(predicate, message);
|
||||
}
|
||||
|
||||
public static boolean messagePredictate(Predictate<CommandSender> predictate, Object... messages)
|
||||
public static boolean messagePredicate(Predicate<CommandSender> predicate, Object... messages)
|
||||
{
|
||||
return getMessageMixin().messagePredictate(predictate, messages);
|
||||
return getMessageMixin().messagePredicate(predicate, messages);
|
||||
}
|
||||
|
||||
public static boolean messagePredictate(Predictate<CommandSender> predictate, Collection<?> messages)
|
||||
public static boolean messagePredicate(Predicate<CommandSender> predicate, Collection<?> messages)
|
||||
{
|
||||
return getMessageMixin().messagePredictate(predictate, messages);
|
||||
return getMessageMixin().messagePredicate(predicate, messages);
|
||||
}
|
||||
|
||||
// MESSAGE: One
|
||||
|
@ -15,7 +15,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.massivecraft.massivecore.Predictate;
|
||||
import com.massivecraft.massivecore.Predicate;
|
||||
import com.massivecraft.massivecore.adapter.LowercaseEnumAdapter;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
@ -903,10 +903,10 @@ public class Mson implements Serializable
|
||||
return Mixin.messageAll(this);
|
||||
}
|
||||
|
||||
// Predictate
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate)
|
||||
// Predicate
|
||||
public boolean messagePredicate(Predicate<CommandSender> predicate)
|
||||
{
|
||||
return Mixin.messagePredictate(predictate, this);
|
||||
return Mixin.messagePredicate(predicate, this);
|
||||
}
|
||||
|
||||
// One
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user