MassiveCore - Heavy Refactoring and Command improvements

This commit is contained in:
Olof Larsson 2015-10-21 19:36:10 +02:00
parent 5c5bb87aee
commit 9667e27fcb
105 changed files with 1269 additions and 1196 deletions

View File

@ -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_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_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_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_FEW_ARGUMENTS = "<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_ARGUMENTS = "<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_MANY_ARGUMENTS2 = "<i>You should use the command like this:";
public static final Mson COMMAND_REPLACEMENT = mson("REPLACEMENT"); 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_CHILD_AMBIGUOUS = mson("The sub command ", COMMAND_REPLACEMENT, " is ambiguous.").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_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."; public static final String COMMAND_TOO_MANY_TAB_SUGGESTIONS = "<h>%d <b>tab completions available. Be more specific and try again.";
} }

View File

@ -11,9 +11,9 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import com.massivecraft.massivecore.cmd.arg.ARPS; import com.massivecraft.massivecore.cmd.type.TypePS;
import com.massivecraft.massivecore.cmd.arg.ARSenderId; import com.massivecraft.massivecore.cmd.type.TypeSenderId;
import com.massivecraft.massivecore.cmd.arg.ARWorldId; import com.massivecraft.massivecore.cmd.type.TypeWorldId;
import com.massivecraft.massivecore.collections.MassiveSet; import com.massivecraft.massivecore.collections.MassiveSet;
import com.massivecraft.massivecore.event.EventMassiveCoreDestination; import com.massivecraft.massivecore.event.EventMassiveCoreDestination;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
@ -56,7 +56,7 @@ public class MassiveCoreEngineDestination extends EngineAbstract
{ {
try try
{ {
PS ps = ARPS.get().read(event.getArg(), event.getSender()); PS ps = TypePS.get().read(event.getArg(), event.getSender());
Destination destination = new DestinationSimple(ps); Destination destination = new DestinationSimple(ps);
event.setDestination(destination); event.setDestination(destination);
} }
@ -144,7 +144,7 @@ public class MassiveCoreEngineDestination extends EngineAbstract
String worldId; String worldId;
if (rest != null) if (rest != null)
{ {
worldId = ARWorldId.get().read(rest, sender); worldId = TypeWorldId.get().read(rest, sender);
} }
else else
{ {
@ -158,7 +158,7 @@ public class MassiveCoreEngineDestination extends EngineAbstract
// World Implicit // World Implicit
try try
{ {
String worldId = ARWorldId.get().read(arg, sender); String worldId = TypeWorldId.get().read(arg, sender);
return new DestinationWorld(worldId); return new DestinationWorld(worldId);
} }
catch (Exception e) catch (Exception e)
@ -172,7 +172,7 @@ public class MassiveCoreEngineDestination extends EngineAbstract
String playerId; String playerId;
if (rest != null) if (rest != null)
{ {
playerId = ARSenderId.get().read(rest, sender); playerId = TypeSenderId.get().read(rest, sender);
} }
else else
{ {
@ -185,7 +185,7 @@ public class MassiveCoreEngineDestination extends EngineAbstract
// Player Implicit // Player Implicit
try try
{ {
String playerId = ARSenderId.get().read(arg, sender); String playerId = TypeSenderId.get().read(arg, sender);
return new DestinationPlayer(playerId); return new DestinationPlayer(playerId);
} }
catch (Exception e) catch (Exception e)

View File

@ -143,7 +143,7 @@ public class MassiveCoreEngineMain extends EngineAbstract
if (MUtil.isntPlayer(watcher)) return; if (MUtil.isntPlayer(watcher)) return;
// Get the lowercased token predicate // 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 // Create a case insensitive set to check for already added stuff
Set<String> current = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); 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? // TODO: Should this only be players? Would a player actually want to tab-complete @console?
for (String senderName : IdUtil.getNames(SenderPresence.ONLINE, SenderType.ANY)) 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 (current.contains(senderName)) continue;
if (!Mixin.canSee(watcher, senderName)) continue; if (!Mixin.canSee(watcher, senderName)) continue;

View File

@ -8,7 +8,7 @@ import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; 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.store.Entity;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
@ -170,9 +170,9 @@ public class Multiverse extends Entity<Multiverse>
// ARG READERS // ARG READERS
// -------------------------------------------- // // -------------------------------------------- //
public ARUniverse argReaderUniverse() public TypeUniverse typeUniverse()
{ {
return new ARUniverse(this); return new TypeUniverse(this);
} }
} }

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore; package com.massivecraft.massivecore;
public interface Predictate<T> public interface Predicate<T>
{ {
public boolean apply(T type); public boolean apply(T type);
} }

View 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;
}
}

View File

@ -1,13 +1,13 @@
package com.massivecraft.massivecore; package com.massivecraft.massivecore;
public class PredictateIsRegistered implements Predictate<Registerable> public class PredicateIsRegistered implements Predicate<Registerable>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static PredictateIsRegistered i = new PredictateIsRegistered(); private static PredicateIsRegistered i = new PredicateIsRegistered();
public static PredictateIsRegistered get() { return i; } public static PredicateIsRegistered get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -2,14 +2,14 @@ package com.massivecraft.massivecore;
import com.massivecraft.massivecore.store.Entity; import com.massivecraft.massivecore.store.Entity;
public class PredictateIsntDefaultEntity implements Predictate<Entity<?>> public class PredicateIsntDefaultEntity implements Predicate<Entity<?>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static PredictateIsntDefaultEntity i = new PredictateIsntDefaultEntity(); private static PredicateIsntDefaultEntity i = new PredicateIsntDefaultEntity();
public static PredictateIsntDefaultEntity get() { return i; } public static PredicateIsntDefaultEntity get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore; package com.massivecraft.massivecore;
// Inspired by: String#regionMatches(ignoreCase, toffset, other, ooffset, len) // Inspired by: String#regionMatches(ignoreCase, toffset, other, ooffset, len)
public class PredictateStartsWithIgnoreCase implements Predictate<String> public class PredicateStartsWithIgnoreCase implements Predicate<String>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
@ -14,8 +14,8 @@ public class PredictateStartsWithIgnoreCase implements Predictate<String>
// CONSTRUCT // CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public static PredictateStartsWithIgnoreCase get(String prefix) { return new PredictateStartsWithIgnoreCase(prefix); } public static PredicateStartsWithIgnoreCase get(String prefix) { return new PredicateStartsWithIgnoreCase(prefix); }
public PredictateStartsWithIgnoreCase(String prefix) public PredicateStartsWithIgnoreCase(String prefix)
{ {
if (prefix == null) throw new NullPointerException("prefix"); if (prefix == null) throw new NullPointerException("prefix");
this.prefixLower = prefix.toLowerCase(); this.prefixLower = prefix.toLowerCase();

View File

@ -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;
}
}

View File

@ -7,8 +7,8 @@ import org.bukkit.Location;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.massivecraft.massivecore.cmd.arg.ARFloat; import com.massivecraft.massivecore.cmd.type.TypeFloat;
import com.massivecraft.massivecore.cmd.arg.ARSound; import com.massivecraft.massivecore.cmd.type.TypeSound;
public final class SoundEffect implements Cloneable, Serializable public final class SoundEffect implements Cloneable, Serializable
{ {
@ -67,18 +67,18 @@ public final class SoundEffect implements Cloneable, Serializable
soundString = soundString.trim(); soundString = soundString.trim();
String[] parts = soundString.split("[^a-zA-Z0-9_.]+"); 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; float volume = 1.0f;
if (parts.length >= 2) if (parts.length >= 2)
{ {
volume = ARFloat.get().read(parts[1]); volume = TypeFloat.get().read(parts[1]);
} }
float pitch = 1.0f; float pitch = 1.0f;
if (parts.length >= 3) if (parts.length >= 3)
{ {
pitch = ARFloat.get().read(parts[2]); pitch = TypeFloat.get().read(parts[2]);
} }
return SoundEffect.valueOf(sound, volume, pitch); return SoundEffect.valueOf(sound, volume, pitch);

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.cmd; package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.cmd.MassiveCommand; import com.massivecraft.massivecore.cmd.MassiveCommand;
import com.massivecraft.massivecore.cmd.VisibilityMode; import com.massivecraft.massivecore.cmd.Visibility;
public class DeprecatedCommand extends MassiveCommand public class DeprecatedCommand extends MassiveCommand
@ -24,11 +24,11 @@ public class DeprecatedCommand extends MassiveCommand
// Aliases // Aliases
this.setAliases(aliases); this.setAliases(aliases);
// Args // Parameters
this.setGivingErrorOnTooManyArgs(false); this.setOverflowSensitive(false);
// Visibility // Visibility
this.setVisibilityMode(VisibilityMode.INVISIBLE); this.setVisibility(Visibility.INVISIBLE);
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -39,7 +39,7 @@ public class DeprecatedCommand extends MassiveCommand
public void perform() public void perform()
{ {
msg("<i>Use this new command instead:"); msg("<i>Use this new command instead:");
message(target.getUseageTemplate(true)); message(target.getTemplate(true));
} }
} }

View File

@ -23,8 +23,8 @@ public class HelpCommand extends MassiveCommand
// Aliases // Aliases
this.addAliases("?", "h", "help"); this.addAliases("?", "h", "help");
// Args // Parameters
this.addArg(ArgSetting.getPage()); this.addParameter(Parameter.getPage());
// Other // Other
this.setDesc(""); this.setDesc("");
@ -41,34 +41,34 @@ public class HelpCommand extends MassiveCommand
int page = this.readArg(); int page = this.readArg();
// Get parent command // Get parent command
if ( ! this.hasParentCommand()) return; if ( ! this.hasParent()) return;
MassiveCommand parentCommand = this.getParentCommand(); MassiveCommand parent = this.getParent();
// Create Lines // Create Lines
List<Mson> lines = new ArrayList<Mson>(); List<Mson> lines = new ArrayList<Mson>();
for (String helpline : parentCommand.getHelp()) for (String helpline : parent.getHelp())
{ {
lines.add(Mson.parse("<a>#<i> " + helpline)); lines.add(Mson.parse("<a>#<i> " + helpline));
} }
for (MassiveCommand subCommand : parentCommand.getSubCommands()) for (MassiveCommand child : parent.getChildren())
{ {
if ( ! subCommand.isVisibleTo(sender)) continue; if ( ! child.isVisibleTo(sender)) continue;
lines.add(subCommand.getUseageTemplate(this.getCommandChain(), true, true, sender)); lines.add(child.getTemplate(this.getChain(), true, true, sender));
} }
// Send Lines // 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 @Override
public boolean isVisibleTo(CommandSender sender) public boolean isVisibleTo(CommandSender sender)
{ {
boolean visible = super.isVisibleTo(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 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) if (size <= pageHeight)
{ {

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ public class MassiveCoreBukkitCommand extends Command implements PluginIdentifia
super( super(
name, name,
massiveCommand.getDesc(), massiveCommand.getDesc(),
massiveCommand.getUseageTemplate().toPlain(true), massiveCommand.getTemplate().toPlain(true),
Collections.<String>emptyList() // We don't use aliases Collections.<String>emptyList() // We don't use aliases
); );
this.massiveCommand = massiveCommand; this.massiveCommand = massiveCommand;
@ -65,7 +65,7 @@ public class MassiveCoreBukkitCommand extends Command implements PluginIdentifia
public List<String> createArgList(String[] args) public List<String> createArgList(String[] args)
{ {
List<String> ret; List<String> ret;
if (this.getMassiveCommand().isUsingTokenizer()) if (this.getMassiveCommand().isTokenizing())
{ {
ret = Txt.tokenizeArguments(Txt.implode(args, " ")); ret = Txt.tokenizeArguments(Txt.implode(args, " "));
} }
@ -74,7 +74,7 @@ public class MassiveCoreBukkitCommand extends Command implements PluginIdentifia
ret = MUtil.list(args); ret = MUtil.list(args);
} }
if (this.getMassiveCommand().isUsingSmartQuotesRemoval()) if (this.getMassiveCommand().isUnsmart())
{ {
List<String> oldArgList = ret; List<String> oldArgList = ret;
ret = new ArrayList<String>(oldArgList.size()); ret = new ArrayList<String>(oldArgList.size());

View File

@ -5,11 +5,11 @@ import static com.massivecraft.massivecore.mson.Mson.mson;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.massivecraft.massivecore.cmd.arg.AR; import com.massivecraft.massivecore.cmd.type.TypeInteger;
import com.massivecraft.massivecore.cmd.arg.ARInteger; import com.massivecraft.massivecore.cmd.type.Type;
import com.massivecraft.massivecore.mson.Mson; import com.massivecraft.massivecore.mson.Mson;
public class ArgSetting<T> public class Parameter<T>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// CONSTANTS // CONSTANTS
@ -24,16 +24,16 @@ public class ArgSetting<T>
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
protected AR<T> reader; protected Type<T> type;
public AR<T> getReader() { return reader; } public Type<T> getType() { return type; }
public ArgSetting<T> setReader(AR<T> reader) { this.reader = reader; return this; } public Parameter<T> setType(Type<T> type) { this.type = type; return this; }
protected String name; protected String name;
public String getName() { return 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; 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() public String getDefaultDesc()
{ {
if (this.defaultDesc != null) return defaultDesc; if (this.defaultDesc != null) return defaultDesc;
@ -43,7 +43,7 @@ public class ArgSetting<T>
protected T defaultValue = null; protected T defaultValue = null;
public T getDefaultValue() { return defaultValue; } public T getDefaultValue() { return defaultValue; }
public ArgSetting<T> setDefaultValue(T defaultValue) public Parameter<T> setDefaultValue(T defaultValue)
{ {
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
this.defaultValueSet = true; 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. // That might the case if the arg is a player. and default is oneself.
protected boolean requiredFromConsole = false; protected boolean requiredFromConsole = false;
public boolean isRequiredFromConsole() { return requiredFromConsole; } 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. // An optional description of this argument.
// Examples: // Examples:
@ -74,7 +74,7 @@ public class ArgSetting<T>
// 3. "the amount of money to pay" // 3. "the amount of money to pay"
protected String desc = null; protected String desc = null;
public String getDesc() { return desc; } 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; } public boolean hasDesc() { return this.getDesc() != null; }
@ -86,13 +86,13 @@ public class ArgSetting<T>
// description must not be set in the constructor. // description must not be set in the constructor.
// All // 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 // 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"); if (name == null) throw new IllegalArgumentException("name mustn't be null");
this.setReader(reader); this.setType(type);
this.setRequiredFromConsole(requiredFromConsole); this.setRequiredFromConsole(requiredFromConsole);
this.setName(name); this.setName(name);
this.setDefaultDesc(defaultDesc); this.setDefaultDesc(defaultDesc);
@ -101,64 +101,48 @@ public class ArgSetting<T>
// Without defaultValue // Without defaultValue
@SuppressWarnings("unchecked") @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. // In fact the default value is not set.
this.defaultValueSet = false; this.defaultValueSet = false;
} }
// Without reqFromConsole. // 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. // 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. // 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. // 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. // 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. // 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); this(type, 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);
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -179,7 +163,7 @@ public class ArgSetting<T>
return ! this.isRequiredFor(sender); return ! this.isRequiredFor(sender);
} }
public Mson getUseageTemplateDisplayFor(CommandSender sender) public Mson getTemplate(CommandSender sender)
{ {
Mson ret; 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 // We can't use a singletone, because people might
// want to set a description. // want to set a description.
return new ArgSetting<Integer>(1, ARInteger.get(), "page", "1"); return new Parameter<Integer>(1, TypeInteger.get(), "page", "1");
} }
} }

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore.cmd; 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. 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. SECRET, // Secret commands are visible only to those who can use the command. These commands are usually some kind of admin commands.

View File

@ -27,15 +27,15 @@ public class CmdMassiveCore extends MassiveCommand
public CmdMassiveCore() public CmdMassiveCore()
{ {
// SubCommands // Children
this.addSubCommand(this.cmdMassiveCoreUsys); this.addChild(this.cmdMassiveCoreUsys);
this.addSubCommand(this.cmdMassiveCoreMStore); this.addChild(this.cmdMassiveCoreMStore);
this.addSubCommand(this.cmdMassiveCoreId); this.addChild(this.cmdMassiveCoreId);
this.addSubCommand(this.cmdMassiveCoreTest); this.addChild(this.cmdMassiveCoreTest);
this.addSubCommand(this.cmdMassiveCoreHearsound); this.addChild(this.cmdMassiveCoreHearsound);
this.addSubCommand(this.cmdMassiveCoreBuffer); this.addChild(this.cmdMassiveCoreBuffer);
this.addSubCommand(this.cmdMassiveCoreCmdurl); this.addChild(this.cmdMassiveCoreCmdurl);
this.addSubCommand(this.cmdMassiveCoreVersion); this.addChild(this.cmdMassiveCoreVersion);
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.BASECOMMAND.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.BASECOMMAND.node));

View File

@ -22,12 +22,12 @@ public class CmdMassiveCoreBuffer extends MassiveCommand
public CmdMassiveCoreBuffer() public CmdMassiveCoreBuffer()
{ {
// SubCommands // Children
this.addSubCommand(this.cmdMassiveCoreBufferPrint); this.addChild(this.cmdMassiveCoreBufferPrint);
this.addSubCommand(this.cmdMassiveCoreBufferClear); this.addChild(this.cmdMassiveCoreBufferClear);
this.addSubCommand(this.cmdMassiveCoreBufferSet); this.addChild(this.cmdMassiveCoreBufferSet);
this.addSubCommand(this.cmdMassiveCoreBufferAdd); this.addChild(this.cmdMassiveCoreBufferAdd);
this.addSubCommand(this.cmdMassiveCoreBufferWhitespace); this.addChild(this.cmdMassiveCoreBufferWhitespace);
// Aliases // Aliases
this.addAliases("buffer"); this.addAliases("buffer");

View File

@ -4,8 +4,8 @@ import com.massivecraft.massivecore.MassiveCoreEngineVariable;
import com.massivecraft.massivecore.MassiveCorePerm; import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.ReqHasPerm;
import com.massivecraft.massivecore.cmd.type.TypeString;
public class CmdMassiveCoreBufferAdd extends MassiveCommand public class CmdMassiveCoreBufferAdd extends MassiveCommand
{ {
@ -18,8 +18,8 @@ public class CmdMassiveCoreBufferAdd extends MassiveCommand
// Aliases // Aliases
this.addAliases("a", "add"); this.addAliases("a", "add");
// Args // Parameters
this.addArg(ARString.get(), "text", true).setDesc("the text to add to your buffer"); this.addParameter(TypeString.get(), "text", true).setDesc("the text to add to your buffer");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.BUFFER_ADD.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.BUFFER_ADD.node));

View File

@ -4,8 +4,8 @@ import com.massivecraft.massivecore.MassiveCoreEngineVariable;
import com.massivecraft.massivecore.MassiveCorePerm; import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.ReqHasPerm;
import com.massivecraft.massivecore.cmd.type.TypeString;
public class CmdMassiveCoreBufferSet extends MassiveCommand public class CmdMassiveCoreBufferSet extends MassiveCommand
{ {
@ -18,8 +18,8 @@ public class CmdMassiveCoreBufferSet extends MassiveCommand
// Aliases // Aliases
this.addAliases("s", "set"); this.addAliases("s", "set");
// Args // Parameters
this.addArg(ARString.get(), "text", true).setDesc("the text to set your buffer to"); this.addParameter(TypeString.get(), "text", true).setDesc("the text to set your buffer to");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.BUFFER_SET.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.BUFFER_SET.node));

View File

@ -4,8 +4,8 @@ import com.massivecraft.massivecore.MassiveCoreEngineVariable;
import com.massivecraft.massivecore.MassiveCorePerm; import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.type.TypeInteger;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class CmdMassiveCoreBufferWhitespace extends MassiveCommand public class CmdMassiveCoreBufferWhitespace extends MassiveCommand
@ -19,8 +19,8 @@ public class CmdMassiveCoreBufferWhitespace extends MassiveCommand
// Aliases // Aliases
this.addAliases("w", "whitespace"); this.addAliases("w", "whitespace");
// Args // Parameters
this.addArg(1, ARInteger.get(), "times").setDesc("the amount of whitespace to add to your buffer"); this.addParameter(1, TypeInteger.get(), "times").setDesc("the amount of whitespace to add to your buffer");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.BUFFER_WHITESPACE.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.BUFFER_WHITESPACE.node));

View File

@ -11,9 +11,9 @@ import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveCorePerm; import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.cmd.type.TypeString;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.util.WebUtil; import com.massivecraft.massivecore.util.WebUtil;
@ -28,8 +28,8 @@ public class CmdMassiveCoreCmdurl extends MassiveCommand
// Aliases // Aliases
this.addAliases("cmdurl"); this.addAliases("cmdurl");
// Args // Parameters
this.addArg(ARString.get(), "url").setDesc("the url to load"); this.addParameter(TypeString.get(), "url").setDesc("the url to load");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.CMDURL.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.CMDURL.node));

View File

@ -6,10 +6,10 @@ import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.SoundEffect; import com.massivecraft.massivecore.SoundEffect;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer; 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 public class CmdMassiveCoreHearsound extends MassiveCommand
{ {
@ -22,8 +22,8 @@ public class CmdMassiveCoreHearsound extends MassiveCommand
// Aliases // Aliases
this.addAliases("hearsound", "hearsounds"); this.addAliases("hearsound", "hearsounds");
// Args // Parameters
this.addArg(ARList.get(ARSoundEffect.get()), "sound(s)", true).setDesc("the sounds to hear"); this.addParameter(TypeList.get(TypeSoundEffect.get()), "sound(s)", true).setDesc("the sounds to hear");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.HEARSOUND.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.HEARSOUND.node));

View File

@ -20,12 +20,12 @@ public class CmdMassiveCoreStore extends MassiveCommand
public CmdMassiveCoreStore() public CmdMassiveCoreStore()
{ {
// SubCommands // Children
this.addSubCommand(this.cmdMassiveCoreStoreStats); this.addChild(this.cmdMassiveCoreStoreStats);
this.addSubCommand(this.cmdMassiveCoreStoreListcolls); this.addChild(this.cmdMassiveCoreStoreListcolls);
this.addSubCommand(this.cmdMassiveCoreStoreCopydb); this.addChild(this.cmdMassiveCoreStoreCopydb);
// Args // Parameters
this.addAliases("store"); this.addAliases("store");
// Requirements // Requirements

View File

@ -8,8 +8,8 @@ import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveCorePerm; import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.ReqHasPerm;
import com.massivecraft.massivecore.cmd.type.TypeString;
import com.massivecraft.massivecore.store.Coll; import com.massivecraft.massivecore.store.Coll;
import com.massivecraft.massivecore.store.Db; import com.massivecraft.massivecore.store.Db;
import com.massivecraft.massivecore.store.MStore; import com.massivecraft.massivecore.store.MStore;
@ -26,9 +26,9 @@ public class CmdMassiveCoreStoreCopydb extends MassiveCommand
// Aliases // Aliases
this.addAliases("copydb"); this.addAliases("copydb");
// Args // Parameters
this.addArg(ARString.get(), "from").setDesc("the database to copy from"); this.addParameter(TypeString.get(), "from").setDesc("the database to copy from");
this.addArg(ARString.get(), "to").setDesc("the database to copy to"); this.addParameter(TypeString.get(), "to").setDesc("the database to copy to");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.STORE_COPYDB.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.STORE_COPYDB.node));

View File

@ -8,8 +8,8 @@ import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.NaturalOrderComparator; import com.massivecraft.massivecore.NaturalOrderComparator;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.ReqHasPerm;
import com.massivecraft.massivecore.cmd.type.TypeString;
import com.massivecraft.massivecore.store.Coll; import com.massivecraft.massivecore.store.Coll;
import com.massivecraft.massivecore.store.Db; import com.massivecraft.massivecore.store.Db;
import com.massivecraft.massivecore.store.MStore; import com.massivecraft.massivecore.store.MStore;
@ -26,8 +26,8 @@ public class CmdMassiveCoreStoreListcolls extends MassiveCommand
// Aliases // Aliases
this.addAliases("listcolls"); this.addAliases("listcolls");
// Args // Parameters
this.addArg(ARString.get(), "db", ConfServer.dburi).setDesc("the database to list colls from"); this.addParameter(TypeString.get(), "db", ConfServer.dburi).setDesc("the database to list colls from");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.STORE_LISTCOLLS.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.STORE_LISTCOLLS.node));

View File

@ -5,8 +5,8 @@ import java.util.Map.Entry;
import com.massivecraft.massivecore.MassiveCorePerm; import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.type.TypeColl;
import com.massivecraft.massivecore.store.Coll; import com.massivecraft.massivecore.store.Coll;
import com.massivecraft.massivecore.store.ExamineThread; import com.massivecraft.massivecore.store.ExamineThread;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
@ -23,8 +23,8 @@ public class CmdMassiveCoreStoreStats extends MassiveCommand
// Aliases // Aliases
this.addAliases("stats"); this.addAliases("stats");
// Args // Parameters
this.addArg(ARColl.get(), "coll", Coll.TOTAL).setDesc("the coll to show info about"); this.addParameter(TypeColl.get(), "coll", Coll.TOTAL).setDesc("the coll to show info about");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.STORE_STATS.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.STORE_STATS.node));

View File

@ -21,11 +21,11 @@ public class CmdMassiveCoreUsys extends MassiveCommand
public CmdMassiveCoreUsys() public CmdMassiveCoreUsys()
{ {
// SubCommands // Children
this.addSubCommand(this.cmdMassiveCoreUsysMultiverse); this.addChild(this.cmdMassiveCoreUsysMultiverse);
this.addSubCommand(this.cmdMassiveCoreUsysUniverse); this.addChild(this.cmdMassiveCoreUsysUniverse);
this.addSubCommand(this.cmdMassiveCoreUsysWorld); this.addChild(this.cmdMassiveCoreUsysWorld);
this.addSubCommand(this.cmdMassiveCoreUsysAspect); this.addChild(this.cmdMassiveCoreUsysAspect);
// Aliases // Aliases
this.addAliases("usys"); this.addAliases("usys");

View File

@ -20,10 +20,10 @@ public class CmdMassiveCoreUsysAspect extends MassiveCommand
public CmdMassiveCoreUsysAspect() public CmdMassiveCoreUsysAspect()
{ {
// SubCommands // Children
this.addSubCommand(this.cmdMassiveCoreUsysAspectList); this.addChild(this.cmdMassiveCoreUsysAspectList);
this.addSubCommand(this.cmdMassiveCoreUsysAspectShow); this.addChild(this.cmdMassiveCoreUsysAspectShow);
this.addSubCommand(this.cmdMassiveCoreUsysAspectUse); this.addChild(this.cmdMassiveCoreUsysAspectUse);
// Aliases // Aliases
this.addAliases("a", "aspect"); this.addAliases("a", "aspect");

View File

@ -4,7 +4,7 @@ import com.massivecraft.massivecore.Aspect;
import com.massivecraft.massivecore.AspectColl; import com.massivecraft.massivecore.AspectColl;
import com.massivecraft.massivecore.MassiveCorePerm; import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; 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.MassiveCommand;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.pager.Pager; import com.massivecraft.massivecore.pager.Pager;
@ -22,8 +22,8 @@ public class CmdMassiveCoreUsysAspectList extends MassiveCommand
// Aliases // Aliases
this.addAliases("l", "list"); this.addAliases("l", "list");
// Args // Parameters
this.addArg(ArgSetting.getPage()).setDesc("the page in the aspect list"); this.addParameter(Parameter.getPage()).setDesc("the page in the aspect list");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_ASPECT_LIST.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_ASPECT_LIST.node));

View File

@ -4,8 +4,8 @@ import com.massivecraft.massivecore.Aspect;
import com.massivecraft.massivecore.MassiveCorePerm; import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.type.TypeAspect;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class CmdMassiveCoreUsysAspectShow extends MassiveCommand public class CmdMassiveCoreUsysAspectShow extends MassiveCommand
@ -19,8 +19,8 @@ public class CmdMassiveCoreUsysAspectShow extends MassiveCommand
// Aliases // Aliases
this.addAliases("s", "show"); this.addAliases("s", "show");
// Args // Parameters
this.addArg(ARAspect.get(), "aspect").setDesc("the aspect to show info about"); this.addParameter(TypeAspect.get(), "aspect").setDesc("the aspect to show info about");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_ASPECT_SHOW.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_ASPECT_SHOW.node));

View File

@ -5,9 +5,9 @@ import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse; import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.type.TypeAspect;
import com.massivecraft.massivecore.cmd.type.TypeMultiverse;
public class CmdMassiveCoreUsysAspectUse extends MassiveCommand public class CmdMassiveCoreUsysAspectUse extends MassiveCommand
{ {
@ -20,9 +20,9 @@ public class CmdMassiveCoreUsysAspectUse extends MassiveCommand
// Aliases // Aliases
this.addAliases("u", "use"); this.addAliases("u", "use");
// Args // Parameters
this.addArg(ARAspect.get(), "aspect").setDesc("the aspect to modify"); this.addParameter(TypeAspect.get(), "aspect").setDesc("the aspect to modify");
this.addArg(ARMultiverse.get(), "multiverse").setDesc("the multiverse which the aspect should use"); this.addParameter(TypeMultiverse.get(), "multiverse").setDesc("the multiverse which the aspect should use");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_ASPECT_USE.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_ASPECT_USE.node));

View File

@ -21,11 +21,11 @@ public class CmdMassiveCoreUsysMultiverse extends MassiveCommand
public CmdMassiveCoreUsysMultiverse() public CmdMassiveCoreUsysMultiverse()
{ {
// SubCommands // Children
this.addSubCommand(this.cmdMassiveCoreUsysMultiverseList); this.addChild(this.cmdMassiveCoreUsysMultiverseList);
this.addSubCommand(this.cmdMassiveCoreUsysMultiverseShow); this.addChild(this.cmdMassiveCoreUsysMultiverseShow);
this.addSubCommand(this.cmdMassiveCoreUsysMultiverseNew); this.addChild(this.cmdMassiveCoreUsysMultiverseNew);
this.addSubCommand(this.cmdMassiveCoreUsysMultiverseDel); this.addChild(this.cmdMassiveCoreUsysMultiverseDel);
// Aliases // Aliases
this.addAliases("m", "multiverse"); this.addAliases("m", "multiverse");

View File

@ -5,8 +5,8 @@ import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse; import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.type.TypeMultiverse;
public class CmdMassiveCoreUsysMultiverseDel extends MassiveCommand public class CmdMassiveCoreUsysMultiverseDel extends MassiveCommand
{ {
@ -19,8 +19,8 @@ public class CmdMassiveCoreUsysMultiverseDel extends MassiveCommand
// Aliases // Aliases
this.addAliases("d", "del"); this.addAliases("d", "del");
// Args // Parameters
this.addArg(ARMultiverse.get(), "multiverse").setDesc("the multiverse to delete"); this.addParameter(TypeMultiverse.get(), "multiverse").setDesc("the multiverse to delete");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_DEL.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_DEL.node));

View File

@ -4,7 +4,7 @@ import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse; import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.MultiverseColl; 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.MassiveCommand;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.pager.Pager; import com.massivecraft.massivecore.pager.Pager;
@ -22,8 +22,8 @@ public class CmdMassiveCoreUsysMultiverseList extends MassiveCommand
// Aliases // Aliases
this.addAliases("l", "list"); this.addAliases("l", "list");
// Args // Parameters
this.addArg(ArgSetting.getPage()); this.addParameter(Parameter.getPage());
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_LIST.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_LIST.node));

View File

@ -4,8 +4,8 @@ import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.MultiverseColl; import com.massivecraft.massivecore.MultiverseColl;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.ReqHasPerm;
import com.massivecraft.massivecore.cmd.type.TypeString;
public class CmdMassiveCoreUsysMultiverseNew extends MassiveCommand public class CmdMassiveCoreUsysMultiverseNew extends MassiveCommand
{ {
@ -18,8 +18,8 @@ public class CmdMassiveCoreUsysMultiverseNew extends MassiveCommand
// Aliases // Aliases
this.addAliases("n", "new"); this.addAliases("n", "new");
// Args // Parameters
this.addArg(ARString.get(), "multiverse").setDesc("name of multiverse to create"); this.addParameter(TypeString.get(), "multiverse").setDesc("name of multiverse to create");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_NEW.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_NEW.node));

View File

@ -9,8 +9,8 @@ import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse; import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.type.TypeMultiverse;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class CmdMassiveCoreUsysMultiverseShow extends MassiveCommand public class CmdMassiveCoreUsysMultiverseShow extends MassiveCommand
@ -24,8 +24,8 @@ public class CmdMassiveCoreUsysMultiverseShow extends MassiveCommand
// Aliases // Aliases
this.addAliases("s", "show"); this.addAliases("s", "show");
// Args // Parameters
this.addArg(ARMultiverse.get(), "multiverse").setDesc("the multiverse to show info about"); this.addParameter(TypeMultiverse.get(), "multiverse").setDesc("the multiverse to show info about");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_SHOW.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_SHOW.node));

View File

@ -20,10 +20,10 @@ public class CmdMassiveCoreUsysUniverse extends MassiveCommand
public CmdMassiveCoreUsysUniverse() public CmdMassiveCoreUsysUniverse()
{ {
// SubCommands // Children
this.addSubCommand(this.cmdMassiveCoreUsysUniverseNew); this.addChild(this.cmdMassiveCoreUsysUniverseNew);
this.addSubCommand(this.cmdMassiveCoreUsysUniverseDel); this.addChild(this.cmdMassiveCoreUsysUniverseDel);
this.addSubCommand(this.cmdMassiveCoreUsysUniverseClear); this.addChild(this.cmdMassiveCoreUsysUniverseClear);
// Aliases // Aliases
this.addAliases("u", "universe"); this.addAliases("u", "universe");

View File

@ -5,9 +5,9 @@ import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse; import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.type.TypeMultiverse;
import com.massivecraft.massivecore.cmd.type.TypeString;
public class CmdMassiveCoreUsysUniverseClear extends MassiveCommand public class CmdMassiveCoreUsysUniverseClear extends MassiveCommand
{ {
@ -20,9 +20,9 @@ public class CmdMassiveCoreUsysUniverseClear extends MassiveCommand
// Aliases // Aliases
this.addAliases("c", "clear"); this.addAliases("c", "clear");
// Args // Parameters
this.addArg(ARString.get(), "universe").setDesc("the universe to clear"); this.addParameter(TypeString.get(), "universe").setDesc("the universe to clear");
this.addArg(ARMultiverse.get(), "multiverse").setDesc("the multiverse of the universe to clear"); this.addParameter(TypeMultiverse.get(), "multiverse").setDesc("the multiverse of the universe to clear");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_UNIVERSE_CLEAR.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_UNIVERSE_CLEAR.node));

View File

@ -5,9 +5,9 @@ import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse; import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.type.TypeMultiverse;
import com.massivecraft.massivecore.cmd.type.TypeString;
public class CmdMassiveCoreUsysUniverseDel extends MassiveCommand public class CmdMassiveCoreUsysUniverseDel extends MassiveCommand
{ {
@ -20,9 +20,9 @@ public class CmdMassiveCoreUsysUniverseDel extends MassiveCommand
// Aliases // Aliases
this.addAliases("d", "del"); this.addAliases("d", "del");
// Args // Parameters
this.addArg(ARString.get(), "universe").setDesc("the universe to delete"); this.addParameter(TypeString.get(), "universe").setDesc("the universe to delete");
this.addArg(ARMultiverse.get(), "multiverse").setDesc("the multiverse of the universe to delete"); this.addParameter(TypeMultiverse.get(), "multiverse").setDesc("the multiverse of the universe to delete");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_DEL.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_DEL.node));

View File

@ -4,9 +4,9 @@ import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse; import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.type.TypeMultiverse;
import com.massivecraft.massivecore.cmd.type.TypeString;
public class CmdMassiveCoreUsysUniverseNew extends MassiveCommand public class CmdMassiveCoreUsysUniverseNew extends MassiveCommand
{ {
@ -19,9 +19,9 @@ public class CmdMassiveCoreUsysUniverseNew extends MassiveCommand
// Aliases // Aliases
this.addAliases("n", "new"); this.addAliases("n", "new");
// Args // Parameters
this.addArg(ARString.get(), "universe").setDesc("name of universe to create"); this.addParameter(TypeString.get(), "universe").setDesc("name of universe to create");
this.addArg(ARMultiverse.get(), "multiverse").setDesc("the multiverse of the universe to create"); this.addParameter(TypeMultiverse.get(), "multiverse").setDesc("the multiverse of the universe to create");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_UNIVERSE_NEW.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_UNIVERSE_NEW.node));

View File

@ -4,9 +4,9 @@ import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse; import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.type.TypeMultiverse;
import com.massivecraft.massivecore.cmd.type.TypeString;
public class CmdMassiveCoreUsysWorld extends MassiveCommand public class CmdMassiveCoreUsysWorld extends MassiveCommand
{ {
@ -19,10 +19,10 @@ public class CmdMassiveCoreUsysWorld extends MassiveCommand
// Aliases // Aliases
this.addAliases("w", "world"); this.addAliases("w", "world");
// Args // Parameters
this.addArg(ARString.get(), "world").setDesc("the world to move"); this.addParameter(TypeString.get(), "world").setDesc("the world to move");
this.addArg(ARString.get(), "universe").setDesc("the universe to move the world ro"); this.addParameter(TypeString.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"); this.addParameter(TypeMultiverse.get(), "multiverse").setDesc("the multiverse of the universe to move the world to");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_WORLD.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_WORLD.node));

View File

@ -2,10 +2,10 @@ package com.massivecraft.massivecore.cmd.req;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.Predictate; import com.massivecraft.massivecore.Predicate;
import com.massivecraft.massivecore.cmd.MassiveCommand; 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); public boolean apply(CommandSender sender, MassiveCommand command);

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
public interface AR<T> public interface Type<T>
{ {
// Human friendly name // Human friendly name
public String getTypeName(); public String getTypeName();
@ -28,7 +28,7 @@ public interface AR<T>
public List<String> getTabListFiltered(CommandSender sender, String arg); public List<String> getTabListFiltered(CommandSender sender, String arg);
// Sometimes we put a space after a tab completion. // 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; // Default is true;
public boolean allowSpaceAfterTab(); public boolean allowSpaceAfterTab();
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -12,7 +12,7 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public abstract class ARAbstract<T> implements AR<T> public abstract class TypeAbstract<T> implements Type<T>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE: READ // OVERRIDE: READ
@ -61,10 +61,10 @@ public abstract class ARAbstract<T> implements AR<T>
@Override @Override
public String getTypeName() public String getTypeName()
{ {
int prefixLength = "AR".length(); int prefixLength = "Type".length();
String name = this.getClass().getSimpleName(); String name = this.getClass().getSimpleName();
// We don't want the "AR" part // We don't want the "Type" part
name = name.substring(prefixLength); name = name.substring(prefixLength);
// We split at uppercase letters, because most class names are camel-case. // We split at uppercase letters, because most class names are camel-case.

View File

@ -1,11 +1,11 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public abstract class ARAbstractException<T> extends ARAbstract<T> public abstract class TypeAbstractException<T> extends TypeAbstract<T>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// ABSTRACT // ABSTRACT

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -6,7 +6,7 @@ import java.util.List;
import org.bukkit.command.CommandSender; 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 // CONSTANTS

View File

@ -1,10 +1,10 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public abstract class ARAbstractPrimitive<T> extends ARAbstractException<T> public abstract class TypeAbstractPrimitive<T> extends TypeAbstractException<T>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public abstract class ARAbstractSelect<T> extends ARAbstract<T> public abstract class TypeAbstractSelect<T> extends TypeAbstract<T>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// CONSTANT // CONSTANT

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -7,41 +7,41 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
public final class ARAll public final class TypeAll
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
@SuppressWarnings("unchecked") @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 TypeCollection) return new TypeAllCollection<T>((TypeCollection<? extends Collection<T>>) inner);
if (inner instanceof ARAllAble) return new ARAllDefault<T>((ARAllAble<T>) inner); if (inner instanceof TypeAllAble) return new TypeAllDefault<T>((TypeAllAble<T>) inner);
throw new IllegalArgumentException("innerArgReader must be an instance of either ARCollection or ARAllAble"); throw new IllegalArgumentException("innerType must be an instance of either TypeCollection or TypeAllAble");
} }
// -------------------------------------------- // // -------------------------------------------- //
// AR ALL DEFAULT // AR ALL DEFAULT
// -------------------------------------------- // // -------------------------------------------- //
private static class ARAllDefault<T> extends ARWrapper<Collection<T>> private static class TypeAllDefault<T> extends TypeWrapper<Collection<T>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
protected ARAllAble<T> innerArgReader; protected TypeAllAble<T> innerType;
@Override public ARAllAble<T> getInnerArgReader() { return this.innerArgReader; } @Override public TypeAllAble<T> getInnerType() { return this.innerType; }
// -------------------------------------------- // // -------------------------------------------- //
// CONSTRUCT // CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public ARAllDefault(ARAllAble<T> inner) public TypeAllDefault(TypeAllAble<T> inner)
{ {
if (inner == null) throw new IllegalArgumentException("innerArgReader musn't be null"); if (inner == null) throw new IllegalArgumentException("innerType musn't be null");
this.innerArgReader = inner; this.innerType = inner;
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -51,16 +51,16 @@ public final class ARAll
@Override @Override
public Collection<T> read(String arg, CommandSender sender) throws MassiveException 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); return Collections.singletonList(innerRet);
} }
@Override @Override
public boolean isValid(String arg, CommandSender sender) 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 // AR ALL COLLECTION
// -------------------------------------------- // // -------------------------------------------- //
private static class ARAllCollection<T> extends ARWrapper<Collection<T>> private static class TypeAllCollection<T> extends TypeWrapper<Collection<T>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
protected ARCollection<? extends Collection<T>> innerArgReader; protected TypeCollection<? extends Collection<T>> innerType;
@Override public ARCollection<? extends Collection<T>> getInnerArgReader() { return this.innerArgReader; } @Override public TypeCollection<? extends Collection<T>> getInnerType() { return this.innerType; }
// -------------------------------------------- // // -------------------------------------------- //
// CONSTRUCT // 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 == null) throw new IllegalArgumentException("innerType musn't be null");
if ( !(inner.getInnerArgReader() instanceof ARAllAble)) throw new IllegalArgumentException("innerArgReaders innerArgReader must implement ARAllAble"); if ( !(inner.getInnerType() instanceof TypeAllAble)) throw new IllegalArgumentException("innerType must implement ARAllAble");
this.innerArgReader = inner; this.innerType = inner;
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -99,17 +99,17 @@ public final class ARAll
if ("all".equalsIgnoreCase(arg)) if ("all".equalsIgnoreCase(arg))
{ {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
ARAllAble<T> innersInner = (ARAllAble<T>) getInnerArgReader().getInnerArgReader(); TypeAllAble<T> innersInner = (TypeAllAble<T>) getInnerType().getInnerType();
return innersInner.getAll(sender); return innersInner.getAll(sender);
} }
return getInnerArgReader().read(arg, sender); return getInnerType().read(arg, sender);
} }
@Override @Override
public boolean isValid(String arg, CommandSender sender) 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);
} }
} }

View File

@ -1,10 +1,10 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
import org.bukkit.command.CommandSender; 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); public Collection<T> getAll(CommandSender sender);
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
@ -8,14 +8,14 @@ import com.massivecraft.massivecore.Aspect;
import com.massivecraft.massivecore.AspectColl; import com.massivecraft.massivecore.AspectColl;
import com.massivecraft.massivecore.MassiveCorePerm; import com.massivecraft.massivecore.MassiveCorePerm;
public class ARAspect extends ARAbstractSelect<Aspect> public class TypeAspect extends TypeAbstractSelect<Aspect>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARAspect i = new ARAspect(); private static TypeAspect i = new TypeAspect();
public static ARAspect get() { return i; } public static TypeAspect get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -8,14 +8,14 @@ import java.util.List;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.command.CommandSender; 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 // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARBiome i = new ARBiome(); private static TypeBiome i = new TypeBiome();
public static ARBiome get() { return i; } public static TypeBiome get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
public class ARBoolean extends ARAbstractPrimitive<Boolean> public class TypeBoolean extends TypeAbstractPrimitive<Boolean>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// CONSTANTS // CONSTANTS
@ -29,8 +29,8 @@ public class ARBoolean extends ARAbstractPrimitive<Boolean>
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARBoolean i = new ARBoolean(); private static TypeBoolean i = new TypeBoolean();
public static ARBoolean get() { return i; } public static TypeBoolean get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,15 +1,15 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public class ARByte extends ARAbstractNumber<Byte> public class TypeByte extends TypeAbstractNumber<Byte>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARByte i = new ARByte(); private static TypeByte i = new TypeByte();
public static ARByte get() { return i; } public static TypeByte get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -8,14 +8,14 @@ import java.util.List;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; 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 // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARChatColor i = new ARChatColor(); private static TypeChatColor i = new TypeChatColor();
public static ARChatColor get() { return i; } public static TypeChatColor get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
@ -6,14 +6,14 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.store.Coll; 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 // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARColl i = new ARColl(); private static TypeColl i = new TypeColl();
public static ARColl get() { return i; } public static TypeColl get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.util.Txt; 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 // OVERRIDE
@ -18,7 +18,7 @@ public abstract class ARCollection<E extends Collection<?>> extends ARWrapper<E>
{ {
// Because we accept multiple arguments of the same type. // Because we accept multiple arguments of the same type.
// The passed arg might be more than one. We only want the latest. // 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 @Override
@ -26,7 +26,7 @@ public abstract class ARCollection<E extends Collection<?>> extends ARWrapper<E>
{ {
// Because we accept multiple arguments of the same type. // Because we accept multiple arguments of the same type.
// The passed arg might be more than one. We only want the latest. // 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) public static String getLastArg(String str)

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -9,27 +9,27 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.collections.MassiveList; import com.massivecraft.massivecore.collections.MassiveList;
public class ARCombined extends ARAbstract<List<?>> public class TypeCombined extends TypeAbstract<List<?>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
protected List<AR<?>> inners; protected List<Type<?>> inners;
public List<AR<?>> getInners() { return this.inners; } public List<Type<?>> getInners() { return this.inners; }
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public static ARCombined get(Collection<AR<?>> inners) { return new ARCombined(inners); } public static TypeCombined get(Collection<Type<?>> inners) { return new TypeCombined(inners); }
public static ARCombined get(AR<?>... inners) { return new ARCombined(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)); this(Arrays.asList(inners));
} }
@ -62,9 +62,9 @@ public class ARCombined extends ARAbstract<List<?>>
for (int i = 0; i < parts.size(); i++) for (int i = 0; i < parts.size(); i++)
{ {
String part = parts.get(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); ret.add(asdf);
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -8,7 +8,7 @@ import java.util.Date;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public class ARDate extends ARAbstractPrimitive<Date> public class TypeDate extends TypeAbstractPrimitive<Date>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// CONSTANTS // CONSTANTS
@ -20,8 +20,8 @@ public class ARDate extends ARAbstractPrimitive<Date>
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARDate i = new ARDate(); private static TypeDate i = new TypeDate();
public static ARDate get() { return i; } public static TypeDate get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
@ -9,14 +9,14 @@ import com.massivecraft.massivecore.event.EventMassiveCoreDestination;
import com.massivecraft.massivecore.event.EventMassiveCoreDestinationTabList; import com.massivecraft.massivecore.event.EventMassiveCoreDestinationTabList;
import com.massivecraft.massivecore.teleport.Destination; import com.massivecraft.massivecore.teleport.Destination;
public class ARDestination extends ARAbstract<Destination> public class TypeDestination extends TypeAbstract<Destination>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARDestination i = new ARDestination(); private static TypeDestination i = new TypeDestination();
public static ARDestination get() { return i; } public static TypeDestination get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -10,7 +10,7 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.util.MUtil; 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 // CONSTANTS
@ -22,8 +22,8 @@ public class ARDifficulty extends ARAbstractSelect<Difficulty> implements ARAllA
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARDifficulty i = new ARDifficulty(); private static TypeDifficulty i = new TypeDifficulty();
public static ARDifficulty get() { return i; } public static TypeDifficulty get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,15 +1,15 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public class ARDouble extends ARAbstractNumber<Double> public class TypeDouble extends TypeAbstractNumber<Double>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARDouble i = new ARDouble(); private static TypeDouble i = new TypeDouble();
public static ARDouble get() { return i; } public static TypeDouble get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -8,14 +8,14 @@ import java.util.List;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType; 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 // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static AREntityType i = new AREntityType(); private static TypeEntityType i = new TypeEntityType();
public static AREntityType get() { return i; } public static TypeEntityType get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.util.Txt; 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 // FIELD
@ -21,12 +21,12 @@ public class AREnum<T> extends ARAbstractSelect<T> implements ARAllAble<T>
// INSTANCE & CONSTRUCT // 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"); if ( ! clazz.isEnum()) throw new IllegalArgumentException("passed clazz param must be an enum");
this.clazz = clazz; this.clazz = clazz;

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.util.MUtil; 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 // CONSTANTS
@ -23,8 +23,8 @@ public class AREnvironment extends ARAbstractSelect<Environment> implements ARAl
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static AREnvironment i = new AREnvironment(); private static TypeEnvironment i = new TypeEnvironment();
public static AREnvironment get() { return i; } public static TypeEnvironment get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,15 +1,15 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public class ARFloat extends ARAbstractNumber<Float> public class TypeFloat extends TypeAbstractNumber<Float>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARFloat i = new ARFloat(); private static TypeFloat i = new TypeFloat();
public static ARFloat get() { return i; } public static TypeFloat get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -10,14 +10,14 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.util.Txt; 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 // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARGameMode i = new ARGameMode(); private static TypeGameMode i = new TypeGameMode();
public static ARGameMode get() { return i; } public static TypeGameMode get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,15 +1,15 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public class ARInteger extends ARAbstractNumber<Integer> public class TypeInteger extends TypeAbstractNumber<Integer>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARInteger i = new ARInteger(); private static TypeInteger i = new TypeInteger();
public static ARInteger get() { return i; } public static TypeInteger get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -8,28 +8,28 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class ARList<E> extends ARCollection<List<E>> public class TypeList<E> extends TypeCollection<List<E>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
protected AR<E> elementArgReader; protected Type<E> elementType;
public AR<E> getElementArgReader() { return this.elementArgReader; } public Type<E> getElementType() { return this.elementType; }
@Override public AR<E> getInnerArgReader() { return this.getElementArgReader(); } @Override public Type<E> getInnerType() { return this.getElementType(); }
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // 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 Each
for (String elementArg : elementArgs) for (String elementArg : elementArgs)
{ {
E element = this.getElementArgReader().read(elementArg, sender); E element = this.getElementType().read(elementArg, sender);
ret.add(element); ret.add(element);
} }

View File

@ -1,15 +1,15 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public class ARLong extends ARAbstractNumber<Long> public class TypeLong extends TypeAbstractNumber<Long>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARLong i = new ARLong(); private static TypeLong i = new TypeLong();
public static ARLong get() { return i; } public static TypeLong get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -10,14 +10,14 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.MassiveException; 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 // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARMaterial i = new ARMaterial(); private static TypeMaterial i = new TypeMaterial();
public static ARMaterial get() { return i; } public static TypeMaterial get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -7,14 +7,14 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.util.TimeDiffUtil; import com.massivecraft.massivecore.util.TimeDiffUtil;
public class ARMillisDiff extends ARAbstractException<Long> public class TypeMillisDiff extends TypeAbstractException<Long>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARMillisDiff i = new ARMillisDiff(); private static TypeMillisDiff i = new TypeMillisDiff();
public static ARMillisDiff get() { return i; } public static TypeMillisDiff get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
@ -8,14 +8,14 @@ import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.Multiverse; import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.MultiverseColl; import com.massivecraft.massivecore.MultiverseColl;
public class ARMultiverse extends ARAbstractSelect<Multiverse> public class TypeMultiverse extends TypeAbstractSelect<Multiverse>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARMultiverse i = new ARMultiverse(); private static TypeMultiverse i = new TypeMultiverse();
public static ARMultiverse get() { return i; } public static TypeMultiverse get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -11,14 +11,14 @@ import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.collections.MassiveList; import com.massivecraft.massivecore.collections.MassiveList;
public class ARNullable<T> extends ARAbstract<T> public class TypeNullable<T> extends TypeAbstract<T>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
protected AR<T> innerArgReader; protected Type<T> innerType;
public AR<T> getInnerArgReader() { return this.innerArgReader; } public Type<T> getInnerType() { return this.innerType; }
protected Collection<String> nulls; protected Collection<String> nulls;
public Collection<String> getNulls() { return this.nulls; } public Collection<String> getNulls() { return this.nulls; }
@ -27,40 +27,40 @@ public class ARNullable<T> extends ARAbstract<T>
// INSTANCE // 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 // 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 (inner == null) throw new NullPointerException("inner");
if (nulls == null) nulls = Collections.emptySet(); if (nulls == null) nulls = Collections.emptySet();
this.innerArgReader = inner; this.innerType = inner;
this.nulls = nulls; this.nulls = nulls;
} }
public ARNullable(AR<T> inner, String... nulls) public TypeNullable(Type<T> inner, String... nulls)
{ {
this(inner, Arrays.asList(nulls)); this(inner, Arrays.asList(nulls));
} }
public ARNullable(AR<T> inner) public TypeNullable(Type<T> inner)
{ {
this(inner, MassiveCore.NOTHING_REMOVE); this(inner, MassiveCore.NOTHING_REMOVE);
} }
@ -72,7 +72,7 @@ public class ARNullable<T> extends ARAbstract<T>
@Override @Override
public String getTypeName() public String getTypeName()
{ {
return this.getInnerArgReader().getTypeName(); return this.getInnerType().getTypeName();
} }
@Override @Override
@ -82,7 +82,7 @@ public class ARNullable<T> extends ARAbstract<T>
if (this.getNulls().contains(arg)) return null; if (this.getNulls().contains(arg)) return null;
// Inner // Inner
return this.getInnerArgReader().read(arg, sender); return this.getInnerType().read(arg, sender);
} }
@Override @Override
@ -92,7 +92,7 @@ public class ARNullable<T> extends ARAbstract<T>
List<String> ret = new MassiveList<String>(this.getNulls()); List<String> ret = new MassiveList<String>(this.getNulls());
// Fill Ret // Fill Ret
ret.addAll(this.getInnerArgReader().getTabList(sender, arg)); ret.addAll(this.getInnerType().getTabList(sender, arg));
// Return Ret // Return Ret
return ret; return ret;
@ -101,7 +101,7 @@ public class ARNullable<T> extends ARAbstract<T>
@Override @Override
public boolean allowSpaceAfterTab() public boolean allowSpaceAfterTab()
{ {
return this.getInnerArgReader().allowSpaceAfterTab(); return this.getInnerType().allowSpaceAfterTab();
} }
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -12,14 +12,14 @@ import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.ps.PSBuilder; import com.massivecraft.massivecore.ps.PSBuilder;
public class ARPS extends ARAbstract<PS> public class TypePS extends TypeAbstract<PS>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARPS i = new ARPS(); private static TypePS i = new TypePS();
public static ARPS get() { return i; } public static TypePS get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE
@ -51,10 +51,10 @@ public class ARPS extends ARAbstract<PS>
{ {
try try
{ {
String world = ARWorldId.get().read(parts.get(0), sender); String world = TypeWorldId.get().read(parts.get(0), sender);
double locationX = ARDouble.get().read(parts.get(1), sender); double locationX = TypeDouble.get().read(parts.get(1), sender);
double locationY = ARDouble.get().read(parts.get(2), sender); double locationY = TypeDouble.get().read(parts.get(2), sender);
double locationZ = ARDouble.get().read(parts.get(3), sender); double locationZ = TypeDouble.get().read(parts.get(3), sender);
return new PSBuilder(senderPs).world(world).locationX(locationX).locationY(locationY).locationZ(locationZ).build(); return new PSBuilder(senderPs).world(world).locationX(locationX).locationY(locationY).locationZ(locationZ).build();
} }
catch (Exception e) catch (Exception e)
@ -64,10 +64,10 @@ public class ARPS extends ARAbstract<PS>
try try
{ {
double locationX = ARDouble.get().read(parts.get(0), sender); double locationX = TypeDouble.get().read(parts.get(0), sender);
double locationY = ARDouble.get().read(parts.get(1), sender); double locationY = TypeDouble.get().read(parts.get(1), sender);
double locationZ = ARDouble.get().read(parts.get(2), sender); double locationZ = TypeDouble.get().read(parts.get(2), sender);
String world = ARWorldId.get().read(parts.get(3), sender); String world = TypeWorldId.get().read(parts.get(3), sender);
return new PSBuilder(senderPs).world(world).locationX(locationX).locationY(locationY).locationZ(locationZ).build(); return new PSBuilder(senderPs).world(world).locationX(locationX).locationY(locationY).locationZ(locationZ).build();
} }
catch (Exception e) catch (Exception e)
@ -79,9 +79,9 @@ public class ARPS extends ARAbstract<PS>
{ {
try try
{ {
double locationX = ARDouble.get().read(parts.get(0), sender); double locationX = TypeDouble.get().read(parts.get(0), sender);
double locationY = ARDouble.get().read(parts.get(1), sender); double locationY = TypeDouble.get().read(parts.get(1), sender);
double locationZ = ARDouble.get().read(parts.get(2), sender); double locationZ = TypeDouble.get().read(parts.get(2), sender);
return new PSBuilder(senderPs).locationX(locationX).locationY(locationY).locationZ(locationZ).build(); return new PSBuilder(senderPs).locationX(locationX).locationY(locationY).locationZ(locationZ).build();
} }
catch (Exception e) catch (Exception e)
@ -100,98 +100,98 @@ public class ARPS extends ARAbstract<PS>
value = getValue(part, PS.NAME_SERIALIZED_WORLD, PS.NAME_FULL_WORLD); value = getValue(part, PS.NAME_SERIALIZED_WORLD, PS.NAME_FULL_WORLD);
if (value != null) if (value != null)
{ {
ret.world(ARWorldId.get().read(value, sender)); ret.world(TypeWorldId.get().read(value, sender));
something = true; something = true;
} }
value = getValue(part, PS.NAME_SERIALIZED_BLOCKX, PS.NAME_FULL_BLOCKX); value = getValue(part, PS.NAME_SERIALIZED_BLOCKX, PS.NAME_FULL_BLOCKX);
if (value != null) if (value != null)
{ {
ret.blockX(ARInteger.get().read(value, sender)); ret.blockX(TypeInteger.get().read(value, sender));
something = true; something = true;
} }
value = getValue(part, PS.NAME_SERIALIZED_BLOCKY, PS.NAME_FULL_BLOCKY); value = getValue(part, PS.NAME_SERIALIZED_BLOCKY, PS.NAME_FULL_BLOCKY);
if (value != null) if (value != null)
{ {
ret.blockY(ARInteger.get().read(value, sender)); ret.blockY(TypeInteger.get().read(value, sender));
something = true; something = true;
} }
value = getValue(part, PS.NAME_SERIALIZED_BLOCKZ, PS.NAME_FULL_BLOCKZ); value = getValue(part, PS.NAME_SERIALIZED_BLOCKZ, PS.NAME_FULL_BLOCKZ);
if (value != null) if (value != null)
{ {
ret.blockZ(ARInteger.get().read(value, sender)); ret.blockZ(TypeInteger.get().read(value, sender));
something = true; something = true;
} }
value = getValue(part, PS.NAME_SERIALIZED_LOCATIONX, PS.NAME_FULL_LOCATIONX, "x"); value = getValue(part, PS.NAME_SERIALIZED_LOCATIONX, PS.NAME_FULL_LOCATIONX, "x");
if (value != null) if (value != null)
{ {
ret.locationX(ARDouble.get().read(value, sender)); ret.locationX(TypeDouble.get().read(value, sender));
something = true; something = true;
} }
value = getValue(part, PS.NAME_SERIALIZED_LOCATIONY, PS.NAME_FULL_LOCATIONY, "y"); value = getValue(part, PS.NAME_SERIALIZED_LOCATIONY, PS.NAME_FULL_LOCATIONY, "y");
if (value != null) if (value != null)
{ {
ret.locationY(ARDouble.get().read(value, sender)); ret.locationY(TypeDouble.get().read(value, sender));
something = true; something = true;
} }
value = getValue(part, PS.NAME_SERIALIZED_LOCATIONZ, PS.NAME_FULL_LOCATIONZ, "z"); value = getValue(part, PS.NAME_SERIALIZED_LOCATIONZ, PS.NAME_FULL_LOCATIONZ, "z");
if (value != null) if (value != null)
{ {
ret.locationZ(ARDouble.get().read(value, sender)); ret.locationZ(TypeDouble.get().read(value, sender));
something = true; something = true;
} }
value = getValue(part, PS.NAME_SERIALIZED_CHUNKX, PS.NAME_FULL_CHUNKX); value = getValue(part, PS.NAME_SERIALIZED_CHUNKX, PS.NAME_FULL_CHUNKX);
if (value != null) if (value != null)
{ {
ret.chunkX(ARInteger.get().read(value, sender)); ret.chunkX(TypeInteger.get().read(value, sender));
something = true; something = true;
} }
value = getValue(part, PS.NAME_SERIALIZED_CHUNKZ, PS.NAME_FULL_CHUNKZ); value = getValue(part, PS.NAME_SERIALIZED_CHUNKZ, PS.NAME_FULL_CHUNKZ);
if (value != null) if (value != null)
{ {
ret.chunkZ(ARInteger.get().read(value, sender)); ret.chunkZ(TypeInteger.get().read(value, sender));
something = true; something = true;
} }
value = getValue(part, PS.NAME_SERIALIZED_PITCH, PS.NAME_FULL_PITCH); value = getValue(part, PS.NAME_SERIALIZED_PITCH, PS.NAME_FULL_PITCH);
if (value != null) if (value != null)
{ {
ret.pitch(ARFloat.get().read(value, sender)); ret.pitch(TypeFloat.get().read(value, sender));
something = true; something = true;
} }
value = getValue(part, PS.NAME_SERIALIZED_YAW, PS.NAME_FULL_YAW); value = getValue(part, PS.NAME_SERIALIZED_YAW, PS.NAME_FULL_YAW);
if (value != null) if (value != null)
{ {
ret.yaw(ARFloat.get().read(value, sender)); ret.yaw(TypeFloat.get().read(value, sender));
something = true; something = true;
} }
value = getValue(part, PS.NAME_SERIALIZED_VELOCITYX, PS.NAME_FULL_VELOCITYX); value = getValue(part, PS.NAME_SERIALIZED_VELOCITYX, PS.NAME_FULL_VELOCITYX);
if (value != null) if (value != null)
{ {
ret.velocityX(ARDouble.get().read(value, sender)); ret.velocityX(TypeDouble.get().read(value, sender));
something = true; something = true;
} }
value = getValue(part, PS.NAME_SERIALIZED_VELOCITYY, PS.NAME_FULL_VELOCITYY); value = getValue(part, PS.NAME_SERIALIZED_VELOCITYY, PS.NAME_FULL_VELOCITYY);
if (value != null) if (value != null)
{ {
ret.velocityY(ARDouble.get().read(value, sender)); ret.velocityY(TypeDouble.get().read(value, sender));
something = true; something = true;
} }
value = getValue(part, PS.NAME_SERIALIZED_VELOCITYZ, PS.NAME_FULL_VELOCITYZ); value = getValue(part, PS.NAME_SERIALIZED_VELOCITYZ, PS.NAME_FULL_VELOCITYZ);
if (value != null) if (value != null)
{ {
ret.velocityZ(ARDouble.get().read(value, sender)); ret.velocityZ(TypeDouble.get().read(value, sender));
something = true; something = true;
} }
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
import java.util.Set; import java.util.Set;
@ -10,14 +10,14 @@ import org.bukkit.permissions.Permission;
import com.massivecraft.massivecore.MassiveException; 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 // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARPermission i = new ARPermission(); private static TypePermission i = new TypePermission();
public static ARPermission get() { return i; } public static TypePermission get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -7,15 +7,15 @@ import com.massivecraft.massivecore.SenderType;
import com.massivecraft.massivecore.store.SenderIdSourceMixinAllSenderIds; import com.massivecraft.massivecore.store.SenderIdSourceMixinAllSenderIds;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
public class ARPlayer extends ARSenderIdAbstract<Player> public class TypePlayer extends TypeSenderIdAbstract<Player>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static final ARPlayer i = new ARPlayer(); private static final TypePlayer i = new TypePlayer();
public static ARPlayer get() { return i; } public static TypePlayer get() { return i; }
private ARPlayer() private TypePlayer()
{ {
super(SenderIdSourceMixinAllSenderIds.get(), SenderPresence.LOCAL, SenderType.PLAYER); super(SenderIdSourceMixinAllSenderIds.get(), SenderPresence.LOCAL, SenderType.PLAYER);
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -10,14 +10,14 @@ import org.bukkit.potion.PotionEffectType;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.collections.MassiveList; 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 // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARPotionEffectType i = new ARPotionEffectType(); private static TypePotionEffectType i = new TypePotionEffectType();
public static ARPotionEffectType get() { return i; } public static TypePotionEffectType get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -9,25 +9,25 @@ import org.bukkit.potion.PotionEffectType;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.PotionEffectWrap; import com.massivecraft.massivecore.PotionEffectWrap;
public class ARPotionEffectWrap extends ARAbstract<PotionEffectWrap> public class TypePotionEffectWrap extends TypeAbstract<PotionEffectWrap>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARPotionEffectWrap i = new ARPotionEffectWrap(); private static TypePotionEffectWrap i = new TypePotionEffectWrap();
public static ARPotionEffectWrap get() { return i; } public static TypePotionEffectWrap get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
protected final ARCombined combined = new ARCombined( protected final TypeCombined combined = new TypeCombined(
ARPotionEffectType.get(), TypePotionEffectType.get(),
ARInteger.get(), TypeInteger.get(),
ARInteger.get(), TypeInteger.get(),
ARBoolean.get(), TypeBoolean.get(),
ARBoolean.get() TypeBoolean.get()
); );
// -------------------------------------------- // // -------------------------------------------- //
@ -81,7 +81,7 @@ public class ARPotionEffectWrap extends ARAbstract<PotionEffectWrap>
@Override @Override
public Collection<String> getTabList(CommandSender sender, String arg) public Collection<String> getTabList(CommandSender sender, String arg)
{ {
return ARPotionEffectType.get().getTabList(sender, arg); return TypePotionEffectType.get().getTabList(sender, arg);
} }
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -7,15 +7,15 @@ import com.massivecraft.massivecore.SenderType;
import com.massivecraft.massivecore.store.SenderIdSourceMixinAllSenderIds; import com.massivecraft.massivecore.store.SenderIdSourceMixinAllSenderIds;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
public class ARSender extends ARSenderIdAbstract<CommandSender> public class TypeSender extends TypeSenderIdAbstract<CommandSender>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static final ARSender i = new ARSender(); private static final TypeSender i = new TypeSender();
public static ARSender get() { return i; } public static TypeSender get() { return i; }
private ARSender() private TypeSender()
{ {
super(SenderIdSourceMixinAllSenderIds.get(), SenderPresence.LOCAL, SenderType.ANY); super(SenderIdSourceMixinAllSenderIds.get(), SenderPresence.LOCAL, SenderType.ANY);
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
import org.bukkit.command.CommandSender; 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.SenderColl;
import com.massivecraft.massivecore.store.SenderEntity; 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 // FIELDS
@ -20,19 +20,19 @@ public class ARSenderEntity<T extends SenderEntity<T>> extends ARSenderIdAbstrac
// CONSTRUCT // CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private ARSenderEntity(SenderColl<T> coll, SenderPresence presence, SenderType type) private TypeSenderEntity(SenderColl<T> coll, SenderPresence presence, SenderType type)
{ {
super(coll, presence, type); super(coll, presence, type);
this.coll = coll; this.coll = coll;
} }
private ARSenderEntity(SenderColl<T> coll, SenderPresence presence) private TypeSenderEntity(SenderColl<T> coll, SenderPresence presence)
{ {
super(coll, presence); super(coll, presence);
this.coll = coll; this.coll = coll;
} }
private ARSenderEntity(SenderColl<T> coll) private TypeSenderEntity(SenderColl<T> coll)
{ {
super(coll); super(coll);
this.coll = coll; this.coll = coll;
@ -42,9 +42,9 @@ public class ARSenderEntity<T extends SenderEntity<T>> extends ARSenderIdAbstrac
// GET // 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>> TypeSenderEntity<T> get(SenderColl<T> coll, SenderPresence presence, SenderType type) { return new TypeSenderEntity<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>> TypeSenderEntity<T> get(SenderColl<T> coll, SenderPresence presence) { return new TypeSenderEntity<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) { return new TypeSenderEntity<T>(coll); }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -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.SenderPresence;
import com.massivecraft.massivecore.SenderType; import com.massivecraft.massivecore.SenderType;
import com.massivecraft.massivecore.store.SenderIdSource; import com.massivecraft.massivecore.store.SenderIdSource;
import com.massivecraft.massivecore.store.SenderIdSourceMixinAllSenderIds; import com.massivecraft.massivecore.store.SenderIdSourceMixinAllSenderIds;
public class ARSenderId extends ARSenderIdAbstract<String> public class TypeSenderId extends TypeSenderIdAbstract<String>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// CONSTRUCT // CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private ARSenderId(SenderIdSource source, SenderPresence presence, SenderType type) private TypeSenderId(SenderIdSource source, SenderPresence presence, SenderType type)
{ {
super(source, presence, type); super(source, presence, type);
} }
private ARSenderId(SenderIdSource source, SenderPresence presence) private TypeSenderId(SenderIdSource source, SenderPresence presence)
{ {
super(source, presence); super(source, presence);
} }
private ARSenderId(SenderIdSource source) private TypeSenderId(SenderIdSource source)
{ {
super(source); super(source);
} }
@ -30,16 +30,16 @@ public class ARSenderId extends ARSenderIdAbstract<String>
// INSTANCE // INSTANCE
// -------------------------------------------- // // -------------------------------------------- //
private static final ARSenderId i = new ARSenderId(SenderIdSourceMixinAllSenderIds.get()); private static final TypeSenderId i = new TypeSenderId(SenderIdSourceMixinAllSenderIds.get());
public static ARSenderId get() { return i; } public static TypeSenderId get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// GET // GET
// -------------------------------------------- // // -------------------------------------------- //
public static ARSenderId get(SenderIdSource source, SenderPresence presence, SenderType type) { return new ARSenderId(source, presence, type); } public static TypeSenderId get(SenderIdSource source, SenderPresence presence, SenderType type) { return new TypeSenderId(source, presence, type); }
public static ARSenderId get(SenderIdSource source, SenderPresence presence) { return new ARSenderId(source, presence); } public static TypeSenderId get(SenderIdSource source, SenderPresence presence) { return new TypeSenderId(source, presence); }
public static ARSenderId get(SenderIdSource source) { return new ARSenderId(source); } public static TypeSenderId get(SenderIdSource source) { return new TypeSenderId(source); }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; 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.IdUtil;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
public abstract class ARSenderIdAbstract<T> extends ARAbstract<T> public abstract class TypeSenderIdAbstract<T> extends TypeAbstract<T>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
@ -29,7 +29,7 @@ public abstract class ARSenderIdAbstract<T> extends ARAbstract<T>
// CONSTRUCT // 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 (source == null) throw new NullPointerException("source");
if (presence == null) throw new NullPointerException("presence"); if (presence == null) throw new NullPointerException("presence");
@ -40,12 +40,12 @@ public abstract class ARSenderIdAbstract<T> extends ARAbstract<T>
this.type = type; this.type = type;
} }
public ARSenderIdAbstract(SenderIdSource source, SenderPresence presence) public TypeSenderIdAbstract(SenderIdSource source, SenderPresence presence)
{ {
this(source, presence, SenderType.ANY); this(source, presence, SenderType.ANY);
} }
public ARSenderIdAbstract(SenderIdSource source) public TypeSenderIdAbstract(SenderIdSource source)
{ {
this(source, SenderPresence.ANY); this(source, SenderPresence.ANY);
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
@ -10,15 +10,15 @@ import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class ARSet<E> extends ARCollection<Set<E>> public class TypeSet<E> extends TypeCollection<Set<E>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
protected final AR<E> elementArgReader; protected final Type<E> elementType;
public AR<E> getElementArgReader() { return this.elementArgReader; } public Type<E> getElementType() { return this.elementType; }
@Override public AR<E> getInnerArgReader() { return this.getElementArgReader(); } @Override public Type<E> getInnerType() { return this.getElementType(); }
protected final boolean warnOnDuplicates; protected final boolean warnOnDuplicates;
public boolean getWarnOnDuplicate() { return warnOnDuplicates; } public boolean getWarnOnDuplicate() { return warnOnDuplicates; }
@ -27,14 +27,14 @@ public class ARSet<E> extends ARCollection<Set<E>>
// INSTANCE & CONSTRUCT // 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; this.warnOnDuplicates = warnOnDuplicates;
} }
@ -45,7 +45,7 @@ public class ARSet<E> extends ARCollection<Set<E>>
@Override @Override
public String getTypeName() public String getTypeName()
{ {
return elementArgReader.getTypeName(); return elementType.getTypeName();
} }
// NOTE: Must be used with argConcatFrom and setErrorOnTooManyArgs(false). // NOTE: Must be used with argConcatFrom and setErrorOnTooManyArgs(false).
@ -63,7 +63,7 @@ public class ARSet<E> extends ARCollection<Set<E>>
// For Each // For Each
for (String elementArg : elementArgs) for (String elementArg : elementArgs)
{ {
E element = this.getElementArgReader().read(elementArg, sender); E element = this.getElementType().read(elementArg, sender);
duplicates = ( ! ret.add(element) || duplicates); duplicates = ( ! ret.add(element) || duplicates);
} }
@ -80,7 +80,7 @@ public class ARSet<E> extends ARCollection<Set<E>>
@Override @Override
public Collection<String> getTabList(CommandSender sender, String arg) public Collection<String> getTabList(CommandSender sender, String arg)
{ {
return elementArgReader.getTabList(sender, arg); return elementType.getTabList(sender, arg);
} }
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -10,14 +10,14 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.MassiveException; 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 // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARSound i = new ARSound(); private static TypeSound i = new TypeSound();
public static ARSound get() { return i; } public static TypeSound get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
import java.util.Set; import java.util.Set;
@ -8,14 +8,14 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.SoundEffect; import com.massivecraft.massivecore.SoundEffect;
import com.massivecraft.massivecore.collections.MassiveSet; import com.massivecraft.massivecore.collections.MassiveSet;
public class ARSoundEffect extends ARAbstractException<SoundEffect> public class TypeSoundEffect extends TypeAbstractException<SoundEffect>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARSoundEffect i = new ARSoundEffect(); private static TypeSoundEffect i = new TypeSoundEffect();
public static ARSoundEffect get() { return i; } public static TypeSoundEffect get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE
@ -32,7 +32,7 @@ public class ARSoundEffect extends ARAbstractException<SoundEffect>
{ {
Set<String> ret = new MassiveSet<String>(); 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 + "-"); ret.add(str + "-");
} }

View File

@ -1,18 +1,18 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public class ARString extends ARAbstract<String> public class TypeString extends TypeAbstract<String>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARString i = new ARString(); private static TypeString i = new TypeString();
public static ARString get() { return i; } public static TypeString get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -19,14 +19,14 @@ import com.massivecraft.massivecore.util.Txt;
// We return the command without leading slash. // We return the command without leading slash.
// If the player supplies a leading slash we assume they mean some WorldEdit double slash first. // If the player supplies a leading slash we assume they mean some WorldEdit double slash first.
// Then we test without if nothing found. // Then we test without if nothing found.
public class ARStringCommand extends ARAbstract<String> public class TypeStringCommand extends TypeAbstract<String>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARStringCommand i = new ARStringCommand(); private static TypeStringCommand i = new TypeStringCommand();
public static ARStringCommand get() { return i; } public static TypeStringCommand get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -11,7 +11,7 @@ import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.collections.MassiveSet; import com.massivecraft.massivecore.collections.MassiveSet;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class ARUniverse extends ARAbstract<String> public class TypeUniverse extends TypeAbstract<String>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
@ -30,11 +30,11 @@ public class ARUniverse extends ARAbstract<String>
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public static ARUniverse get(Aspect aspect) { return new ARUniverse(aspect); } public static TypeUniverse get(Aspect aspect) { return new TypeUniverse(aspect); }
public static ARUniverse get(Multiverse multiverse) { return new ARUniverse(multiverse); } public static TypeUniverse get(Multiverse multiverse) { return new TypeUniverse(multiverse); }
public ARUniverse(Aspect aspect) { this.aspect = aspect; } public TypeUniverse(Aspect aspect) { this.aspect = aspect; }
public ARUniverse(Multiverse multiverse) { this.multiverse = multiverse; } public TypeUniverse(Multiverse multiverse) { this.multiverse = multiverse; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
@ -8,14 +8,14 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
public class ARWorld extends ARAbstract<World> public class TypeWorld extends TypeAbstract<World>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARWorld i = new ARWorld(); private static TypeWorld i = new TypeWorld();
public static ARWorld get() { return i; } public static TypeWorld get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE
@ -24,7 +24,7 @@ public class ARWorld extends ARAbstract<World>
@Override @Override
public World read(String arg, CommandSender sender) throws MassiveException 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); World ret = Bukkit.getWorld(worldId);
@ -39,7 +39,7 @@ public class ARWorld extends ARAbstract<World>
@Override @Override
public Collection<String> getTabList(CommandSender sender, String arg) public Collection<String> getTabList(CommandSender sender, String arg)
{ {
return ARWorldId.get().getTabList(sender, arg); return TypeWorldId.get().getTabList(sender, arg);
} }
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -8,14 +8,14 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.mixin.Mixin; 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 // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARWorldId i = new ARWorldId(); private static TypeWorldId i = new TypeWorldId();
public static ARWorldId get() { return i; } public static TypeWorldId get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
public class ARWorldType extends ARAbstractSelect<WorldType> public class TypeWorldType extends TypeAbstractSelect<WorldType>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// CONSTANTS // CONSTANTS
@ -21,8 +21,8 @@ public class ARWorldType extends ARAbstractSelect<WorldType>
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static ARWorldType i = new ARWorldType(); private static TypeWorldType i = new TypeWorldType();
public static ARWorldType get() { return i; } public static TypeWorldType get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -1,16 +1,16 @@
package com.massivecraft.massivecore.cmd.arg; package com.massivecraft.massivecore.cmd.type;
import java.util.Collection; import java.util.Collection;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public abstract class ARWrapper<T> extends ARAbstract<T> public abstract class TypeWrapper<T> extends TypeAbstract<T>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// ABSTRACT // ABSTRACT
// -------------------------------------------- // // -------------------------------------------- //
public abstract AR<?> getInnerArgReader(); public abstract Type<?> getInnerType();
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE
@ -19,25 +19,25 @@ public abstract class ARWrapper<T> extends ARAbstract<T>
@Override @Override
public String getTypeName() public String getTypeName()
{ {
return this.getInnerArgReader().getTypeName(); return this.getInnerType().getTypeName();
} }
@Override @Override
public boolean isValid(String arg, CommandSender sender) public boolean isValid(String arg, CommandSender sender)
{ {
return this.getInnerArgReader().isValid(arg, sender); return this.getInnerType().isValid(arg, sender);
} }
@Override @Override
public Collection<String> getTabList(CommandSender sender, String arg) public Collection<String> getTabList(CommandSender sender, String arg)
{ {
return this.getInnerArgReader().getTabList(sender, arg); return this.getInnerType().getTabList(sender, arg);
} }
@Override @Override
public boolean allowSpaceAfterTab() public boolean allowSpaceAfterTab()
{ {
return this.getInnerArgReader().allowSpaceAfterTab(); return this.getInnerType().allowSpaceAfterTab();
} }
} }

View File

@ -4,7 +4,7 @@ import java.util.Collection;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.Predictate; import com.massivecraft.massivecore.Predicate;
public interface MessageMixin public interface MessageMixin
{ {
@ -19,9 +19,9 @@ public interface MessageMixin
public boolean msgAll(Collection<String> msgs); public boolean msgAll(Collection<String> msgs);
// Predicate // Predicate
public boolean msgPredictate(Predictate<CommandSender> predictate, String msg); public boolean msgPredicate(Predicate<CommandSender> predicate, String msg);
public boolean msgPredictate(Predictate<CommandSender> predictate, String msg, Object... args); public boolean msgPredicate(Predicate<CommandSender> predicate, String msg, Object... args);
public boolean msgPredictate(Predictate<CommandSender> predictate, Collection<String> msgs); public boolean msgPredicate(Predicate<CommandSender> predicate, Collection<String> msgs);
// One // One
public boolean msgOne(Object sendeeObject, String msg); public boolean msgOne(Object sendeeObject, String msg);
@ -38,9 +38,9 @@ public interface MessageMixin
public boolean messageAll(Collection<?> messages); public boolean messageAll(Collection<?> messages);
// Predicate // Predicate
public boolean messagePredictate(Predictate<CommandSender> predictate, Object message); public boolean messagePredicate(Predicate<CommandSender> predicate, Object message);
public boolean messagePredictate(Predictate<CommandSender> predictate, Object... messages); public boolean messagePredicate(Predicate<CommandSender> predicate, Object... messages);
public boolean messagePredictate(Predictate<CommandSender> predictate, Collection<?> messages); public boolean messagePredicate(Predicate<CommandSender> predicate, Collection<?> messages);
// One // One
public boolean messageOne(Object sendeeObject, Object message); public boolean messageOne(Object sendeeObject, Object message);

View File

@ -6,7 +6,7 @@ import java.util.Collections;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.Predictate; import com.massivecraft.massivecore.Predicate;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public abstract class MessageMixinAbstract implements MessageMixin public abstract class MessageMixinAbstract implements MessageMixin
@ -35,23 +35,23 @@ public abstract class MessageMixinAbstract implements MessageMixin
return this.messageAll(Txt.parse(msgs)); return this.messageAll(Txt.parse(msgs));
} }
// Predictate // Predicate
@Override @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 @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 @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 // One
@ -92,15 +92,15 @@ public abstract class MessageMixinAbstract implements MessageMixin
// Predicate // Predicate
@Override @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 @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 // One

View File

@ -5,7 +5,7 @@ import java.util.Collection;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; 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.mson.Mson;
import com.massivecraft.massivecore.nms.NmsPacket; import com.massivecraft.massivecore.nms.NmsPacket;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
@ -45,10 +45,10 @@ public class MessageMixinDefault extends MessageMixinAbstract
// Predicate // Predicate
// NOTE: Targets messageOne // NOTE: Targets messageOne
@Override @Override
public boolean messagePredictate(Predictate<CommandSender> predictate, Collection<?> messages) public boolean messagePredicate(Predicate<CommandSender> predicate, Collection<?> messages)
{ {
// Check Predicate // Check Predicate
if (predictate == null) return false; if (predicate == null) return false;
// Check Messages // Check Messages
if (messages == null) return false; if (messages == null) return false;
@ -57,7 +57,7 @@ public class MessageMixinDefault extends MessageMixinAbstract
// Here // Here
for (CommandSender sender : IdUtil.getLocalSenders()) for (CommandSender sender : IdUtil.getLocalSenders())
{ {
if (!predictate.apply(sender)) continue; if (!predicate.apply(sender)) continue;
this.messageOne(sender, messages); this.messageOne(sender, messages);
} }

View File

@ -12,7 +12,7 @@ import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import org.bukkit.permissions.Permissible; 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.event.EventMassiveCorePlayerLeave;
import com.massivecraft.massivecore.mson.Mson; import com.massivecraft.massivecore.mson.Mson;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
@ -255,19 +255,19 @@ public class Mixin
} }
// MSG: Predicate // 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 // MSG: One
@ -303,19 +303,19 @@ public class Mixin
} }
// MESSAGE: Predicate // 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 // MESSAGE: One

View File

@ -15,7 +15,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.google.common.collect.ImmutableList; 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.adapter.LowercaseEnumAdapter;
import com.massivecraft.massivecore.cmd.MassiveCommand; import com.massivecraft.massivecore.cmd.MassiveCommand;
import com.massivecraft.massivecore.collections.MassiveList; import com.massivecraft.massivecore.collections.MassiveList;
@ -903,10 +903,10 @@ public class Mson implements Serializable
return Mixin.messageAll(this); return Mixin.messageAll(this);
} }
// Predictate // Predicate
public boolean messagePredictate(Predictate<CommandSender> predictate) public boolean messagePredicate(Predicate<CommandSender> predicate)
{ {
return Mixin.messagePredictate(predictate, this); return Mixin.messagePredicate(predicate, this);
} }
// One // One

Some files were not shown because too many files have changed in this diff Show More