diff --git a/docs/acf-bukkit/co/aikar/commands/BukkitCommandManager.html b/docs/acf-bukkit/co/aikar/commands/BukkitCommandManager.html index e6cfe284..b26aa5a1 100644 --- a/docs/acf-bukkit/co/aikar/commands/BukkitCommandManager.html +++ b/docs/acf-bukkit/co/aikar/commands/BukkitCommandManager.html @@ -113,7 +113,7 @@ var activeTableTab = "activeTableTab";
public class BukkitCommandManager +public class BukkitCommandManager extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>
BukkitCommandExecutionContextcreateCommandContext(co.aikar.commands.RegisteredCommand command,
- Parameter parameter,
+createCommandContext(co.aikar.commands.RegisteredCommand command,
+ co.aikar.commands.CommandParameter parameter,
co.aikar.commands.CommandIssuer sender,
List<String> args,
int i,
@@ -341,7 +341,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
plugin
-protected final org.bukkit.plugin.Plugin plugin
+protected final org.bukkit.plugin.Plugin plugin
@@ -350,7 +350,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
knownCommands
-protected Map<String,org.bukkit.command.Command> knownCommands
+protected Map<String,org.bukkit.command.Command> knownCommands
@@ -359,7 +359,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
registeredCommands
-protected Map<String,BukkitRootCommand> registeredCommands
+protected Map<String,BukkitRootCommand> registeredCommands
@@ -368,7 +368,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
contexts
-protected BukkitCommandContexts contexts
+protected BukkitCommandContexts contexts
@@ -377,7 +377,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
completions
-protected BukkitCommandCompletions completions
+protected BukkitCommandCompletions completions
@@ -386,7 +386,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
locales
-protected BukkitLocales locales
+protected BukkitLocales locales
@@ -395,7 +395,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
autoDetectFromClient
-protected boolean autoDetectFromClient
+protected boolean autoDetectFromClient
@@ -412,7 +412,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
BukkitCommandManager
-public BukkitCommandManager(org.bukkit.plugin.Plugin plugin)
+public BukkitCommandManager(org.bukkit.plugin.Plugin plugin)
@@ -429,7 +429,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
getPlugin
-public org.bukkit.plugin.Plugin getPlugin()
+public org.bukkit.plugin.Plugin getPlugin()
@@ -438,7 +438,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
isCommandIssuer
-public boolean isCommandIssuer(Class<?> type)
+public boolean isCommandIssuer(Class<?> type)
- Specified by:
isCommandIssuer in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>
@@ -451,7 +451,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
-
getCommandContexts
-public co.aikar.commands.CommandContexts<BukkitCommandExecutionContext> getCommandContexts()
+public co.aikar.commands.CommandContexts<BukkitCommandExecutionContext> getCommandContexts()
- Specified by:
getCommandContexts in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>
@@ -464,7 +464,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
-
getCommandCompletions
-public co.aikar.commands.CommandCompletions<BukkitCommandCompletionContext> getCommandCompletions()
+public co.aikar.commands.CommandCompletions<BukkitCommandCompletionContext> getCommandCompletions()
- Specified by:
getCommandCompletions in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>
@@ -477,7 +477,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
-
getLocales
-public BukkitLocales getLocales()
+public BukkitLocales getLocales()
- Specified by:
getLocales in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>
@@ -490,7 +490,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
-
hasRegisteredCommands
-public boolean hasRegisteredCommands()
+public boolean hasRegisteredCommands()
- Specified by:
hasRegisteredCommands in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>
@@ -503,7 +503,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
-
registerCommand
-public void registerCommand(co.aikar.commands.BaseCommand command,
+public void registerCommand(co.aikar.commands.BaseCommand command,
boolean force)
@@ -513,7 +513,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
-
registerCommand
-public void registerCommand(co.aikar.commands.BaseCommand command)
+public void registerCommand(co.aikar.commands.BaseCommand command)
- Specified by:
registerCommand in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>
@@ -526,7 +526,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
-
unregisterCommand
-public void unregisterCommand(co.aikar.commands.BaseCommand command)
+public void unregisterCommand(co.aikar.commands.BaseCommand command)
@@ -536,7 +536,7 @@ extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,
unregisterCommand
@Deprecated
-public void unregisterCommand(BukkitRootCommand command)
+public void unregisterCommand(BukkitRootCommand command)
Deprecated. Use unregisterCommand(BaseCommand) - this will be visibility reduced later.
- Parameters:
@@ -550,7 +550,7 @@ public void
-
unregisterCommands
-public void unregisterCommands()
+public void unregisterCommands()
@@ -559,7 +559,7 @@ public void
-
setPlayerLocale
-public Locale setPlayerLocale(org.bukkit.entity.Player player,
+public Locale setPlayerLocale(org.bukkit.entity.Player player,
Locale locale)
@@ -569,7 +569,7 @@ public void
-
getTimings
-public co.aikar.timings.lib.TimingManager getTimings()
+public co.aikar.timings.lib.TimingManager getTimings()
@@ -578,7 +578,7 @@ public void
-
createRootCommand
-public co.aikar.commands.RootCommand createRootCommand(String cmd)
+public co.aikar.commands.RootCommand createRootCommand(String cmd)
- Specified by:
createRootCommand in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>
@@ -591,21 +591,21 @@ public void
-
getCommandIssuer
-public BukkitCommandIssuer getCommandIssuer(Object issuer)
+public BukkitCommandIssuer getCommandIssuer(Object issuer)
- Specified by:
getCommandIssuer in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>
-
+
-
createCommandContext
-public BukkitCommandExecutionContext createCommandContext(co.aikar.commands.RegisteredCommand command,
- Parameter parameter,
+public BukkitCommandExecutionContext createCommandContext(co.aikar.commands.RegisteredCommand command,
+ co.aikar.commands.CommandParameter parameter,
co.aikar.commands.CommandIssuer sender,
List<String> args,
int i,
@@ -622,7 +622,7 @@ public void
-
createCompletionContext
-public BukkitCommandCompletionContext createCompletionContext(co.aikar.commands.RegisteredCommand command,
+public BukkitCommandCompletionContext createCompletionContext(co.aikar.commands.RegisteredCommand command,
co.aikar.commands.CommandIssuer sender,
String input,
String config,
@@ -639,7 +639,7 @@ public void
-
createRegisteredCommand
-public co.aikar.commands.RegisteredCommand createRegisteredCommand(co.aikar.commands.BaseCommand command,
+public co.aikar.commands.RegisteredCommand createRegisteredCommand(co.aikar.commands.BaseCommand command,
String cmdName,
Method method,
String prefSubCommand)
@@ -655,7 +655,7 @@ public void
-
createConditionContext
-public BukkitConditionContext createConditionContext(co.aikar.commands.CommandIssuer issuer,
+public BukkitConditionContext createConditionContext(co.aikar.commands.CommandIssuer issuer,
String config)
diff --git a/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandExecutionContext.html b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandExecutionContext.html
index 940a3aa2..f337d05d 100644
--- a/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandExecutionContext.html
+++ b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandExecutionContext.html
@@ -103,8 +103,8 @@
BukkitCommandExecutionContext
-BukkitCommandManager.createCommandContext(co.aikar.commands.RegisteredCommand command,
- Parameter parameter,
+BukkitCommandManager.createCommandContext(co.aikar.commands.RegisteredCommand command,
+ co.aikar.commands.CommandParameter parameter,
co.aikar.commands.CommandIssuer sender,
List<String> args,
int i,
diff --git a/docs/acf-bukkit/index-all.html b/docs/acf-bukkit/index-all.html
index f547d7a5..b8e6b26a 100644
--- a/docs/acf-bukkit/index-all.html
+++ b/docs/acf-bukkit/index-all.html
@@ -137,7 +137,7 @@
-
- contexts - Variable in class co.aikar.commands.BukkitCommandManager
-
-- createCommandContext(RegisteredCommand, Parameter, CommandIssuer, List<String>, int, Map<String, Object>) - Method in class co.aikar.commands.BukkitCommandManager
+- createCommandContext(RegisteredCommand, CommandParameter, CommandIssuer, List<String>, int, Map<String, Object>) - Method in class co.aikar.commands.BukkitCommandManager
-
- createCompletionContext(RegisteredCommand, CommandIssuer, String, String, String[]) - Method in class co.aikar.commands.BukkitCommandManager
-
diff --git a/docs/acf-bukkit/src-html/co/aikar/commands/BukkitCommandExecutionContext.html b/docs/acf-bukkit/src-html/co/aikar/commands/BukkitCommandExecutionContext.html
index c6e9264a..fca7d836 100644
--- a/docs/acf-bukkit/src-html/co/aikar/commands/BukkitCommandExecutionContext.html
+++ b/docs/acf-bukkit/src-html/co/aikar/commands/BukkitCommandExecutionContext.html
@@ -39,7 +39,7 @@
031import java.util.Map;
032
033public class BukkitCommandExecutionContext extends CommandExecutionContext<BukkitCommandExecutionContext, BukkitCommandIssuer> {
-034 BukkitCommandExecutionContext(RegisteredCommand cmd, Parameter param, BukkitCommandIssuer sender, List<String> args,
+034 BukkitCommandExecutionContext(RegisteredCommand cmd, CommandParameter param, BukkitCommandIssuer sender, List<String> args,
035 int index, Map<String, Object> passedArgs) {
036 super(cmd, param, sender, args, index, passedArgs);
037 }
diff --git a/docs/acf-bukkit/src-html/co/aikar/commands/BukkitCommandManager.html b/docs/acf-bukkit/src-html/co/aikar/commands/BukkitCommandManager.html
index 6947dda1..c549cdf6 100644
--- a/docs/acf-bukkit/src-html/co/aikar/commands/BukkitCommandManager.html
+++ b/docs/acf-bukkit/src-html/co/aikar/commands/BukkitCommandManager.html
@@ -54,315 +54,314 @@
046
047import java.lang.reflect.Field;
048import java.lang.reflect.Method;
-049import java.lang.reflect.Parameter;
-050import java.util.HashMap;
-051import java.util.List;
-052import java.util.Locale;
-053import java.util.Map;
-054import java.util.Objects;
-055import java.util.logging.Level;
-056import java.util.logging.Logger;
-057
-058@SuppressWarnings("WeakerAccess")
-059public class BukkitCommandManager extends CommandManager<
-060 CommandSender,
-061 BukkitCommandIssuer,
-062 ChatColor,
-063 BukkitMessageFormatter,
-064 BukkitCommandExecutionContext,
-065 BukkitConditionContext
-066 > {
-067
-068 @SuppressWarnings("WeakerAccess")
-069 protected final Plugin plugin;
-070 private final CommandMap commandMap;
-071 private final TimingManager timingManager;
-072 private final BukkitTask localeTask;
-073 private final Logger logger;
-074 protected Map<String, Command> knownCommands = new HashMap<>();
-075 protected Map<String, BukkitRootCommand> registeredCommands = new HashMap<>();
-076 protected BukkitCommandContexts contexts;
-077 protected BukkitCommandCompletions completions;
-078 MCTiming commandTiming;
-079 protected BukkitLocales locales;
-080 private boolean cantReadLocale = false;
-081 protected boolean autoDetectFromClient = true;
-082
-083 @SuppressWarnings("JavaReflectionMemberAccess")
-084 public BukkitCommandManager(Plugin plugin) {
-085 this.plugin = plugin;
-086 this.logger = Logger.getLogger(this.plugin.getName());
-087 this.timingManager = TimingManager.of(plugin);
-088 this.commandTiming = this.timingManager.of("Commands");
-089 this.commandMap = hookCommandMap();
-090 this.formatters.put(MessageType.ERROR, defaultFormatter = new BukkitMessageFormatter(ChatColor.RED, ChatColor.YELLOW, ChatColor.RED));
-091 this.formatters.put(MessageType.SYNTAX, new BukkitMessageFormatter(ChatColor.YELLOW, ChatColor.GREEN, ChatColor.WHITE));
-092 this.formatters.put(MessageType.INFO, new BukkitMessageFormatter(ChatColor.BLUE, ChatColor.DARK_GREEN, ChatColor.GREEN));
-093 this.formatters.put(MessageType.HELP, new BukkitMessageFormatter(ChatColor.AQUA, ChatColor.GREEN, ChatColor.YELLOW));
-094
-095 Bukkit.getPluginManager().registerEvents(new ACFBukkitListener(this, plugin), plugin);
-096
-097 getLocales(); // auto load locales
-098 this.localeTask = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
-099 if (this.cantReadLocale || !this.autoDetectFromClient) {
-100 return;
-101 }
-102 Bukkit.getOnlinePlayers().forEach(this::readPlayerLocale);
-103 }, 5, 5);
-104
-105 registerDependency(plugin.getClass(), plugin);
-106 registerDependency(Plugin.class, plugin);
-107 registerDependency(JavaPlugin.class, plugin);
-108 registerDependency(PluginManager.class, Bukkit.getPluginManager());
-109 registerDependency(Server.class, Bukkit.getServer());
-110 registerDependency(BukkitScheduler.class, Bukkit.getScheduler());
-111 registerDependency(ScoreboardManager.class, Bukkit.getScoreboardManager());
-112 registerDependency(ItemFactory.class, Bukkit.getItemFactory());
-113 }
-114
-115 @NotNull private CommandMap hookCommandMap() {
-116 CommandMap commandMap = null;
-117 try {
-118 Server server = Bukkit.getServer();
-119 Method getCommandMap = server.getClass().getDeclaredMethod("getCommandMap");
-120 getCommandMap.setAccessible(true);
-121 commandMap = (CommandMap) getCommandMap.invoke(server);
-122 if (!SimpleCommandMap.class.isAssignableFrom(commandMap.getClass())) {
-123 this.log(LogLevel.ERROR, "ERROR: CommandMap has been hijacked! Offending command map is located at: " + commandMap.getClass().getName());
-124 this.log(LogLevel.ERROR, "We are going to try to hijack it back and resolve this, but you are now in dangerous territory.");
-125 this.log(LogLevel.ERROR, "We can not guarantee things are going to work.");
-126 Field cmField = server.getClass().getDeclaredField("commandMap");
-127 commandMap = new ProxyCommandMap(this, commandMap);
-128 cmField.set(server, commandMap);
-129 this.log(LogLevel.INFO, "Injected Proxy Command Map... good luck...");
-130 }
-131 Field knownCommands = SimpleCommandMap.class.getDeclaredField("knownCommands");
-132 knownCommands.setAccessible(true);
-133 //noinspection unchecked
-134 this.knownCommands = (Map<String, Command>) knownCommands.get(commandMap);
-135 } catch (Exception e) {
-136 this.log(LogLevel.ERROR, "Failed to get Command Map. ACF will not function.");
-137 ACFUtil.sneaky(e);
-138 }
-139 return commandMap;
-140 }
-141
-142 public Plugin getPlugin() {
-143 return this.plugin;
-144 }
-145
-146 @Override
-147 public boolean isCommandIssuer(Class<?> type) {
-148 return CommandSender.class.isAssignableFrom(type);
-149 }
-150
-151 @Override
-152 public synchronized CommandContexts<BukkitCommandExecutionContext> getCommandContexts() {
-153 if (this.contexts == null) {
-154 this.contexts = new BukkitCommandContexts(this);
-155 }
-156 return contexts;
-157 }
-158
-159 @Override
-160 public synchronized CommandCompletions<BukkitCommandCompletionContext> getCommandCompletions() {
-161 if (this.completions == null) {
-162 this.completions = new BukkitCommandCompletions(this);
-163 }
-164 return completions;
-165 }
+049import java.util.HashMap;
+050import java.util.List;
+051import java.util.Locale;
+052import java.util.Map;
+053import java.util.Objects;
+054import java.util.logging.Level;
+055import java.util.logging.Logger;
+056
+057@SuppressWarnings("WeakerAccess")
+058public class BukkitCommandManager extends CommandManager<
+059 CommandSender,
+060 BukkitCommandIssuer,
+061 ChatColor,
+062 BukkitMessageFormatter,
+063 BukkitCommandExecutionContext,
+064 BukkitConditionContext
+065 > {
+066
+067 @SuppressWarnings("WeakerAccess")
+068 protected final Plugin plugin;
+069 private final CommandMap commandMap;
+070 private final TimingManager timingManager;
+071 private final BukkitTask localeTask;
+072 private final Logger logger;
+073 protected Map<String, Command> knownCommands = new HashMap<>();
+074 protected Map<String, BukkitRootCommand> registeredCommands = new HashMap<>();
+075 protected BukkitCommandContexts contexts;
+076 protected BukkitCommandCompletions completions;
+077 MCTiming commandTiming;
+078 protected BukkitLocales locales;
+079 private boolean cantReadLocale = false;
+080 protected boolean autoDetectFromClient = true;
+081
+082 @SuppressWarnings("JavaReflectionMemberAccess")
+083 public BukkitCommandManager(Plugin plugin) {
+084 this.plugin = plugin;
+085 this.logger = Logger.getLogger(this.plugin.getName());
+086 this.timingManager = TimingManager.of(plugin);
+087 this.commandTiming = this.timingManager.of("Commands");
+088 this.commandMap = hookCommandMap();
+089 this.formatters.put(MessageType.ERROR, defaultFormatter = new BukkitMessageFormatter(ChatColor.RED, ChatColor.YELLOW, ChatColor.RED));
+090 this.formatters.put(MessageType.SYNTAX, new BukkitMessageFormatter(ChatColor.YELLOW, ChatColor.GREEN, ChatColor.WHITE));
+091 this.formatters.put(MessageType.INFO, new BukkitMessageFormatter(ChatColor.BLUE, ChatColor.DARK_GREEN, ChatColor.GREEN));
+092 this.formatters.put(MessageType.HELP, new BukkitMessageFormatter(ChatColor.AQUA, ChatColor.GREEN, ChatColor.YELLOW));
+093
+094 Bukkit.getPluginManager().registerEvents(new ACFBukkitListener(this, plugin), plugin);
+095
+096 getLocales(); // auto load locales
+097 this.localeTask = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
+098 if (this.cantReadLocale || !this.autoDetectFromClient) {
+099 return;
+100 }
+101 Bukkit.getOnlinePlayers().forEach(this::readPlayerLocale);
+102 }, 5, 5);
+103
+104 registerDependency(plugin.getClass(), plugin);
+105 registerDependency(Plugin.class, plugin);
+106 registerDependency(JavaPlugin.class, plugin);
+107 registerDependency(PluginManager.class, Bukkit.getPluginManager());
+108 registerDependency(Server.class, Bukkit.getServer());
+109 registerDependency(BukkitScheduler.class, Bukkit.getScheduler());
+110 registerDependency(ScoreboardManager.class, Bukkit.getScoreboardManager());
+111 registerDependency(ItemFactory.class, Bukkit.getItemFactory());
+112 }
+113
+114 @NotNull private CommandMap hookCommandMap() {
+115 CommandMap commandMap = null;
+116 try {
+117 Server server = Bukkit.getServer();
+118 Method getCommandMap = server.getClass().getDeclaredMethod("getCommandMap");
+119 getCommandMap.setAccessible(true);
+120 commandMap = (CommandMap) getCommandMap.invoke(server);
+121 if (!SimpleCommandMap.class.isAssignableFrom(commandMap.getClass())) {
+122 this.log(LogLevel.ERROR, "ERROR: CommandMap has been hijacked! Offending command map is located at: " + commandMap.getClass().getName());
+123 this.log(LogLevel.ERROR, "We are going to try to hijack it back and resolve this, but you are now in dangerous territory.");
+124 this.log(LogLevel.ERROR, "We can not guarantee things are going to work.");
+125 Field cmField = server.getClass().getDeclaredField("commandMap");
+126 commandMap = new ProxyCommandMap(this, commandMap);
+127 cmField.set(server, commandMap);
+128 this.log(LogLevel.INFO, "Injected Proxy Command Map... good luck...");
+129 }
+130 Field knownCommands = SimpleCommandMap.class.getDeclaredField("knownCommands");
+131 knownCommands.setAccessible(true);
+132 //noinspection unchecked
+133 this.knownCommands = (Map<String, Command>) knownCommands.get(commandMap);
+134 } catch (Exception e) {
+135 this.log(LogLevel.ERROR, "Failed to get Command Map. ACF will not function.");
+136 ACFUtil.sneaky(e);
+137 }
+138 return commandMap;
+139 }
+140
+141 public Plugin getPlugin() {
+142 return this.plugin;
+143 }
+144
+145 @Override
+146 public boolean isCommandIssuer(Class<?> type) {
+147 return CommandSender.class.isAssignableFrom(type);
+148 }
+149
+150 @Override
+151 public synchronized CommandContexts<BukkitCommandExecutionContext> getCommandContexts() {
+152 if (this.contexts == null) {
+153 this.contexts = new BukkitCommandContexts(this);
+154 }
+155 return contexts;
+156 }
+157
+158 @Override
+159 public synchronized CommandCompletions<BukkitCommandCompletionContext> getCommandCompletions() {
+160 if (this.completions == null) {
+161 this.completions = new BukkitCommandCompletions(this);
+162 }
+163 return completions;
+164 }
+165
166
-167
-168 @Override
-169 public BukkitLocales getLocales() {
-170 if (this.locales == null) {
-171 this.locales = new BukkitLocales(this);
-172 this.locales.loadLanguages();
-173 }
-174 return locales;
-175 }
+167 @Override
+168 public BukkitLocales getLocales() {
+169 if (this.locales == null) {
+170 this.locales = new BukkitLocales(this);
+171 this.locales.loadLanguages();
+172 }
+173 return locales;
+174 }
+175
176
-177
-178 @Override
-179 public boolean hasRegisteredCommands() {
-180 return !registeredCommands.isEmpty();
-181 }
-182
-183 public void registerCommand(BaseCommand command, boolean force) {
-184 final String plugin = this.plugin.getName().toLowerCase();
-185 command.onRegister(this);
-186 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) {
-187 String commandName = entry.getKey().toLowerCase();
-188 BukkitRootCommand bukkitCommand = (BukkitRootCommand) entry.getValue();
-189 if (!bukkitCommand.isRegistered) {
-190 Command oldCommand = commandMap.getCommand(commandName);
-191 if (oldCommand instanceof PluginIdentifiableCommand && ((PluginIdentifiableCommand) oldCommand).getPlugin() == this.plugin) {
-192 knownCommands.remove(commandName);
-193 oldCommand.unregister(commandMap);
-194 } else if (oldCommand != null && force) {
-195 knownCommands.remove(commandName);
-196 for (Map.Entry<String, Command> ce : knownCommands.entrySet()) {
-197 String key = ce.getKey();
-198 Command value = ce.getValue();
-199 if (key.contains(":") && oldCommand.equals(value)) {
-200 String[] split = ACFPatterns.COLON.split(key, 2);
-201 if (split.length > 1) {
-202 oldCommand.unregister(commandMap);
-203 oldCommand.setLabel(split[0] + ":" + command.getName());
-204 oldCommand.register(commandMap);
-205 }
-206 }
-207 }
-208 }
-209 commandMap.register(commandName, plugin, bukkitCommand);
-210 }
-211 bukkitCommand.isRegistered = true;
-212 registeredCommands.put(commandName, bukkitCommand);
-213 }
-214 }
-215
-216 @Override
-217 public void registerCommand(BaseCommand command) {
-218 registerCommand(command, false);
-219 }
-220
-221 public void unregisterCommand(BaseCommand command) {
-222 for (RootCommand rootcommand : command.registeredCommands.values()) {
-223 BukkitRootCommand bukkitCommand = (BukkitRootCommand) rootcommand;
-224 bukkitCommand.getSubCommands().values().removeAll(command.subCommands.values());
-225 if (bukkitCommand.isRegistered && bukkitCommand.getSubCommands().isEmpty()) {
-226 unregisterCommand(bukkitCommand);
-227 bukkitCommand.isRegistered = false;
-228 }
-229 }
-230 }
-231
-232 /**
-233 * @deprecated Use unregisterCommand(BaseCommand) - this will be visibility reduced later.
-234 * @param command
-235 */
-236 @Deprecated
-237 public void unregisterCommand(BukkitRootCommand command) {
-238 final String plugin = this.plugin.getName().toLowerCase();
-239 command.unregister(commandMap);
-240 String key = command.getName();
-241 Command registered = knownCommands.get(key);
-242 if (command.equals(registered)) {
-243 knownCommands.remove(key);
-244 }
-245 knownCommands.remove(plugin + ":" + key);
-246 }
-247
-248 public void unregisterCommands() {
-249 for (Map.Entry<String, BukkitRootCommand> entry : registeredCommands.entrySet()) {
-250 unregisterCommand(entry.getValue());
-251 }
-252 this.registeredCommands.clear();
-253 }
+177 @Override
+178 public boolean hasRegisteredCommands() {
+179 return !registeredCommands.isEmpty();
+180 }
+181
+182 public void registerCommand(BaseCommand command, boolean force) {
+183 final String plugin = this.plugin.getName().toLowerCase();
+184 command.onRegister(this);
+185 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) {
+186 String commandName = entry.getKey().toLowerCase();
+187 BukkitRootCommand bukkitCommand = (BukkitRootCommand) entry.getValue();
+188 if (!bukkitCommand.isRegistered) {
+189 Command oldCommand = commandMap.getCommand(commandName);
+190 if (oldCommand instanceof PluginIdentifiableCommand && ((PluginIdentifiableCommand) oldCommand).getPlugin() == this.plugin) {
+191 knownCommands.remove(commandName);
+192 oldCommand.unregister(commandMap);
+193 } else if (oldCommand != null && force) {
+194 knownCommands.remove(commandName);
+195 for (Map.Entry<String, Command> ce : knownCommands.entrySet()) {
+196 String key = ce.getKey();
+197 Command value = ce.getValue();
+198 if (key.contains(":") && oldCommand.equals(value)) {
+199 String[] split = ACFPatterns.COLON.split(key, 2);
+200 if (split.length > 1) {
+201 oldCommand.unregister(commandMap);
+202 oldCommand.setLabel(split[0] + ":" + command.getName());
+203 oldCommand.register(commandMap);
+204 }
+205 }
+206 }
+207 }
+208 commandMap.register(commandName, plugin, bukkitCommand);
+209 }
+210 bukkitCommand.isRegistered = true;
+211 registeredCommands.put(commandName, bukkitCommand);
+212 }
+213 }
+214
+215 @Override
+216 public void registerCommand(BaseCommand command) {
+217 registerCommand(command, false);
+218 }
+219
+220 public void unregisterCommand(BaseCommand command) {
+221 for (RootCommand rootcommand : command.registeredCommands.values()) {
+222 BukkitRootCommand bukkitCommand = (BukkitRootCommand) rootcommand;
+223 bukkitCommand.getSubCommands().values().removeAll(command.subCommands.values());
+224 if (bukkitCommand.isRegistered && bukkitCommand.getSubCommands().isEmpty()) {
+225 unregisterCommand(bukkitCommand);
+226 bukkitCommand.isRegistered = false;
+227 }
+228 }
+229 }
+230
+231 /**
+232 * @deprecated Use unregisterCommand(BaseCommand) - this will be visibility reduced later.
+233 * @param command
+234 */
+235 @Deprecated
+236 public void unregisterCommand(BukkitRootCommand command) {
+237 final String plugin = this.plugin.getName().toLowerCase();
+238 command.unregister(commandMap);
+239 String key = command.getName();
+240 Command registered = knownCommands.get(key);
+241 if (command.equals(registered)) {
+242 knownCommands.remove(key);
+243 }
+244 knownCommands.remove(plugin + ":" + key);
+245 }
+246
+247 public void unregisterCommands() {
+248 for (Map.Entry<String, BukkitRootCommand> entry : registeredCommands.entrySet()) {
+249 unregisterCommand(entry.getValue());
+250 }
+251 this.registeredCommands.clear();
+252 }
+253
254
-255
-256 private Field getEntityField(Player player) throws NoSuchFieldException {
-257 Class cls = player.getClass();
-258 while (cls != Object.class) {
-259 if (cls.getName().endsWith("CraftEntity")) {
-260 Field field = cls.getDeclaredField("entity");
-261 field.setAccessible(true);
-262 return field;
-263 }
-264 cls = cls.getSuperclass();
-265 }
-266 return null;
-267 }
-268
-269 public Locale setPlayerLocale(Player player, Locale locale) {
-270 return this.setIssuerLocale(player, locale);
-271 }
-272
-273 void readPlayerLocale(Player player) {
-274 if (!player.isOnline() || cantReadLocale) {
-275 return;
-276 }
-277 try {
-278 Field entityField = getEntityField(player);
-279 if (entityField == null) {
-280 return;
-281 }
-282 Object nmsPlayer = entityField.get(player);
-283 if (nmsPlayer != null) {
-284 Field localeField = nmsPlayer.getClass().getField("locale");
-285 Object localeString = localeField.get(nmsPlayer);
-286 if (localeString instanceof String) {
-287 String[] split = ACFPatterns.UNDERSCORE.split((String) localeString);
-288 Locale locale = split.length > 1 ? new Locale(split[0], split[1]) : new Locale(split[0]);
-289 Locale prev = issuersLocale.put(player.getUniqueId(), locale);
-290 if (!Objects.equals(locale, prev)) {
-291 this.notifyLocaleChange(getCommandIssuer(player), prev, locale);
-292 }
-293 }
-294 }
-295 } catch (Exception e) {
-296 cantReadLocale = true;
-297 this.localeTask.cancel();
-298 this.log(LogLevel.INFO, "Can't read players locale, you will be unable to automatically detect players language. Only Bukkit 1.7+ is supported for this.", e);
-299 }
-300 }
-301
-302 public TimingManager getTimings() {
-303 return timingManager;
-304 }
-305
-306 @Override
-307 public RootCommand createRootCommand(String cmd) {
-308 return new BukkitRootCommand(this, cmd);
-309 }
-310
-311 @Override
-312 public BukkitCommandIssuer getCommandIssuer(Object issuer) {
-313 if (!(issuer instanceof CommandSender)) {
-314 throw new IllegalArgumentException(issuer.getClass().getName() + " is not a Command Issuer.");
-315 }
-316 return new BukkitCommandIssuer(this, (CommandSender) issuer);
-317 }
-318
-319 @Override
-320 public BukkitCommandExecutionContext createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs) {
-321 return new BukkitCommandExecutionContext(command, parameter, (BukkitCommandIssuer) sender, args, i, passedArgs);
-322 }
-323
-324 @Override
-325 public BukkitCommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args) {
-326 return new BukkitCommandCompletionContext(command, (BukkitCommandIssuer) sender, input, config, args);
-327 }
-328
-329 @Override
-330 public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) {
-331 return new BukkitRegisteredCommand(command, cmdName, method, prefSubCommand);
-332 }
-333
-334 @Override
-335 public BukkitConditionContext createConditionContext(CommandIssuer issuer, String config) {
-336 return new BukkitConditionContext((BukkitCommandIssuer) issuer, config);
-337 }
+255 private Field getEntityField(Player player) throws NoSuchFieldException {
+256 Class cls = player.getClass();
+257 while (cls != Object.class) {
+258 if (cls.getName().endsWith("CraftEntity")) {
+259 Field field = cls.getDeclaredField("entity");
+260 field.setAccessible(true);
+261 return field;
+262 }
+263 cls = cls.getSuperclass();
+264 }
+265 return null;
+266 }
+267
+268 public Locale setPlayerLocale(Player player, Locale locale) {
+269 return this.setIssuerLocale(player, locale);
+270 }
+271
+272 void readPlayerLocale(Player player) {
+273 if (!player.isOnline() || cantReadLocale) {
+274 return;
+275 }
+276 try {
+277 Field entityField = getEntityField(player);
+278 if (entityField == null) {
+279 return;
+280 }
+281 Object nmsPlayer = entityField.get(player);
+282 if (nmsPlayer != null) {
+283 Field localeField = nmsPlayer.getClass().getField("locale");
+284 Object localeString = localeField.get(nmsPlayer);
+285 if (localeString instanceof String) {
+286 String[] split = ACFPatterns.UNDERSCORE.split((String) localeString);
+287 Locale locale = split.length > 1 ? new Locale(split[0], split[1]) : new Locale(split[0]);
+288 Locale prev = issuersLocale.put(player.getUniqueId(), locale);
+289 if (!Objects.equals(locale, prev)) {
+290 this.notifyLocaleChange(getCommandIssuer(player), prev, locale);
+291 }
+292 }
+293 }
+294 } catch (Exception e) {
+295 cantReadLocale = true;
+296 this.localeTask.cancel();
+297 this.log(LogLevel.INFO, "Can't read players locale, you will be unable to automatically detect players language. Only Bukkit 1.7+ is supported for this.", e);
+298 }
+299 }
+300
+301 public TimingManager getTimings() {
+302 return timingManager;
+303 }
+304
+305 @Override
+306 public RootCommand createRootCommand(String cmd) {
+307 return new BukkitRootCommand(this, cmd);
+308 }
+309
+310 @Override
+311 public BukkitCommandIssuer getCommandIssuer(Object issuer) {
+312 if (!(issuer instanceof CommandSender)) {
+313 throw new IllegalArgumentException(issuer.getClass().getName() + " is not a Command Issuer.");
+314 }
+315 return new BukkitCommandIssuer(this, (CommandSender) issuer);
+316 }
+317
+318 @Override
+319 public BukkitCommandExecutionContext createCommandContext(RegisteredCommand command, CommandParameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs) {
+320 return new BukkitCommandExecutionContext(command, parameter, (BukkitCommandIssuer) sender, args, i, passedArgs);
+321 }
+322
+323 @Override
+324 public BukkitCommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args) {
+325 return new BukkitCommandCompletionContext(command, (BukkitCommandIssuer) sender, input, config, args);
+326 }
+327
+328 @Override
+329 public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) {
+330 return new BukkitRegisteredCommand(command, cmdName, method, prefSubCommand);
+331 }
+332
+333 @Override
+334 public BukkitConditionContext createConditionContext(CommandIssuer issuer, String config) {
+335 return new BukkitConditionContext((BukkitCommandIssuer) issuer, config);
+336 }
+337
338
-339
-340 @Override
-341 public void log(LogLevel level, String message, Throwable throwable) {
-342 Level logLevel = level == LogLevel.INFO ? Level.INFO : Level.SEVERE;
-343 logger.log(logLevel, LogLevel.LOG_PREFIX + message);
-344 if (throwable != null) {
-345 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) {
-346 logger.log(logLevel, LogLevel.LOG_PREFIX + line);
-347 }
-348 }
-349 }
-350
-351 public boolean usePerIssuerLocale(boolean usePerIssuerLocale, boolean autoDetectFromClient) {
-352 boolean old = this.usePerIssuerLocale;
-353 this.usePerIssuerLocale = usePerIssuerLocale;
-354 this.autoDetectFromClient = autoDetectFromClient;
-355 return old;
-356 }
-357}
+339 @Override
+340 public void log(LogLevel level, String message, Throwable throwable) {
+341 Level logLevel = level == LogLevel.INFO ? Level.INFO : Level.SEVERE;
+342 logger.log(logLevel, LogLevel.LOG_PREFIX + message);
+343 if (throwable != null) {
+344 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) {
+345 logger.log(logLevel, LogLevel.LOG_PREFIX + line);
+346 }
+347 }
+348 }
+349
+350 public boolean usePerIssuerLocale(boolean usePerIssuerLocale, boolean autoDetectFromClient) {
+351 boolean old = this.usePerIssuerLocale;
+352 this.usePerIssuerLocale = usePerIssuerLocale;
+353 this.autoDetectFromClient = autoDetectFromClient;
+354 return old;
+355 }
+356}
diff --git a/docs/acf-bungee/co/aikar/commands/BungeeCommandManager.html b/docs/acf-bungee/co/aikar/commands/BungeeCommandManager.html
index 6efbe4cb..e7b1e2b7 100644
--- a/docs/acf-bungee/co/aikar/commands/BungeeCommandManager.html
+++ b/docs/acf-bungee/co/aikar/commands/BungeeCommandManager.html
@@ -113,7 +113,7 @@ var activeTableTab = "activeTableTab";
-
-public class BungeeCommandManager
+public class BungeeCommandManager
extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>
@@ -194,8 +194,8 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
BungeeCommandExecutionContext
-createCommandContext(co.aikar.commands.RegisteredCommand command,
- Parameter parameter,
+createCommandContext(co.aikar.commands.RegisteredCommand command,
+ co.aikar.commands.CommandParameter parameter,
co.aikar.commands.CommandIssuer sender,
List<String> args,
int i,
@@ -314,7 +314,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
plugin
-protected final net.md_5.bungee.api.plugin.Plugin plugin
+protected final net.md_5.bungee.api.plugin.Plugin plugin
@@ -323,7 +323,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
registeredCommands
-protected Map<String,BungeeRootCommand> registeredCommands
+protected Map<String,BungeeRootCommand> registeredCommands
@@ -332,7 +332,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
contexts
-protected BungeeCommandContexts contexts
+protected BungeeCommandContexts contexts
@@ -341,7 +341,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
completions
-protected BungeeCommandCompletions completions
+protected BungeeCommandCompletions completions
@@ -350,7 +350,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
locales
-protected BungeeLocales locales
+protected BungeeLocales locales
@@ -367,7 +367,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
BungeeCommandManager
-public BungeeCommandManager(net.md_5.bungee.api.plugin.Plugin plugin)
+public BungeeCommandManager(net.md_5.bungee.api.plugin.Plugin plugin)
@@ -384,7 +384,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
getPlugin
-public net.md_5.bungee.api.plugin.Plugin getPlugin()
+public net.md_5.bungee.api.plugin.Plugin getPlugin()
@@ -393,7 +393,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
getCommandContexts
-public co.aikar.commands.CommandContexts<BungeeCommandExecutionContext> getCommandContexts()
+public co.aikar.commands.CommandContexts<BungeeCommandExecutionContext> getCommandContexts()
- Specified by:
getCommandContexts in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>
@@ -406,7 +406,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
getCommandCompletions
-public co.aikar.commands.CommandCompletions<BungeeCommandCompletionContext> getCommandCompletions()
+public co.aikar.commands.CommandCompletions<BungeeCommandCompletionContext> getCommandCompletions()
- Specified by:
getCommandCompletions in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>
@@ -419,7 +419,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
getLocales
-public BungeeLocales getLocales()
+public BungeeLocales getLocales()
- Specified by:
getLocales in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>
@@ -432,7 +432,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
readLocale
-public void readLocale(net.md_5.bungee.api.connection.ProxiedPlayer player)
+public void readLocale(net.md_5.bungee.api.connection.ProxiedPlayer player)
@@ -441,7 +441,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
registerCommand
-public void registerCommand(co.aikar.commands.BaseCommand command)
+public void registerCommand(co.aikar.commands.BaseCommand command)
- Specified by:
registerCommand in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>
@@ -454,7 +454,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
unregisterCommand
-public void unregisterCommand(co.aikar.commands.BaseCommand command)
+public void unregisterCommand(co.aikar.commands.BaseCommand command)
@@ -463,7 +463,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
unregisterCommand
-public void unregisterCommand(BungeeRootCommand command)
+public void unregisterCommand(BungeeRootCommand command)
@@ -472,7 +472,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
unregisterCommands
-public void unregisterCommands()
+public void unregisterCommands()
@@ -481,7 +481,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
hasRegisteredCommands
-public boolean hasRegisteredCommands()
+public boolean hasRegisteredCommands()
- Specified by:
hasRegisteredCommands in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>
@@ -494,7 +494,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
isCommandIssuer
-public boolean isCommandIssuer(Class<?> aClass)
+public boolean isCommandIssuer(Class<?> aClass)
- Specified by:
isCommandIssuer in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>
@@ -507,7 +507,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
getCommandIssuer
-public BungeeCommandIssuer getCommandIssuer(Object issuer)
+public BungeeCommandIssuer getCommandIssuer(Object issuer)
- Specified by:
getCommandIssuer in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>
@@ -520,21 +520,21 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
createRootCommand
-public co.aikar.commands.RootCommand createRootCommand(String cmd)
+public co.aikar.commands.RootCommand createRootCommand(String cmd)
- Specified by:
createRootCommand in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>
-
+
-
createCommandContext
-public BungeeCommandExecutionContext createCommandContext(co.aikar.commands.RegisteredCommand command,
- Parameter parameter,
+public BungeeCommandExecutionContext createCommandContext(co.aikar.commands.RegisteredCommand command,
+ co.aikar.commands.CommandParameter parameter,
co.aikar.commands.CommandIssuer sender,
List<String> args,
int i,
@@ -551,7 +551,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
createCompletionContext
-public co.aikar.commands.CommandCompletionContext createCompletionContext(co.aikar.commands.RegisteredCommand command,
+public co.aikar.commands.CommandCompletionContext createCompletionContext(co.aikar.commands.RegisteredCommand command,
co.aikar.commands.CommandIssuer sender,
String input,
String config,
@@ -568,7 +568,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
createRegisteredCommand
-public co.aikar.commands.RegisteredCommand createRegisteredCommand(co.aikar.commands.BaseCommand command,
+public co.aikar.commands.RegisteredCommand createRegisteredCommand(co.aikar.commands.BaseCommand command,
String cmdName,
Method method,
String prefSubCommand)
@@ -584,7 +584,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
createConditionContext
-public BungeeConditionContext createConditionContext(co.aikar.commands.CommandIssuer issuer,
+public BungeeConditionContext createConditionContext(co.aikar.commands.CommandIssuer issuer,
String config)
- Overrides:
@@ -598,7 +598,7 @@ extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,
-
log
-public void log(co.aikar.commands.LogLevel level,
+public void log(co.aikar.commands.LogLevel level,
String message,
Throwable throwable)
diff --git a/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandExecutionContext.html b/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandExecutionContext.html
index 3196400d..26373de1 100644
--- a/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandExecutionContext.html
+++ b/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandExecutionContext.html
@@ -103,8 +103,8 @@
BungeeCommandExecutionContext
-BungeeCommandManager.createCommandContext(co.aikar.commands.RegisteredCommand command,
- Parameter parameter,
+BungeeCommandManager.createCommandContext(co.aikar.commands.RegisteredCommand command,
+ co.aikar.commands.CommandParameter parameter,
co.aikar.commands.CommandIssuer sender,
List<String> args,
int i,
diff --git a/docs/acf-bungee/index-all.html b/docs/acf-bungee/index-all.html
index ded8a430..e20bbc5f 100644
--- a/docs/acf-bungee/index-all.html
+++ b/docs/acf-bungee/index-all.html
@@ -137,7 +137,7 @@
-
- contexts - Variable in class co.aikar.commands.BungeeCommandManager
-
-- createCommandContext(RegisteredCommand, Parameter, CommandIssuer, List<String>, int, Map<String, Object>) - Method in class co.aikar.commands.BungeeCommandManager
+- createCommandContext(RegisteredCommand, CommandParameter, CommandIssuer, List<String>, int, Map<String, Object>) - Method in class co.aikar.commands.BungeeCommandManager
-
- createCompletionContext(RegisteredCommand, CommandIssuer, String, String, String[]) - Method in class co.aikar.commands.BungeeCommandManager
-
diff --git a/docs/acf-bungee/src-html/co/aikar/commands/BungeeCommandExecutionContext.html b/docs/acf-bungee/src-html/co/aikar/commands/BungeeCommandExecutionContext.html
index 1dcda4e9..26caad9a 100644
--- a/docs/acf-bungee/src-html/co/aikar/commands/BungeeCommandExecutionContext.html
+++ b/docs/acf-bungee/src-html/co/aikar/commands/BungeeCommandExecutionContext.html
@@ -40,7 +40,7 @@
032
033public class BungeeCommandExecutionContext extends CommandExecutionContext<BungeeCommandExecutionContext, BungeeCommandIssuer> {
034
-035 BungeeCommandExecutionContext(RegisteredCommand cmd, Parameter param, BungeeCommandIssuer sender, List<String> args, int index, Map<String, Object> passedArgs) {
+035 BungeeCommandExecutionContext(RegisteredCommand cmd, CommandParameter param, BungeeCommandIssuer sender, List<String> args, int index, Map<String, Object> passedArgs) {
036 super(cmd, param, sender, args, index, passedArgs);
037 }
038
diff --git a/docs/acf-bungee/src-html/co/aikar/commands/BungeeCommandManager.html b/docs/acf-bungee/src-html/co/aikar/commands/BungeeCommandManager.html
index 185bc19a..0116d84f 100644
--- a/docs/acf-bungee/src-html/co/aikar/commands/BungeeCommandManager.html
+++ b/docs/acf-bungee/src-html/co/aikar/commands/BungeeCommandManager.html
@@ -39,184 +39,183 @@
031import net.md_5.bungee.api.plugin.Plugin;
032
033import java.lang.reflect.Method;
-034import java.lang.reflect.Parameter;
-035import java.util.HashMap;
-036import java.util.List;
-037import java.util.Locale;
-038import java.util.Map;
-039import java.util.concurrent.TimeUnit;
-040import java.util.logging.Level;
-041import java.util.logging.Logger;
-042
-043public class BungeeCommandManager extends CommandManager<
-044 CommandSender,
-045 BungeeCommandIssuer,
-046 ChatColor,
-047 BungeeMessageFormatter,
-048 BungeeCommandExecutionContext,
-049 BungeeConditionContext
-050 > {
-051
-052 protected final Plugin plugin;
-053 protected Map<String, BungeeRootCommand> registeredCommands = new HashMap<>();
-054 protected BungeeCommandContexts contexts;
-055 protected BungeeCommandCompletions completions;
-056 protected BungeeLocales locales;
-057
-058 public BungeeCommandManager(Plugin plugin) {
-059 this.plugin = plugin;
-060 this.formatters.put(MessageType.ERROR, defaultFormatter = new BungeeMessageFormatter(ChatColor.RED, ChatColor.YELLOW, ChatColor.RED));
-061 this.formatters.put(MessageType.SYNTAX, new BungeeMessageFormatter(ChatColor.YELLOW, ChatColor.GREEN, ChatColor.WHITE));
-062 this.formatters.put(MessageType.INFO, new BungeeMessageFormatter(ChatColor.BLUE, ChatColor.DARK_GREEN, ChatColor.GREEN));
-063 this.formatters.put(MessageType.HELP, new BungeeMessageFormatter(ChatColor.AQUA, ChatColor.GREEN, ChatColor.YELLOW));
-064
-065 getLocales(); // auto load locales
-066
-067 plugin.getProxy().getPluginManager().registerListener(plugin, new ACFBungeeListener(this, plugin));
-068
-069 //BungeeCord has no event for listening for client setting changes
-070 plugin.getProxy().getScheduler().schedule(plugin, () -> {
-071 ProxyServer.getInstance().getPlayers().forEach(this::readLocale);
-072 }, 5, 5, TimeUnit.SECONDS);
-073
-074 // TODO more default dependencies for bungee
-075 registerDependency(plugin.getClass(), plugin);
-076 registerDependency(Plugin.class, plugin);
-077 }
-078
-079 public Plugin getPlugin() {
-080 return this.plugin;
-081 }
-082
-083 @Override
-084 public synchronized CommandContexts<BungeeCommandExecutionContext> getCommandContexts() {
-085 if (this.contexts == null) {
-086 this.contexts = new BungeeCommandContexts(this);
-087 }
-088 return contexts;
-089 }
-090
-091 @Override
-092 public synchronized CommandCompletions<BungeeCommandCompletionContext> getCommandCompletions() {
-093 if (this.completions == null) {
-094 this.completions = new BungeeCommandCompletions(this);
-095 }
-096 return completions;
-097 }
-098
-099 @Override
-100 public BungeeLocales getLocales() {
-101 if (this.locales == null) {
-102 this.locales = new BungeeLocales(this);
-103 this.locales.loadLanguages();
-104 }
-105 return locales;
-106 }
-107
-108 public void readLocale(ProxiedPlayer player) {
-109 if (!player.isConnected()) {
-110 return;
-111 }
-112
-113 //This can be null if we didn't received a settings packet
-114 Locale locale = player.getLocale();
-115 if (locale != null) {
-116 setIssuerLocale(player, player.getLocale());
-117 }
-118 }
-119
-120 @Override
-121 public void registerCommand(BaseCommand command) {
-122 command.onRegister(this);
-123 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) {
-124 String commandName = entry.getKey().toLowerCase();
-125 BungeeRootCommand bungeeCommand = (BungeeRootCommand) entry.getValue();
-126 if (!bungeeCommand.isRegistered) {
-127 this.plugin.getProxy().getPluginManager().registerCommand(this.plugin, bungeeCommand);
-128 }
-129 bungeeCommand.isRegistered = true;
-130 registeredCommands.put(commandName, bungeeCommand);
-131 }
-132 }
-133
-134 public void unregisterCommand(BaseCommand command) {
-135 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) {
-136 String commandName = entry.getKey().toLowerCase();
-137 BungeeRootCommand bungeeCommand = (BungeeRootCommand) entry.getValue();
-138 bungeeCommand.getSubCommands().values().removeAll(command.subCommands.values());
-139 if (bungeeCommand.getSubCommands().isEmpty() && bungeeCommand.isRegistered) {
-140 unregisterCommand(bungeeCommand);
-141 bungeeCommand.isRegistered = false;
-142 registeredCommands.remove(commandName);
-143 }
-144 }
-145 }
-146
-147 public void unregisterCommand(BungeeRootCommand command) {
-148 this.plugin.getProxy().getPluginManager().unregisterCommand(command);
-149 }
-150
-151 public void unregisterCommands() {
-152 for (Map.Entry<String, BungeeRootCommand> entry : registeredCommands.entrySet()) {
-153 unregisterCommand(entry.getValue());
-154 }
-155 }
-156
-157 @Override
-158 public boolean hasRegisteredCommands() {
-159 return !registeredCommands.isEmpty();
-160 }
-161
-162 @Override
-163 public boolean isCommandIssuer(Class<?> aClass) {
-164 return CommandSender.class.isAssignableFrom(aClass);
-165 }
-166
-167 @Override
-168 public BungeeCommandIssuer getCommandIssuer(Object issuer) {
-169 if (!(issuer instanceof CommandSender)) {
-170 throw new IllegalArgumentException(issuer.getClass().getName() + " is not a Command Issuer.");
-171 }
-172 return new BungeeCommandIssuer(this, (CommandSender) issuer);
-173 }
-174
-175 @Override
-176 public RootCommand createRootCommand(String cmd) {
-177 return new BungeeRootCommand(this, cmd);
-178 }
-179
-180 @Override
-181 public BungeeCommandExecutionContext createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs) {
-182 return new BungeeCommandExecutionContext(command, parameter, (BungeeCommandIssuer) sender, args, i, passedArgs);
-183 }
-184
-185 @Override
-186 public CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args) {
-187 return new BungeeCommandCompletionContext(command, (BungeeCommandIssuer) sender, input, config, args);
-188 }
-189
-190 @Override
-191 public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) {
-192 return new RegisteredCommand(command, cmdName, method, prefSubCommand);
-193 }
-194
-195 @Override
-196 public BungeeConditionContext createConditionContext(CommandIssuer issuer, String config) {
-197 return new BungeeConditionContext((BungeeCommandIssuer) issuer, config);
-198 }
-199
-200 @Override
-201 public void log(LogLevel level, String message, Throwable throwable) {
-202 Logger logger = this.plugin.getLogger();
-203 Level logLevel = level == LogLevel.INFO ? Level.INFO : Level.SEVERE;
-204 logger.log(logLevel, LogLevel.LOG_PREFIX + message);
-205 if (throwable != null) {
-206 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) {
-207 logger.log(logLevel, LogLevel.LOG_PREFIX + line);
-208 }
-209 }
-210 }
-211}
+034import java.util.HashMap;
+035import java.util.List;
+036import java.util.Locale;
+037import java.util.Map;
+038import java.util.concurrent.TimeUnit;
+039import java.util.logging.Level;
+040import java.util.logging.Logger;
+041
+042public class BungeeCommandManager extends CommandManager<
+043 CommandSender,
+044 BungeeCommandIssuer,
+045 ChatColor,
+046 BungeeMessageFormatter,
+047 BungeeCommandExecutionContext,
+048 BungeeConditionContext
+049 > {
+050
+051 protected final Plugin plugin;
+052 protected Map<String, BungeeRootCommand> registeredCommands = new HashMap<>();
+053 protected BungeeCommandContexts contexts;
+054 protected BungeeCommandCompletions completions;
+055 protected BungeeLocales locales;
+056
+057 public BungeeCommandManager(Plugin plugin) {
+058 this.plugin = plugin;
+059 this.formatters.put(MessageType.ERROR, defaultFormatter = new BungeeMessageFormatter(ChatColor.RED, ChatColor.YELLOW, ChatColor.RED));
+060 this.formatters.put(MessageType.SYNTAX, new BungeeMessageFormatter(ChatColor.YELLOW, ChatColor.GREEN, ChatColor.WHITE));
+061 this.formatters.put(MessageType.INFO, new BungeeMessageFormatter(ChatColor.BLUE, ChatColor.DARK_GREEN, ChatColor.GREEN));
+062 this.formatters.put(MessageType.HELP, new BungeeMessageFormatter(ChatColor.AQUA, ChatColor.GREEN, ChatColor.YELLOW));
+063
+064 getLocales(); // auto load locales
+065
+066 plugin.getProxy().getPluginManager().registerListener(plugin, new ACFBungeeListener(this, plugin));
+067
+068 //BungeeCord has no event for listening for client setting changes
+069 plugin.getProxy().getScheduler().schedule(plugin, () -> {
+070 ProxyServer.getInstance().getPlayers().forEach(this::readLocale);
+071 }, 5, 5, TimeUnit.SECONDS);
+072
+073 // TODO more default dependencies for bungee
+074 registerDependency(plugin.getClass(), plugin);
+075 registerDependency(Plugin.class, plugin);
+076 }
+077
+078 public Plugin getPlugin() {
+079 return this.plugin;
+080 }
+081
+082 @Override
+083 public synchronized CommandContexts<BungeeCommandExecutionContext> getCommandContexts() {
+084 if (this.contexts == null) {
+085 this.contexts = new BungeeCommandContexts(this);
+086 }
+087 return contexts;
+088 }
+089
+090 @Override
+091 public synchronized CommandCompletions<BungeeCommandCompletionContext> getCommandCompletions() {
+092 if (this.completions == null) {
+093 this.completions = new BungeeCommandCompletions(this);
+094 }
+095 return completions;
+096 }
+097
+098 @Override
+099 public BungeeLocales getLocales() {
+100 if (this.locales == null) {
+101 this.locales = new BungeeLocales(this);
+102 this.locales.loadLanguages();
+103 }
+104 return locales;
+105 }
+106
+107 public void readLocale(ProxiedPlayer player) {
+108 if (!player.isConnected()) {
+109 return;
+110 }
+111
+112 //This can be null if we didn't received a settings packet
+113 Locale locale = player.getLocale();
+114 if (locale != null) {
+115 setIssuerLocale(player, player.getLocale());
+116 }
+117 }
+118
+119 @Override
+120 public void registerCommand(BaseCommand command) {
+121 command.onRegister(this);
+122 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) {
+123 String commandName = entry.getKey().toLowerCase();
+124 BungeeRootCommand bungeeCommand = (BungeeRootCommand) entry.getValue();
+125 if (!bungeeCommand.isRegistered) {
+126 this.plugin.getProxy().getPluginManager().registerCommand(this.plugin, bungeeCommand);
+127 }
+128 bungeeCommand.isRegistered = true;
+129 registeredCommands.put(commandName, bungeeCommand);
+130 }
+131 }
+132
+133 public void unregisterCommand(BaseCommand command) {
+134 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) {
+135 String commandName = entry.getKey().toLowerCase();
+136 BungeeRootCommand bungeeCommand = (BungeeRootCommand) entry.getValue();
+137 bungeeCommand.getSubCommands().values().removeAll(command.subCommands.values());
+138 if (bungeeCommand.getSubCommands().isEmpty() && bungeeCommand.isRegistered) {
+139 unregisterCommand(bungeeCommand);
+140 bungeeCommand.isRegistered = false;
+141 registeredCommands.remove(commandName);
+142 }
+143 }
+144 }
+145
+146 public void unregisterCommand(BungeeRootCommand command) {
+147 this.plugin.getProxy().getPluginManager().unregisterCommand(command);
+148 }
+149
+150 public void unregisterCommands() {
+151 for (Map.Entry<String, BungeeRootCommand> entry : registeredCommands.entrySet()) {
+152 unregisterCommand(entry.getValue());
+153 }
+154 }
+155
+156 @Override
+157 public boolean hasRegisteredCommands() {
+158 return !registeredCommands.isEmpty();
+159 }
+160
+161 @Override
+162 public boolean isCommandIssuer(Class<?> aClass) {
+163 return CommandSender.class.isAssignableFrom(aClass);
+164 }
+165
+166 @Override
+167 public BungeeCommandIssuer getCommandIssuer(Object issuer) {
+168 if (!(issuer instanceof CommandSender)) {
+169 throw new IllegalArgumentException(issuer.getClass().getName() + " is not a Command Issuer.");
+170 }
+171 return new BungeeCommandIssuer(this, (CommandSender) issuer);
+172 }
+173
+174 @Override
+175 public RootCommand createRootCommand(String cmd) {
+176 return new BungeeRootCommand(this, cmd);
+177 }
+178
+179 @Override
+180 public BungeeCommandExecutionContext createCommandContext(RegisteredCommand command, CommandParameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs) {
+181 return new BungeeCommandExecutionContext(command, parameter, (BungeeCommandIssuer) sender, args, i, passedArgs);
+182 }
+183
+184 @Override
+185 public CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args) {
+186 return new BungeeCommandCompletionContext(command, (BungeeCommandIssuer) sender, input, config, args);
+187 }
+188
+189 @Override
+190 public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) {
+191 return new RegisteredCommand(command, cmdName, method, prefSubCommand);
+192 }
+193
+194 @Override
+195 public BungeeConditionContext createConditionContext(CommandIssuer issuer, String config) {
+196 return new BungeeConditionContext((BungeeCommandIssuer) issuer, config);
+197 }
+198
+199 @Override
+200 public void log(LogLevel level, String message, Throwable throwable) {
+201 Logger logger = this.plugin.getLogger();
+202 Level logLevel = level == LogLevel.INFO ? Level.INFO : Level.SEVERE;
+203 logger.log(logLevel, LogLevel.LOG_PREFIX + message);
+204 if (throwable != null) {
+205 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) {
+206 logger.log(logLevel, LogLevel.LOG_PREFIX + line);
+207 }
+208 }
+209 }
+210}
diff --git a/docs/acf-core/allclasses-frame.html b/docs/acf-core/allclasses-frame.html
index 8d5d498e..edb1899b 100644
--- a/docs/acf-core/allclasses-frame.html
+++ b/docs/acf-core/allclasses-frame.html
@@ -36,6 +36,7 @@
- CommandIssuer
- CommandManager
- CommandOperationContext
+- CommandParameter
- CommandPermission
- CommandReplacements
- ConditionContext
diff --git a/docs/acf-core/allclasses-noframe.html b/docs/acf-core/allclasses-noframe.html
index 0fe5a995..c654d8ac 100644
--- a/docs/acf-core/allclasses-noframe.html
+++ b/docs/acf-core/allclasses-noframe.html
@@ -36,6 +36,7 @@
- CommandIssuer
- CommandManager
- CommandOperationContext
+- CommandParameter
- CommandPermission
- CommandReplacements
- ConditionContext
diff --git a/docs/acf-core/co/aikar/commands/BaseCommand.html b/docs/acf-core/co/aikar/commands/BaseCommand.html
index 9f9b8212..eb95cd9b 100644
--- a/docs/acf-core/co/aikar/commands/BaseCommand.html
+++ b/docs/acf-core/co/aikar/commands/BaseCommand.html
@@ -505,7 +505,7 @@ extends
getCommandHelp
@Deprecated
-public CommandHelp getCommandHelp()
+public CommandHelp getCommandHelp()
Deprecated. Unstable API
@@ -516,7 +516,7 @@ public
showCommandHelp
@Deprecated
-public void showCommandHelp()
+public void showCommandHelp()
Deprecated. Unstable API
@@ -526,7 +526,7 @@ public void
-
help
-public void help(Object issuer,
+public void help(Object issuer,
String[] args)
@@ -536,7 +536,7 @@ public void
-
help
-public void help(CommandIssuer issuer,
+public void help(CommandIssuer issuer,
String[] args)
@@ -546,7 +546,7 @@ public void
-
doHelp
-public void doHelp(Object issuer,
+public void doHelp(Object issuer,
String... args)
@@ -556,7 +556,7 @@ public void
-
doHelp
-public void doHelp(CommandIssuer issuer,
+public void doHelp(CommandIssuer issuer,
String... args)
@@ -566,7 +566,7 @@ public void
-
showSyntax
-public void showSyntax(CommandIssuer issuer,
+public void showSyntax(CommandIssuer issuer,
RegisteredCommand<?> cmd)
@@ -576,7 +576,7 @@ public void
-
hasPermission
-public boolean hasPermission(Object issuer)
+public boolean hasPermission(Object issuer)
@@ -585,7 +585,7 @@ public void
-
hasPermission
-public boolean hasPermission(CommandIssuer issuer)
+public boolean hasPermission(CommandIssuer issuer)
@@ -594,7 +594,7 @@ public void
-
getRequiredPermissions
-public Set<String> getRequiredPermissions()
+public Set<String> getRequiredPermissions()
@@ -603,7 +603,7 @@ public void
-
requiresPermission
-public boolean requiresPermission(String permission)
+public boolean requiresPermission(String permission)
@@ -612,7 +612,7 @@ public void
-
getName
-public String getName()
+public String getName()
@@ -621,7 +621,7 @@ public void
-
getExceptionHandler
-public ExceptionHandler getExceptionHandler()
+public ExceptionHandler getExceptionHandler()
@@ -630,7 +630,7 @@ public void
-
setExceptionHandler
-public BaseCommand setExceptionHandler(ExceptionHandler exceptionHandler)
+public BaseCommand setExceptionHandler(ExceptionHandler exceptionHandler)
@@ -639,7 +639,7 @@ public void
-
getDefaultRegisteredCommand
-public RegisteredCommand getDefaultRegisteredCommand()
+public RegisteredCommand getDefaultRegisteredCommand()
@@ -648,7 +648,7 @@ public void
-
setContextFlags
-public String setContextFlags(Class<?> cls,
+public String setContextFlags(Class<?> cls,
String flags)
@@ -658,7 +658,7 @@ public void
-
getContextFlags
-public String getContextFlags(Class<?> cls)
+public String getContextFlags(Class<?> cls)
diff --git a/docs/acf-core/co/aikar/commands/CommandContexts.html b/docs/acf-core/co/aikar/commands/CommandContexts.html
index a46fcef8..70355c28 100644
--- a/docs/acf-core/co/aikar/commands/CommandContexts.html
+++ b/docs/acf-core/co/aikar/commands/CommandContexts.html
@@ -249,7 +249,7 @@ extends
registerSenderAwareContext
@Deprecated
-public <T> void registerSenderAwareContext(Class<T> context,
+public <T> void registerSenderAwareContext(Class<T> context,
IssuerAwareContextResolver<T,R> supplier)
Deprecated. Please switch to registerIssuerAwareContext(Class, IssuerAwareContextResolver)
as the core wants to use the platform agnostic term of "Issuer" instead of Sender
@@ -265,7 +265,7 @@ public <T> void
-
registerIssuerAwareContext
-public <T> void registerIssuerAwareContext(Class<T> context,
+public <T> void registerIssuerAwareContext(Class<T> context,
IssuerAwareContextResolver<T,R> supplier)
Registers a context resolver that may conditionally consume input, falling back to using the context of the
issuer to potentially fulfill this context.
@@ -279,7 +279,7 @@ public <T> void
-
registerIssuerOnlyContext
-public <T> void registerIssuerOnlyContext(Class<T> context,
+public <T> void registerIssuerOnlyContext(Class<T> context,
IssuerOnlyContextResolver<T,R> supplier)
Registers a context resolver that will never consume input. It will always satisfy its context based on the
issuer of the command, so it will not appear in syntax strings.
@@ -291,7 +291,7 @@ public <T> void
-
registerOptionalContext
-public <T> void registerOptionalContext(Class<T> context,
+public <T> void registerOptionalContext(Class<T> context,
OptionalContextResolver<T,R> supplier)
Registers a context that can safely accept a null input from the command issuer to resolve. This resolver should always
call CommandExecutionContext.popFirstArg()
@@ -303,7 +303,7 @@ public <T> void
-
registerContext
-public <T> void registerContext(Class<T> context,
+public <T> void registerContext(Class<T> context,
ContextResolver<T,R> supplier)
Registers a context that requires input from the command issuer to resolve. This resolver should always
call CommandExecutionContext.popFirstArg()
@@ -315,7 +315,7 @@ public <T> void
-
getResolver
-public ContextResolver<?,R> getResolver(Class<?> type)
+public ContextResolver<?,R> getResolver(Class<?> type)
diff --git a/docs/acf-core/co/aikar/commands/CommandExecutionContext.html b/docs/acf-core/co/aikar/commands/CommandExecutionContext.html
index a3912dbc..54bd39f3 100644
--- a/docs/acf-core/co/aikar/commands/CommandExecutionContext.html
+++ b/docs/acf-core/co/aikar/commands/CommandExecutionContext.html
@@ -108,7 +108,7 @@ var activeTableTab = "activeTableTab";
-
-public class CommandExecutionContext<CEC extends CommandExecutionContext,I extends CommandIssuer>
+public class CommandExecutionContext<CEC extends CommandExecutionContext,I extends CommandIssuer>
extends Object
@@ -278,7 +278,7 @@ extends
-
issuer
-protected final I extends CommandIssuer issuer
+protected final I extends CommandIssuer issuer
@@ -295,7 +295,7 @@ extends
-
popFirstArg
-public String popFirstArg()
+public String popFirstArg()
@@ -304,7 +304,7 @@ extends
-
popLastArg
-public String popLastArg()
+public String popLastArg()
@@ -313,7 +313,7 @@ extends
-
getFirstArg
-public String getFirstArg()
+public String getFirstArg()
@@ -322,7 +322,7 @@ extends
-
getLastArg
-public String getLastArg()
+public String getLastArg()
@@ -331,7 +331,7 @@ extends
-
isLastArg
-public boolean isLastArg()
+public boolean isLastArg()
@@ -340,7 +340,7 @@ extends
-
getNumParams
-public int getNumParams()
+public int getNumParams()
@@ -349,7 +349,7 @@ extends
-
canOverridePlayerContext
-public boolean canOverridePlayerContext()
+public boolean canOverridePlayerContext()
@@ -358,7 +358,7 @@ extends
-
getResolvedArg
-public Object getResolvedArg(String arg)
+public Object getResolvedArg(String arg)
@@ -367,7 +367,7 @@ extends
-
getResolvedArg
-public Object getResolvedArg(Class<?>... classes)
+public Object getResolvedArg(Class<?>... classes)
@@ -376,7 +376,7 @@ extends
-
getResolvedArg
-public <T> T getResolvedArg(String key,
+public <T> T getResolvedArg(String key,
Class<?>... classes)
@@ -386,7 +386,7 @@ extends
-
isOptional
-public boolean isOptional()
+public boolean isOptional()
@@ -395,7 +395,7 @@ extends
-
hasFlag
-public boolean hasFlag(String flag)
+public boolean hasFlag(String flag)
@@ -404,7 +404,7 @@ extends
-
getFlagValue
-public String getFlagValue(String flag,
+public String getFlagValue(String flag,
String def)
@@ -414,7 +414,7 @@ extends
-
getFlagValue
-public Integer getFlagValue(String flag,
+public Integer getFlagValue(String flag,
Integer def)
@@ -424,7 +424,7 @@ extends
-
getAnnotation
-public <T extends Annotation> T getAnnotation(Class<T> cls)
+public <T extends Annotation> T getAnnotation(Class<T> cls)
@@ -433,7 +433,7 @@ extends
-
hasAnnotation
-public <T extends Annotation> boolean hasAnnotation(Class<T> cls)
+public <T extends Annotation> boolean hasAnnotation(Class<T> cls)
@@ -442,7 +442,7 @@ extends
-
getCmd
-public RegisteredCommand getCmd()
+public RegisteredCommand getCmd()
@@ -451,7 +451,7 @@ extends
-
getParam
-public Parameter getParam()
+public Parameter getParam()
@@ -460,7 +460,7 @@ extends
-
getIssuer
-public I getIssuer()
+public I getIssuer()
@@ -469,7 +469,7 @@ extends
-
getArgs
-public List<String> getArgs()
+public List<String> getArgs()
@@ -478,7 +478,7 @@ extends
-
getIndex
-public int getIndex()
+public int getIndex()
@@ -487,7 +487,7 @@ extends
-
getPassedArgs
-public Map<String,Object> getPassedArgs()
+public Map<String,Object> getPassedArgs()
@@ -496,7 +496,7 @@ extends
-
getFlags
-public Map<String,String> getFlags()
+public Map<String,String> getFlags()
@@ -505,7 +505,7 @@ extends
-
joinArgs
-public String joinArgs()
+public String joinArgs()
@@ -514,7 +514,7 @@ extends
-
joinArgs
-public String joinArgs(String sep)
+public String joinArgs(String sep)
diff --git a/docs/acf-core/co/aikar/commands/CommandManager.html b/docs/acf-core/co/aikar/commands/CommandManager.html
index ae3f1362..2606130b 100644
--- a/docs/acf-core/co/aikar/commands/CommandManager.html
+++ b/docs/acf-core/co/aikar/commands/CommandManager.html
@@ -108,7 +108,7 @@ var activeTableTab = "activeTableTab";
-
-public abstract class CommandManager<IT,I extends CommandIssuer,FT,MF extends MessageFormatter<FT>,CEC extends CommandExecutionContext<CEC,I>,CC extends ConditionContext<I>>
+public abstract class CommandManager<IT,I extends CommandIssuer,FT,MF extends MessageFormatter<FT>,CEC extends CommandExecutionContext<CEC,I>,CC extends ConditionContext<I>>
extends Object
@@ -216,8 +216,8 @@ extends
abstract CommandExecutionContext
-createCommandContext(RegisteredCommand command,
- Parameter parameter,
+createCommandContext(RegisteredCommand command,
+ CommandParameter parameter,
CommandIssuer sender,
List<String> args,
int i,
@@ -538,7 +538,7 @@ extends
-
rootCommands
-protected Map<String,co.aikar.commands.RootCommand> rootCommands
+protected Map<String,co.aikar.commands.RootCommand> rootCommands
@@ -547,7 +547,7 @@ extends
-
replacements
-protected final CommandReplacements replacements
+protected final CommandReplacements replacements
@@ -556,7 +556,7 @@ extends
-
conditions
-protected final CommandConditions<I extends CommandIssuer,CEC extends CommandExecutionContext<CEC,I>,CC extends ConditionContext<I>> conditions
+protected final CommandConditions<I extends CommandIssuer,CEC extends CommandExecutionContext<CEC,I>,CC extends ConditionContext<I>> conditions
@@ -565,7 +565,7 @@ extends
-
defaultExceptionHandler
-protected ExceptionHandler defaultExceptionHandler
+protected ExceptionHandler defaultExceptionHandler
@@ -574,7 +574,7 @@ extends
-
dependencies
-protected com.google.common.collect.Table<Class<?>,String,Object> dependencies
+protected com.google.common.collect.Table<Class<?>,String,Object> dependencies
@@ -583,7 +583,7 @@ extends
-
usePerIssuerLocale
-protected boolean usePerIssuerLocale
+protected boolean usePerIssuerLocale
@@ -592,7 +592,7 @@ extends
-
localeChangedCallbacks
-protected List<IssuerLocaleChangedCallback<I extends CommandIssuer>> localeChangedCallbacks
+protected List<IssuerLocaleChangedCallback<I extends CommandIssuer>> localeChangedCallbacks
@@ -601,7 +601,7 @@ extends
-
supportedLanguages
-protected Set<Locale> supportedLanguages
+protected Set<Locale> supportedLanguages
@@ -610,7 +610,7 @@ extends
-
formatters
-protected Map<MessageType,MF extends MessageFormatter<FT>> formatters
+protected Map<MessageType,MF extends MessageFormatter<FT>> formatters
@@ -619,7 +619,7 @@ extends
-
defaultFormatter
-protected MF extends MessageFormatter<FT> defaultFormatter
+protected MF extends MessageFormatter<FT> defaultFormatter
@@ -628,7 +628,7 @@ extends
-
defaultHelpPerPage
-protected int defaultHelpPerPage
+protected int defaultHelpPerPage
@@ -637,7 +637,7 @@ extends
-
issuersLocale
-protected Map<UUID,Locale> issuersLocale
+protected Map<UUID,Locale> issuersLocale
@@ -654,7 +654,7 @@ extends
-
CommandManager
-public CommandManager()
+public CommandManager()
@@ -671,7 +671,7 @@ extends
-
getCurrentCommandOperationContext
-public static CommandOperationContext getCurrentCommandOperationContext()
+public static CommandOperationContext getCurrentCommandOperationContext()
@@ -680,7 +680,7 @@ extends
-
getCurrentCommandIssuer
-public static CommandIssuer getCurrentCommandIssuer()
+public static CommandIssuer getCurrentCommandIssuer()
@@ -689,7 +689,7 @@ extends
-
getCurrentCommandManager
-public static CommandManager getCurrentCommandManager()
+public static CommandManager getCurrentCommandManager()
@@ -700,7 +700,7 @@ extends
-
setFormat
-public MF setFormat(MessageType type,
+public MF setFormat(MessageType type,
MF formatter)
@@ -710,7 +710,7 @@ extends
-
getFormat
-public MF getFormat(MessageType type)
+public MF getFormat(MessageType type)
@@ -721,7 +721,7 @@ extends
-
setFormat
-public void setFormat(MessageType type,
+public void setFormat(MessageType type,
FT... colors)
@@ -733,7 +733,7 @@ extends
-
setFormat
-public void setFormat(MessageType type,
+public void setFormat(MessageType type,
int i,
FT color)
@@ -744,7 +744,7 @@ extends
-
getDefaultFormatter
-public MF getDefaultFormatter()
+public MF getDefaultFormatter()
@@ -755,7 +755,7 @@ extends
-
setDefaultFormatter
-public void setDefaultFormatter(MF defaultFormatter)
+public void setDefaultFormatter(MF defaultFormatter)
@@ -764,7 +764,7 @@ extends
-
getCommandConditions
-public CommandConditions<I,CEC,CC> getCommandConditions()
+public CommandConditions<I,CEC,CC> getCommandConditions()
@@ -773,7 +773,7 @@ extends
-
getCommandContexts
-public abstract CommandContexts<?> getCommandContexts()
+public abstract CommandContexts<?> getCommandContexts()
Gets the command contexts manager
- Returns:
@@ -787,7 +787,7 @@ extends
-
getCommandCompletions
-public abstract CommandCompletions<?> getCommandCompletions()
+public abstract CommandCompletions<?> getCommandCompletions()
Gets the command completions manager
@@ -814,7 +814,7 @@ public
generateCommandHelp
@Deprecated
-public CommandHelp generateCommandHelp(CommandIssuer issuer,
+public CommandHelp generateCommandHelp(CommandIssuer issuer,
@NotNull
@NotNull String command)
Deprecated. Unstable API
@@ -827,7 +827,7 @@ public
generateCommandHelp
@Deprecated
-public CommandHelp generateCommandHelp()
+public CommandHelp generateCommandHelp()
Deprecated. Unstable API
@@ -838,7 +838,7 @@ public
generateCommandHelp
@Deprecated
-public CommandHelp generateCommandHelp(CommandIssuer issuer,
+public CommandHelp generateCommandHelp(CommandIssuer issuer,
co.aikar.commands.RootCommand rootCommand)
Deprecated. Unstable API
@@ -850,7 +850,7 @@ public
getDefaultHelpPerPage
@Deprecated
-public int getDefaultHelpPerPage()
+public int getDefaultHelpPerPage()
Deprecated. Unstable API
@@ -861,7 +861,7 @@ public int
setDefaultHelpPerPage
@Deprecated
-public void setDefaultHelpPerPage(int defaultHelpPerPage)
+public void setDefaultHelpPerPage(int defaultHelpPerPage)
Deprecated. Unstable API
@@ -871,7 +871,7 @@ public void
-
registerCommand
-public abstract void registerCommand(BaseCommand command)
+public abstract void registerCommand(BaseCommand command)
Registers a command with ACF
- Parameters:
@@ -885,7 +885,7 @@ public void
-
hasRegisteredCommands
-public abstract boolean hasRegisteredCommands()
+public abstract boolean hasRegisteredCommands()
@@ -894,7 +894,7 @@ public void
-
isCommandIssuer
-public abstract boolean isCommandIssuer(Class<?> type)
+public abstract boolean isCommandIssuer(Class<?> type)
@@ -903,7 +903,7 @@ public void
-
getCommandIssuer
-public abstract I getCommandIssuer(Object issuer)
+public abstract I getCommandIssuer(Object issuer)
@@ -912,7 +912,7 @@ public void
-
createRootCommand
-public abstract co.aikar.commands.RootCommand createRootCommand(String cmd)
+public abstract co.aikar.commands.RootCommand createRootCommand(String cmd)
@@ -921,7 +921,7 @@ public void
-
getLocales
-public abstract Locales getLocales()
+public abstract Locales getLocales()
Returns a Locales Manager to add and modify language tables for your commands.
- Returns:
@@ -934,7 +934,7 @@ public void
-
usingPerIssuerLocale
-public boolean usingPerIssuerLocale()
+public boolean usingPerIssuerLocale()
@@ -943,7 +943,7 @@ public void
-
usePerIssuerLocale
-public boolean usePerIssuerLocale(boolean setting)
+public boolean usePerIssuerLocale(boolean setting)
@@ -952,18 +952,18 @@ public void
-
createConditionContext
-public ConditionContext createConditionContext(CommandIssuer issuer,
+public ConditionContext createConditionContext(CommandIssuer issuer,
String config)
-
+
-
createCommandContext
-public abstract CommandExecutionContext createCommandContext(RegisteredCommand command,
- Parameter parameter,
+public abstract CommandExecutionContext createCommandContext(RegisteredCommand command,
+ CommandParameter parameter,
CommandIssuer sender,
List<String> args,
int i,
@@ -976,7 +976,7 @@ public void
-
createCompletionContext
-public abstract CommandCompletionContext createCompletionContext(RegisteredCommand command,
+public abstract CommandCompletionContext createCompletionContext(RegisteredCommand command,
CommandIssuer sender,
String input,
String config,
@@ -989,7 +989,7 @@ public void
-
log
-public abstract void log(co.aikar.commands.LogLevel level,
+public abstract void log(co.aikar.commands.LogLevel level,
String message,
Throwable throwable)
@@ -1000,7 +1000,7 @@ public void
-
log
-public void log(co.aikar.commands.LogLevel level,
+public void log(co.aikar.commands.LogLevel level,
String message)
@@ -1010,7 +1010,7 @@ public void
-
getCommandReplacements
-public CommandReplacements getCommandReplacements()
+public CommandReplacements getCommandReplacements()
Lets you add custom string replacements that can be applied to annotation values,
to reduce duplication/repetition of common values such as permission nodes and command prefixes.
@@ -1029,7 +1029,7 @@ public void
-
hasPermission
-public boolean hasPermission(CommandIssuer issuer,
+public boolean hasPermission(CommandIssuer issuer,
String permission)
@@ -1039,7 +1039,7 @@ public void
-
getRootCommand
-public co.aikar.commands.RootCommand getRootCommand(@NotNull
+public co.aikar.commands.RootCommand getRootCommand(@NotNull
@NotNull String cmd)
@@ -1049,7 +1049,7 @@ public void
-
obtainRootCommand
-public co.aikar.commands.RootCommand obtainRootCommand(@NotNull
+public co.aikar.commands.RootCommand obtainRootCommand(@NotNull
@NotNull String cmd)
@@ -1059,7 +1059,7 @@ public void
-
createRegisteredCommand
-public RegisteredCommand createRegisteredCommand(BaseCommand command,
+public RegisteredCommand createRegisteredCommand(BaseCommand command,
String cmdName,
Method method,
String prefSubCommand)
@@ -1071,7 +1071,7 @@ public void
-
setDefaultExceptionHandler
-public void setDefaultExceptionHandler(ExceptionHandler exceptionHandler)
+public void setDefaultExceptionHandler(ExceptionHandler exceptionHandler)
Sets the default ExceptionHandler that is called when an exception occurs while executing a command, if the command doesn't have it's own exception handler registered.
- Parameters:
@@ -1085,7 +1085,7 @@ public void
-
getDefaultExceptionHandler
-public ExceptionHandler getDefaultExceptionHandler()
+public ExceptionHandler getDefaultExceptionHandler()
Gets the current default exception handler, might be null.
- Returns:
@@ -1099,7 +1099,7 @@ public void
-
handleUncaughtException
-protected boolean handleUncaughtException(BaseCommand scope,
+protected boolean handleUncaughtException(BaseCommand scope,
RegisteredCommand registeredCommand,
CommandIssuer sender,
List<String> args,
@@ -1114,7 +1114,7 @@ public void
-
sendMessage
-public void sendMessage(IT issuerArg,
+public void sendMessage(IT issuerArg,
MessageType type,
co.aikar.locales.MessageKeyProvider key,
String... replacements)
@@ -1126,7 +1126,7 @@ public void
-
sendMessage
-public void sendMessage(CommandIssuer issuer,
+public void sendMessage(CommandIssuer issuer,
MessageType type,
co.aikar.locales.MessageKeyProvider key,
String... replacements)
@@ -1138,7 +1138,7 @@ public void
-
formatMessage
-public String formatMessage(CommandIssuer issuer,
+public String formatMessage(CommandIssuer issuer,
MessageType type,
co.aikar.locales.MessageKeyProvider key,
String... replacements)
@@ -1150,7 +1150,7 @@ public void
-
onLocaleChange
-public void onLocaleChange(IssuerLocaleChangedCallback<I> onChange)
+public void onLocaleChange(IssuerLocaleChangedCallback<I> onChange)
@@ -1161,7 +1161,7 @@ public void
-
notifyLocaleChange
-public void notifyLocaleChange(I issuer,
+public void notifyLocaleChange(I issuer,
Locale oldLocale,
Locale newLocale)
@@ -1174,7 +1174,7 @@ public void
-
setIssuerLocale
-public Locale setIssuerLocale(IT issuer,
+public Locale setIssuerLocale(IT issuer,
Locale locale)
@@ -1184,7 +1184,7 @@ public void
-
getIssuerLocale
-public Locale getIssuerLocale(CommandIssuer issuer)
+public Locale getIssuerLocale(CommandIssuer issuer)
@@ -1193,7 +1193,7 @@ public void
-
getSupportedLanguages
-public Set<Locale> getSupportedLanguages()
+public Set<Locale> getSupportedLanguages()
Gets a list of all currently supported languages for this manager.
These locales will be automatically loaded from
@@ -1207,7 +1207,7 @@ public void
-
addSupportedLanguage
-public void addSupportedLanguage(Locale locale)
+public void addSupportedLanguage(Locale locale)
Adds a new locale to the list of automatic Locales to load Message Bundles for.
All bundles loaded under the previous supported languages will now automatically load for this new locale too.
@@ -1224,7 +1224,7 @@ public void
-
registerDependency
-public <T> void registerDependency(Class<? extends T> clazz,
+public <T> void registerDependency(Class<? extends T> clazz,
T instance)
Registers an instance of a class to be registered as an injectable dependency.
The command manager will attempt to inject all fields in a command class that are annotated with
@@ -1246,7 +1246,7 @@ public void
-
registerDependency
-public <T> void registerDependency(Class<? extends T> clazz,
+public <T> void registerDependency(Class<? extends T> clazz,
String key,
T instance)
Registers an instance of a class to be registered as an injectable dependency.
@@ -1269,7 +1269,7 @@ public void
enableUnstableAPI
@Deprecated
-public void enableUnstableAPI(String api)
+public void enableUnstableAPI(String api)
Deprecated. Use this with caution! If you enable and use Unstable API's, your next compile using ACF
may require you to update your implementation to those unstable API's
diff --git a/docs/acf-core/co/aikar/commands/CommandOperationContext.html b/docs/acf-core/co/aikar/commands/CommandOperationContext.html
index 01165383..9da78ab6 100644
--- a/docs/acf-core/co/aikar/commands/CommandOperationContext.html
+++ b/docs/acf-core/co/aikar/commands/CommandOperationContext.html
@@ -49,7 +49,7 @@ var activeTableTab = "activeTableTab";
@@ -207,7 +207,7 @@ extends
-
postCommand
-public void postCommand()
+public void postCommand()
@@ -217,7 +217,7 @@ extends
getPermission
@Deprecated
-public String getPermission()
+public String getPermission()
Deprecated.
- See Also:
@@ -231,7 +231,7 @@ public
-
getRequiredPermissions
-public Set<String> getRequiredPermissions()
+public Set<String> getRequiredPermissions()
@@ -240,7 +240,7 @@ public
-
requiresPermission
-public boolean requiresPermission(String permission)
+public boolean requiresPermission(String permission)
@@ -249,7 +249,7 @@ public
-
getPrefSubCommand
-public String getPrefSubCommand()
+public String getPrefSubCommand()
@@ -258,7 +258,7 @@ public
-
getSyntaxText
-public String getSyntaxText()
+public String getSyntaxText()
@@ -267,7 +267,7 @@ public
-
getCommand
-public String getCommand()
+public String getCommand()
@@ -276,7 +276,7 @@ public
-
addSubcommand
-public void addSubcommand(String cmd)
+public void addSubcommand(String cmd)
@@ -285,7 +285,7 @@ public
-
addSubcommands
-public void addSubcommands(Collection<String> cmd)
+public void addSubcommands(Collection<String> cmd)
diff --git a/docs/acf-core/co/aikar/commands/class-use/CommandExecutionContext.html b/docs/acf-core/co/aikar/commands/class-use/CommandExecutionContext.html
index b7134d1d..03e4539b 100644
--- a/docs/acf-core/co/aikar/commands/class-use/CommandExecutionContext.html
+++ b/docs/acf-core/co/aikar/commands/class-use/CommandExecutionContext.html
@@ -131,6 +131,10 @@
class
+CommandParameter<CEC extends CommandExecutionContext<CEC,? extends CommandIssuer>>
+
+
+class
RegisteredCommand<CEC extends CommandExecutionContext<CEC,? extends CommandIssuer>>
@@ -144,8 +148,8 @@
abstract CommandExecutionContext
-CommandManager.createCommandContext(RegisteredCommand command,
- Parameter parameter,
+CommandManager.createCommandContext(RegisteredCommand command,
+ CommandParameter parameter,
CommandIssuer sender,
List<String> args,
int i,
diff --git a/docs/acf-core/co/aikar/commands/class-use/CommandIssuer.html b/docs/acf-core/co/aikar/commands/class-use/CommandIssuer.html
index d352d1e8..caca7441 100644
--- a/docs/acf-core/co/aikar/commands/class-use/CommandIssuer.html
+++ b/docs/acf-core/co/aikar/commands/class-use/CommandIssuer.html
@@ -141,13 +141,17 @@
class
-ConditionContext<I extends CommandIssuer>
+CommandParameter<CEC extends CommandExecutionContext<CEC,? extends CommandIssuer>>
+class
+ConditionContext<I extends CommandIssuer>
+
+
interface
IssuerLocaleChangedCallback<I extends CommandIssuer>
-
+
class
RegisteredCommand<CEC extends CommandExecutionContext<CEC,? extends CommandIssuer>>
@@ -205,8 +209,8 @@
abstract CommandExecutionContext
-CommandManager.createCommandContext(RegisteredCommand command,
- Parameter parameter,
+CommandManager.createCommandContext(RegisteredCommand command,
+ CommandParameter parameter,
CommandIssuer sender,
List<String> args,
int i,
diff --git a/docs/acf-core/co/aikar/commands/class-use/CommandManager.html b/docs/acf-core/co/aikar/commands/class-use/CommandManager.html
index 530e70fd..27e4c413 100644
--- a/docs/acf-core/co/aikar/commands/class-use/CommandManager.html
+++ b/docs/acf-core/co/aikar/commands/class-use/CommandManager.html
@@ -134,6 +134,10 @@
CommandManager
CommandIssuer.getManager()
+
+CommandManager
+CommandParameter.getManager()
+
diff --git a/docs/acf-core/co/aikar/commands/class-use/CommandParameter.html b/docs/acf-core/co/aikar/commands/class-use/CommandParameter.html
new file mode 100644
index 00000000..d2040fec
--- /dev/null
+++ b/docs/acf-core/co/aikar/commands/class-use/CommandParameter.html
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+Uses of Class co.aikar.commands.CommandParameter (ACF (Core) 0.5.0-SNAPSHOT API)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Uses of Class
co.aikar.commands.CommandParameter
+
+
+
+-
+
+Packages that use CommandParameter
+
+Package
+Description
+
+
+
+co.aikar.commands
+
+
+
+
+
+-
+
+-
+
+
+
Uses of CommandParameter in co.aikar.commands
+
+Methods in co.aikar.commands with parameters of type CommandParameter
+
+Modifier and Type
+Method and Description
+
+
+
+abstract CommandExecutionContext
+CommandManager.createCommandContext(RegisteredCommand command,
+ CommandParameter parameter,
+ CommandIssuer sender,
+ List<String> args,
+ int i,
+ Map<String,Object> passedArgs)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Copyright © 2018. All rights reserved.
+
+
diff --git a/docs/acf-core/co/aikar/commands/class-use/RegisteredCommand.html b/docs/acf-core/co/aikar/commands/class-use/RegisteredCommand.html
index ba83104a..3481a565 100644
--- a/docs/acf-core/co/aikar/commands/class-use/RegisteredCommand.html
+++ b/docs/acf-core/co/aikar/commands/class-use/RegisteredCommand.html
@@ -136,8 +136,8 @@
abstract CommandExecutionContext
-CommandManager.createCommandContext(RegisteredCommand command,
- Parameter parameter,
+CommandManager.createCommandContext(RegisteredCommand command,
+ CommandParameter parameter,
CommandIssuer sender,
List<String> args,
int i,
@@ -198,6 +198,19 @@
+
+Constructors in co.aikar.commands with parameters of type RegisteredCommand
+
+Constructor and Description
+
+
+
+CommandParameter(RegisteredCommand<CEC> command,
+ Parameter param,
+ int paramIndex)
+
+
+
diff --git a/docs/acf-core/co/aikar/commands/contexts/class-use/ContextResolver.html b/docs/acf-core/co/aikar/commands/contexts/class-use/ContextResolver.html
index c427e4dc..2b697628 100644
--- a/docs/acf-core/co/aikar/commands/contexts/class-use/ContextResolver.html
+++ b/docs/acf-core/co/aikar/commands/contexts/class-use/ContextResolver.html
@@ -119,6 +119,10 @@
+ContextResolver<?,CEC>
+CommandParameter.getResolver()
+
+
ContextResolver<?,R>
CommandContexts.getResolver(Class<?> type)
@@ -138,6 +142,10 @@
Registers a context that requires input from the command issuer to resolve.
+
+void
+CommandParameter.setResolver(ContextResolver<?,CEC> resolver)
+
diff --git a/docs/acf-core/co/aikar/commands/package-frame.html b/docs/acf-core/co/aikar/commands/package-frame.html
index d3a6b050..9b07b93f 100644
--- a/docs/acf-core/co/aikar/commands/package-frame.html
+++ b/docs/acf-core/co/aikar/commands/package-frame.html
@@ -34,6 +34,7 @@
- CommandHelp
- CommandManager
- CommandOperationContext
+- CommandParameter
- CommandReplacements
- ConditionContext
- ForwardingCommand
diff --git a/docs/acf-core/co/aikar/commands/package-summary.html b/docs/acf-core/co/aikar/commands/package-summary.html
index 36457725..016bf003 100644
--- a/docs/acf-core/co/aikar/commands/package-summary.html
+++ b/docs/acf-core/co/aikar/commands/package-summary.html
@@ -169,38 +169,42 @@
+CommandParameter<CEC extends CommandExecutionContext<CEC,? extends CommandIssuer>>
+
+
+
CommandReplacements
Manages replacement template strings
-
+
ConditionContext<I extends CommandIssuer>
-
+
ForwardingCommand
-
+
HelpEntry
-
+
Locales
-
+
MessageFormatter<FT>
Handles formatting Messages and managing colors
-
+
MessageType
-
+
RegisteredCommand<CEC extends CommandExecutionContext<CEC,? extends CommandIssuer>>
diff --git a/docs/acf-core/co/aikar/commands/package-tree.html b/docs/acf-core/co/aikar/commands/package-tree.html
index f04e6f55..8587b253 100644
--- a/docs/acf-core/co/aikar/commands/package-tree.html
+++ b/docs/acf-core/co/aikar/commands/package-tree.html
@@ -94,6 +94,7 @@
- co.aikar.commands.CommandHelp
- co.aikar.commands.CommandManager<IT,I,FT,MF,CEC,CC>
- co.aikar.commands.CommandOperationContext<I>
+- co.aikar.commands.CommandParameter<CEC>
- co.aikar.commands.CommandReplacements
- co.aikar.commands.ConditionContext<I>
- co.aikar.commands.HelpEntry
diff --git a/docs/acf-core/co/aikar/commands/package-use.html b/docs/acf-core/co/aikar/commands/package-use.html
index e417ff21..cf70cf81 100644
--- a/docs/acf-core/co/aikar/commands/package-use.html
+++ b/docs/acf-core/co/aikar/commands/package-use.html
@@ -150,47 +150,50 @@
+CommandParameter
+
+
CommandReplacements
Manages replacement template strings
-
+
ConditionContext
-
+
ExceptionHandler
Functional interface to allow plugins to handle uncaught excetpions
-
+
HelpEntry
-
+
InvalidCommandArgument
-
+
IssuerLocaleChangedCallback
-
+
Locales
-
+
MessageFormatter
Handles formatting Messages and managing colors
-
+
MessageKeys
Enum Name = MessageKey in lowercase prefixed with acf-core.
-
+
MessageType
-
+
RegisteredCommand
-
+
UnstableAPI
Deprecated.
diff --git a/docs/acf-core/index-all.html b/docs/acf-core/index-all.html
index 21e8fd3d..64c723d8 100644
--- a/docs/acf-core/index-all.html
+++ b/docs/acf-core/index-all.html
@@ -166,6 +166,8 @@
C
+- canConsumeInput() - Method in class co.aikar.commands.CommandParameter
+-
- canExecute(CommandIssuer, RegisteredCommand<?>) - Method in class co.aikar.commands.BaseCommand
-
- canOverridePlayerContext() - Method in class co.aikar.commands.CommandExecutionContext
@@ -267,6 +269,10 @@
-
Holds information about the currently executing command on this thread
+- CommandParameter<CEC extends CommandExecutionContext<CEC,? extends CommandIssuer>> - Class in co.aikar.commands
+-
+- CommandParameter(RegisteredCommand<CEC>, Parameter, int) - Constructor for class co.aikar.commands.CommandParameter
+-
- CommandPermission - Annotation Type in co.aikar.commands.annotation
-
- CommandReplacements - Class in co.aikar.commands
@@ -301,7 +307,7 @@
-
- ContextResolver<T,C extends CommandExecutionContext<?,? extends CommandIssuer>> - Interface in co.aikar.commands.contexts
-
-- createCommandContext(RegisteredCommand, Parameter, CommandIssuer, List<String>, int, Map<String, Object>) - Method in class co.aikar.commands.CommandManager
+- createCommandContext(RegisteredCommand, CommandParameter, CommandIssuer, List<String>, int, Map<String, Object>) - Method in class co.aikar.commands.CommandManager
-
- createCompletionContext(RegisteredCommand, CommandIssuer, String, String, String[]) - Method in class co.aikar.commands.CommandManager
-
@@ -556,6 +562,10 @@
-
- getDefaultRegisteredCommand() - Method in class co.aikar.commands.BaseCommand
-
+- getDefaultValue() - Method in class co.aikar.commands.CommandParameter
+-
+- getDescription() - Method in class co.aikar.commands.CommandParameter
+-
- getDescription() - Method in class co.aikar.commands.HelpEntry
-
- getEnumFromName(T[], String) - Static method in class co.aikar.commands.ACFUtil
@@ -578,6 +588,8 @@
-
- getFlags() - Method in class co.aikar.commands.CommandExecutionContext
-
+- getFlags() - Method in class co.aikar.commands.CommandParameter
+-
- getFlagValue(String, String) - Method in class co.aikar.commands.CommandExecutionContext
-
- getFlagValue(String, Integer) - Method in class co.aikar.commands.CommandExecutionContext
@@ -620,6 +632,8 @@
-
- getManager() - Method in interface co.aikar.commands.CommandIssuer
-
+- getManager() - Method in class co.aikar.commands.CommandParameter
+-
- getMessage() - Method in interface co.aikar.commands.apachecommonslang.ApacheCommonsExceptionUtil.Nestable
-
Returns the error message of this and any nested
@@ -641,6 +655,8 @@
- getName() - Method in class co.aikar.commands.BaseCommand
-
+- getName() - Method in class co.aikar.commands.CommandParameter
+-
- getNumParams() - Method in class co.aikar.commands.CommandExecutionContext
-
- getOrigArgs() - Method in class co.aikar.commands.BaseCommand
@@ -649,8 +665,12 @@
- getParam() - Method in class co.aikar.commands.CommandExecutionContext
-
+- getParameter() - Method in class co.aikar.commands.CommandParameter
+-
- getParameterSyntax() - Method in class co.aikar.commands.HelpEntry
-
+- getParamIndex() - Method in class co.aikar.commands.CommandParameter
+-
- getPassedArgs() - Method in class co.aikar.commands.CommandExecutionContext
-
- getPermission() - Method in class co.aikar.commands.RegisteredCommand
@@ -673,6 +693,8 @@
-
- getResolver(Class<?>) - Method in class co.aikar.commands.CommandContexts
-
+- getResolver() - Method in class co.aikar.commands.CommandParameter
+-
- getRootCause(Throwable) - Static method in class co.aikar.commands.apachecommonslang.ApacheCommonsExceptionUtil
-
Introspects the
Throwable to obtain the root cause.
@@ -724,8 +746,12 @@
in an array of Throwables, one element for each
Throwable.
+- getType() - Method in class co.aikar.commands.CommandParameter
+-
- getUniqueId() - Method in interface co.aikar.commands.CommandIssuer
-
+- getValues() - Method in class co.aikar.commands.CommandParameter
+-
- GREEK - Static variable in class co.aikar.commands.Locales
-
@@ -872,6 +898,8 @@
- isCommandIssuer(Class<?>) - Method in class co.aikar.commands.CommandManager
-
+- isCommandIssuer() - Method in class co.aikar.commands.CommandParameter
+-
- isDelimiter(char, char[]) - Static method in class co.aikar.commands.apachecommonslang.ApacheCommonsLangUtil
-
Is the character a delimiter.
@@ -896,6 +924,10 @@
- isOptional() - Method in class co.aikar.commands.CommandExecutionContext
-
+- isOptional() - Method in class co.aikar.commands.CommandParameter
+-
+- isOptionalResolver() - Method in class co.aikar.commands.CommandParameter
+-
- isPlayer() - Method in interface co.aikar.commands.CommandIssuer
-
Is this issue a player, or server/console sender
@@ -1364,6 +1396,8 @@
-
- replaceStrings(String, String...) - Static method in class co.aikar.commands.ACFUtil
-
+- requiresInput() - Method in class co.aikar.commands.CommandParameter
+-
- requiresPermission(String) - Method in class co.aikar.commands.BaseCommand
-
- requiresPermission(String) - Method in class co.aikar.commands.RegisteredCommand
@@ -1422,6 +1456,8 @@
-
- sendSyntax(MessageKey, String...) - Method in interface co.aikar.commands.CommandIssuer
-
+- setCanConsumeInput(boolean) - Method in class co.aikar.commands.CommandParameter
+-
- setCause(Throwable, Throwable) - Static method in class co.aikar.commands.apachecommonslang.ApacheCommonsExceptionUtil
-
Sets the cause of a
Throwable using introspection, allowing
@@ -1429,6 +1465,8 @@
- setColor(int, FT) - Method in class co.aikar.commands.MessageFormatter
-
+- setCommandIssuer(boolean) - Method in class co.aikar.commands.CommandParameter
+-
- setContextFlags(Class<?>, String) - Method in class co.aikar.commands.BaseCommand
-
- setDefaultExceptionHandler(ExceptionHandler) - Method in class co.aikar.commands.CommandManager
@@ -1445,8 +1483,14 @@
- setDefaultLocale(Locale) - Method in class co.aikar.commands.Locales
-
+- setDefaultValue(String) - Method in class co.aikar.commands.CommandParameter
+-
+- setDescription(String) - Method in class co.aikar.commands.CommandParameter
+-
- setExceptionHandler(ExceptionHandler) - Method in class co.aikar.commands.BaseCommand
-
+- setFlags(Map<String, String>) - Method in class co.aikar.commands.CommandParameter
+-
- setFormat(MessageType, MF) - Method in class co.aikar.commands.CommandManager
-
- setFormat(MessageType, FT...) - Method in class co.aikar.commands.CommandManager
@@ -1455,6 +1499,10 @@
-
- setIssuerLocale(IT, Locale) - Method in class co.aikar.commands.CommandManager
-
+- setOptional(boolean) - Method in class co.aikar.commands.CommandParameter
+-
+- setOptionalResolver(boolean) - Method in class co.aikar.commands.CommandParameter
+-
- setPage(int) - Method in class co.aikar.commands.CommandHelp
-
- setPage(int, int) - Method in class co.aikar.commands.CommandHelp
@@ -1463,10 +1511,16 @@
-
- setRegisteredCommand(RegisteredCommand) - Method in class co.aikar.commands.CommandOperationContext
-
+- setRequiresInput(boolean) - Method in class co.aikar.commands.CommandParameter
+-
+- setResolver(ContextResolver<?, CEC>) - Method in class co.aikar.commands.CommandParameter
+-
- setSearch(List<String>) - Method in class co.aikar.commands.CommandHelp
-
- setSearchScore(int) - Method in class co.aikar.commands.HelpEntry
-
+- setValues(String[]) - Method in class co.aikar.commands.CommandParameter
+-
- shouldShow() - Method in class co.aikar.commands.HelpEntry
-
- showCommandHelp() - Method in class co.aikar.commands.BaseCommand
diff --git a/docs/acf-core/overview-tree.html b/docs/acf-core/overview-tree.html
index 4648f568..97954ffb 100644
--- a/docs/acf-core/overview-tree.html
+++ b/docs/acf-core/overview-tree.html
@@ -100,6 +100,7 @@
- co.aikar.commands.CommandHelp
- co.aikar.commands.CommandManager<IT,I,FT,MF,CEC,CC>
- co.aikar.commands.CommandOperationContext<I>
+- co.aikar.commands.CommandParameter<CEC>
- co.aikar.commands.CommandReplacements
- co.aikar.commands.ConditionContext<I>
- co.aikar.commands.processors.ConditionsProcessor (implements co.aikar.commands.AnnotationProcessor<T>)
diff --git a/docs/acf-core/src-html/co/aikar/commands/BaseCommand.html b/docs/acf-core/src-html/co/aikar/commands/BaseCommand.html
index f00c26d5..682e1fee 100644
--- a/docs/acf-core/src-html/co/aikar/commands/BaseCommand.html
+++ b/docs/acf-core/src-html/co/aikar/commands/BaseCommand.html
@@ -504,196 +504,197 @@
496
497 List<String> getCommandsForCompletion(CommandIssuer issuer, String[] args) {
498 final Set<String> cmds = new HashSet<>();
-499 String argString = ApacheCommonsLangUtil.join(args, " ").toLowerCase();
-500 for (Map.Entry<String, RegisteredCommand> entry : subCommands.entries()) {
-501 final String key = entry.getKey();
-502 if (key.startsWith(argString) && !CATCHUNKNOWN.equals(key) && !DEFAULT.equals(key)) {
-503 final RegisteredCommand value = entry.getValue();
-504 if (!value.hasPermission(issuer)) {
-505 continue;
-506 }
-507
-508 String[] split = ACFPatterns.SPACE.split(value.prefSubCommand);
-509 cmds.add(split[args.length - 1]);
-510 }
-511 }
-512 return new ArrayList<>(cmds);
-513 }
-514
-515 private List<String> completeCommand(CommandIssuer issuer, RegisteredCommand cmd, String[] args, String commandLabel, boolean isAsync) {
-516 if (!cmd.hasPermission(issuer) || args.length > cmd.requiredResolvers + cmd.optionalResolvers || args.length == 0
-517 || cmd.complete == null) {
-518 return ImmutableList.of();
-519 }
-520
-521 String[] completions = ACFPatterns.SPACE.split(cmd.complete);
-522
-523 List<String> cmds = manager.getCommandCompletions().of(cmd, issuer, completions, args, isAsync);
-524 return filterTabComplete(args[args.length-1], cmds);
-525 }
-526
-527 private static List<String> filterTabComplete(String arg, List<String> cmds) {
-528 return cmds.stream()
-529 .distinct()
-530 .filter(cmd -> cmd != null && (arg.isEmpty() || ApacheCommonsLangUtil.startsWithIgnoreCase(cmd, arg)))
-531 .collect(Collectors.toList());
-532 }
-533
-534 RegisteredCommand getSubcommand(String subcommand) {
-535 return getSubcommand(subcommand, false);
-536 }
-537
-538 RegisteredCommand getSubcommand(String subcommand, boolean requireOne) {
-539 final Set<RegisteredCommand> commands = subCommands.get(subcommand);
-540 if (!commands.isEmpty() && (!requireOne || commands.size() == 1)) {
-541 return commands.iterator().next();
-542 }
-543 return null;
-544 }
-545
-546 private boolean executeSubcommand(CommandOperationContext commandContext, String subcommand, CommandIssuer issuer, String... args) {
-547 final RegisteredCommand cmd = this.getSubcommand(subcommand);
-548 if (cmd != null) {
-549 executeCommand(commandContext, issuer, args, cmd);
-550 return true;
-551 }
-552
-553 return false;
-554 }
-555
-556 private boolean checkPrecommand(CommandOperationContext commandOperationContext, RegisteredCommand cmd, CommandIssuer issuer, String[] args) {
-557 Method pre = this.preCommandHandler;
-558 if (pre != null) {
-559 try {
-560 Class<?>[] types = pre.getParameterTypes();
-561 Object[] parameters = new Object[pre.getParameterCount()];
-562 for (int i = 0; i < parameters.length; i++) {
-563 Class<?> type = types[i];
-564 Object issuerObject = issuer.getIssuer();
-565 if (manager.isCommandIssuer(type) && type.isAssignableFrom(issuerObject.getClass())) {
-566 parameters[i] = issuerObject;
-567 } else if (CommandIssuer.class.isAssignableFrom(type)) {
-568 parameters[i] = issuer;
-569 } else if (RegisteredCommand.class.isAssignableFrom(type)) {
-570 parameters[i] = cmd;
-571 } else if (String[].class.isAssignableFrom((type))) {
-572 parameters[i] = args;
-573 } else {
-574 parameters[i] = null;
-575 }
-576 }
-577
-578 return (boolean) pre.invoke(this, parameters);
-579 } catch (IllegalAccessException | InvocationTargetException e) {
-580 this.manager.log(LogLevel.ERROR, "Exception encountered while command pre-processing", e);
-581 }
-582 }
-583 return false;
-584 }
-585
-586 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
-587 public CommandHelp getCommandHelp() {
-588 return manager.generateCommandHelp();
-589 }
-590
-591 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
-592 public void showCommandHelp() {
-593 getCommandHelp().showHelp();
-594 }
-595
-596 public void help(Object issuer, String[] args) {
-597 help(manager.getCommandIssuer(issuer), args);
-598 }
-599 public void help(CommandIssuer issuer, String[] args) {
-600 issuer.sendMessage(MessageType.ERROR, MessageKeys.UNKNOWN_COMMAND);
-601 }
-602 public void doHelp(Object issuer, String... args) {
-603 doHelp(manager.getCommandIssuer(issuer), args);
-604 }
-605 public void doHelp(CommandIssuer issuer, String... args) {
-606 help(issuer, args);
-607 }
-608
-609 public void showSyntax(CommandIssuer issuer, RegisteredCommand<?> cmd) {
-610 issuer.sendMessage(MessageType.SYNTAX, MessageKeys.INVALID_SYNTAX,
-611 "{command}", "/" + cmd.command,
-612 "{syntax}", cmd.syntaxText
-613 );
-614 }
-615
-616 public boolean hasPermission(Object issuer) {
-617 return hasPermission(manager.getCommandIssuer(issuer));
-618 }
-619
-620 public boolean hasPermission(CommandIssuer issuer) {
-621 return permission == null || permission.isEmpty() || (manager.hasPermission(issuer, permission) && (parentCommand == null || parentCommand.hasPermission(issuer)));
-622 }
-623
+499 final int cmdIndex = Math.max(0, args.length - 1);
+500 String argString = ApacheCommonsLangUtil.join(args, " ").toLowerCase();
+501 for (Map.Entry<String, RegisteredCommand> entry : subCommands.entries()) {
+502 final String key = entry.getKey();
+503 if (key.startsWith(argString) && !CATCHUNKNOWN.equals(key) && !DEFAULT.equals(key)) {
+504 final RegisteredCommand value = entry.getValue();
+505 if (!value.hasPermission(issuer)) {
+506 continue;
+507 }
+508
+509 String[] split = ACFPatterns.SPACE.split(value.prefSubCommand);
+510 cmds.add(split[cmdIndex]);
+511 }
+512 }
+513 return new ArrayList<>(cmds);
+514 }
+515
+516 private List<String> completeCommand(CommandIssuer issuer, RegisteredCommand cmd, String[] args, String commandLabel, boolean isAsync) {
+517 if (!cmd.hasPermission(issuer) || args.length > cmd.requiredResolvers + cmd.optionalResolvers || args.length == 0
+518 || cmd.complete == null) {
+519 return ImmutableList.of();
+520 }
+521
+522 String[] completions = ACFPatterns.SPACE.split(cmd.complete);
+523
+524 List<String> cmds = manager.getCommandCompletions().of(cmd, issuer, completions, args, isAsync);
+525 return filterTabComplete(args[args.length-1], cmds);
+526 }
+527
+528 private static List<String> filterTabComplete(String arg, List<String> cmds) {
+529 return cmds.stream()
+530 .distinct()
+531 .filter(cmd -> cmd != null && (arg.isEmpty() || ApacheCommonsLangUtil.startsWithIgnoreCase(cmd, arg)))
+532 .collect(Collectors.toList());
+533 }
+534
+535 RegisteredCommand getSubcommand(String subcommand) {
+536 return getSubcommand(subcommand, false);
+537 }
+538
+539 RegisteredCommand getSubcommand(String subcommand, boolean requireOne) {
+540 final Set<RegisteredCommand> commands = subCommands.get(subcommand);
+541 if (!commands.isEmpty() && (!requireOne || commands.size() == 1)) {
+542 return commands.iterator().next();
+543 }
+544 return null;
+545 }
+546
+547 private boolean executeSubcommand(CommandOperationContext commandContext, String subcommand, CommandIssuer issuer, String... args) {
+548 final RegisteredCommand cmd = this.getSubcommand(subcommand);
+549 if (cmd != null) {
+550 executeCommand(commandContext, issuer, args, cmd);
+551 return true;
+552 }
+553
+554 return false;
+555 }
+556
+557 private boolean checkPrecommand(CommandOperationContext commandOperationContext, RegisteredCommand cmd, CommandIssuer issuer, String[] args) {
+558 Method pre = this.preCommandHandler;
+559 if (pre != null) {
+560 try {
+561 Class<?>[] types = pre.getParameterTypes();
+562 Object[] parameters = new Object[pre.getParameterCount()];
+563 for (int i = 0; i < parameters.length; i++) {
+564 Class<?> type = types[i];
+565 Object issuerObject = issuer.getIssuer();
+566 if (manager.isCommandIssuer(type) && type.isAssignableFrom(issuerObject.getClass())) {
+567 parameters[i] = issuerObject;
+568 } else if (CommandIssuer.class.isAssignableFrom(type)) {
+569 parameters[i] = issuer;
+570 } else if (RegisteredCommand.class.isAssignableFrom(type)) {
+571 parameters[i] = cmd;
+572 } else if (String[].class.isAssignableFrom((type))) {
+573 parameters[i] = args;
+574 } else {
+575 parameters[i] = null;
+576 }
+577 }
+578
+579 return (boolean) pre.invoke(this, parameters);
+580 } catch (IllegalAccessException | InvocationTargetException e) {
+581 this.manager.log(LogLevel.ERROR, "Exception encountered while command pre-processing", e);
+582 }
+583 }
+584 return false;
+585 }
+586
+587 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
+588 public CommandHelp getCommandHelp() {
+589 return manager.generateCommandHelp();
+590 }
+591
+592 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
+593 public void showCommandHelp() {
+594 getCommandHelp().showHelp();
+595 }
+596
+597 public void help(Object issuer, String[] args) {
+598 help(manager.getCommandIssuer(issuer), args);
+599 }
+600 public void help(CommandIssuer issuer, String[] args) {
+601 issuer.sendMessage(MessageType.ERROR, MessageKeys.UNKNOWN_COMMAND);
+602 }
+603 public void doHelp(Object issuer, String... args) {
+604 doHelp(manager.getCommandIssuer(issuer), args);
+605 }
+606 public void doHelp(CommandIssuer issuer, String... args) {
+607 help(issuer, args);
+608 }
+609
+610 public void showSyntax(CommandIssuer issuer, RegisteredCommand<?> cmd) {
+611 issuer.sendMessage(MessageType.SYNTAX, MessageKeys.INVALID_SYNTAX,
+612 "{command}", "/" + cmd.command,
+613 "{syntax}", cmd.syntaxText
+614 );
+615 }
+616
+617 public boolean hasPermission(Object issuer) {
+618 return hasPermission(manager.getCommandIssuer(issuer));
+619 }
+620
+621 public boolean hasPermission(CommandIssuer issuer) {
+622 return permission == null || permission.isEmpty() || (manager.hasPermission(issuer, permission) && (parentCommand == null || parentCommand.hasPermission(issuer)));
+623 }
624
-625 public Set<String> getRequiredPermissions() {
-626 if (this.permission == null || this.permission.isEmpty()) {
-627 return ImmutableSet.of();
-628 }
-629 return Sets.newHashSet(ACFPatterns.COMMA.split(this.permission));
-630 }
-631
-632 public boolean requiresPermission(String permission) {
-633 return getRequiredPermissions().contains(permission) || this.parentCommand != null && parentCommand.requiresPermission(permission);
-634 }
-635
-636 public String getName() {
-637 return commandName;
-638 }
-639
-640 public ExceptionHandler getExceptionHandler() {
-641 return exceptionHandler;
-642 }
-643
-644 public BaseCommand setExceptionHandler(ExceptionHandler exceptionHandler) {
-645 this.exceptionHandler = exceptionHandler;
-646 return this;
-647 }
-648
-649 public RegisteredCommand getDefaultRegisteredCommand() {
-650 return this.getSubcommand(DEFAULT);
-651 }
-652
-653 public String setContextFlags(Class<?> cls, String flags) {
-654 return this.contextFlags.put(cls, flags);
-655 }
-656
-657 public String getContextFlags(Class<?> cls) {
-658 return this.contextFlags.get(cls);
-659 }
-660
-661 private static class CommandSearch { RegisteredCommand cmd; int argIndex; String checkSub;
-662
-663 CommandSearch(RegisteredCommand cmd, int argIndex, String checkSub) {
-664 this.cmd = cmd;
-665 this.argIndex = argIndex;
-666 this.checkSub = checkSub;
-667 }
-668
-669 String getCheckSub() {
-670 return this.checkSub;
-671 }
-672
-673 @Override
-674 public boolean equals(Object o) {
-675 if (this == o) return true;
-676 if (o == null || getClass() != o.getClass()) return false;
-677 CommandSearch that = (CommandSearch) o;
-678 return argIndex == that.argIndex &&
-679 Objects.equals(cmd, that.cmd) &&
-680 Objects.equals(checkSub, that.checkSub);
-681 }
-682
-683 @Override
-684 public int hashCode() {
-685 return Objects.hash(cmd, argIndex, checkSub);
-686 }
-687 }
-688}
+625
+626 public Set<String> getRequiredPermissions() {
+627 if (this.permission == null || this.permission.isEmpty()) {
+628 return ImmutableSet.of();
+629 }
+630 return Sets.newHashSet(ACFPatterns.COMMA.split(this.permission));
+631 }
+632
+633 public boolean requiresPermission(String permission) {
+634 return getRequiredPermissions().contains(permission) || this.parentCommand != null && parentCommand.requiresPermission(permission);
+635 }
+636
+637 public String getName() {
+638 return commandName;
+639 }
+640
+641 public ExceptionHandler getExceptionHandler() {
+642 return exceptionHandler;
+643 }
+644
+645 public BaseCommand setExceptionHandler(ExceptionHandler exceptionHandler) {
+646 this.exceptionHandler = exceptionHandler;
+647 return this;
+648 }
+649
+650 public RegisteredCommand getDefaultRegisteredCommand() {
+651 return this.getSubcommand(DEFAULT);
+652 }
+653
+654 public String setContextFlags(Class<?> cls, String flags) {
+655 return this.contextFlags.put(cls, flags);
+656 }
+657
+658 public String getContextFlags(Class<?> cls) {
+659 return this.contextFlags.get(cls);
+660 }
+661
+662 private static class CommandSearch { RegisteredCommand cmd; int argIndex; String checkSub;
+663
+664 CommandSearch(RegisteredCommand cmd, int argIndex, String checkSub) {
+665 this.cmd = cmd;
+666 this.argIndex = argIndex;
+667 this.checkSub = checkSub;
+668 }
+669
+670 String getCheckSub() {
+671 return this.checkSub;
+672 }
+673
+674 @Override
+675 public boolean equals(Object o) {
+676 if (this == o) return true;
+677 if (o == null || getClass() != o.getClass()) return false;
+678 CommandSearch that = (CommandSearch) o;
+679 return argIndex == that.argIndex &&
+680 Objects.equals(cmd, that.cmd) &&
+681 Objects.equals(checkSub, that.checkSub);
+682 }
+683
+684 @Override
+685 public int hashCode() {
+686 return Objects.hash(cmd, argIndex, checkSub);
+687 }
+688 }
+689}
diff --git a/docs/acf-core/src-html/co/aikar/commands/CommandCompletionContext.html b/docs/acf-core/src-html/co/aikar/commands/CommandCompletionContext.html
index 4efb9cdd..5c3a94ee 100644
--- a/docs/acf-core/src-html/co/aikar/commands/CommandCompletionContext.html
+++ b/docs/acf-core/src-html/co/aikar/commands/CommandCompletionContext.html
@@ -90,19 +90,19 @@
082 if (paramIdx >= command.parameters.length) {
083 throw new IllegalArgumentException("Param index is higher than number of parameters");
084 }
-085 Parameter param = command.parameters[paramIdx];
+085 CommandParameter param = command.parameters[paramIdx];
086 Class<?> paramType = param.getType();
087 if (!clazz.isAssignableFrom(paramType)) {
088 throw new IllegalArgumentException(param.getName() +":" + paramType.getName() + " can not satisfy " + clazz.getName());
089 }
090 name = param.getName();
091 } else {
-092 Parameter[] parameters = command.parameters;
+092 CommandParameter[] parameters = command.parameters;
093 for (int i = 0; i < parameters.length; i++) {
-094 Parameter param = parameters[i];
-095 if (clazz.isAssignableFrom(param.getType())) {
+094 final CommandParameter parameter = parameters[i];
+095 if (clazz.isAssignableFrom(parameter.getType())) {
096 paramIdx = i;
-097 name = param.getName();
+097 name = parameter.getName();
098 break;
099 }
100 }
diff --git a/docs/acf-core/src-html/co/aikar/commands/CommandContexts.html b/docs/acf-core/src-html/co/aikar/commands/CommandContexts.html
index 93e6a93c..f4ce8905 100644
--- a/docs/acf-core/src-html/co/aikar/commands/CommandContexts.html
+++ b/docs/acf-core/src-html/co/aikar/commands/CommandContexts.html
@@ -57,77 +57,77 @@
049 try {
050 return parseAndValidateNumber(c, Short.MAX_VALUE).shortValue();
051 } catch (NumberFormatException e) {
-052 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER);
+052 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", c.getFirstArg());
053 }
054 });
055 registerContext(short.class, (c) -> {
056 try {
057 return parseAndValidateNumber(c, Short.MAX_VALUE).shortValue();
058 } catch (NumberFormatException e) {
-059 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER);
+059 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", c.getFirstArg());
060 }
061 });
062 registerContext(Integer.class, (c) -> {
063 try {
064 return parseAndValidateNumber(c, Integer.MAX_VALUE).intValue();
065 } catch (NumberFormatException e) {
-066 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER);
+066 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", c.getFirstArg());
067 }
068 });
069 registerContext(int.class, (c) -> {
070 try {
071 return parseAndValidateNumber(c, Integer.MAX_VALUE).intValue();
072 } catch (NumberFormatException e) {
-073 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER);
+073 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", c.getFirstArg());
074 }
075 });
076 registerContext(Long.class, (c) -> {
077 try {
078 return parseAndValidateNumber(c, Long.MAX_VALUE).longValue();
079 } catch (NumberFormatException e) {
-080 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER);
+080 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", c.getFirstArg());
081 }
082 });
083 registerContext(long.class, (c) -> {
084 try {
085 return parseAndValidateNumber(c, Long.MAX_VALUE).longValue();
086 } catch (NumberFormatException e) {
-087 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER);
+087 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", c.getFirstArg());
088 }
089 });
090 registerContext(Float.class, (c) -> {
091 try {
092 return parseAndValidateNumber(c, Float.MAX_VALUE).floatValue();
093 } catch (NumberFormatException e) {
-094 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER);
+094 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", c.getFirstArg());
095 }
096 });
097 registerContext(float.class, (c) -> {
098 try {
099 return parseAndValidateNumber(c, Float.MAX_VALUE).floatValue();
100 } catch (NumberFormatException e) {
-101 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER);
+101 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", c.getFirstArg());
102 }
103 });
104 registerContext(Double.class, (c) -> {
105 try {
106 return parseAndValidateNumber(c, Double.MAX_VALUE).doubleValue();
107 } catch (NumberFormatException e) {
-108 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER);
+108 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", c.getFirstArg());
109 }
110 });
111 registerContext(double.class, (c) -> {
112 try {
113 return parseAndValidateNumber(c, Double.MAX_VALUE).doubleValue();
114 } catch (NumberFormatException e) {
-115 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER);
+115 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", c.getFirstArg());
116 }
117 });
118 registerContext(Number.class, (c) -> {
119 try {
120 return parseAndValidateNumber(c, Double.MAX_VALUE);
121 } catch (NumberFormatException e) {
-122 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER);
+122 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", c.getFirstArg());
123 }
124 });
125 registerContext(BigDecimal.class, (c) -> {
@@ -136,7 +136,7 @@
128 validateMinMax(c, number, null);
129 return number;
130 } catch (NumberFormatException e) {
-131 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER);
+131 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", c.getFirstArg());
132 }
133 });
134 registerContext(BigInteger.class, (c) -> {
@@ -145,7 +145,7 @@
137 validateMinMax(c, number, null);
138 return number.toBigIntegerExact();
139 } catch (NumberFormatException e) {
-140 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER);
+140 throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", c.getFirstArg());
141 }
142 });
143 registerContext(Boolean.class, (c) -> ACFUtil.isTruthy(c.popFirstArg()));
@@ -251,84 +251,85 @@
243
244 @NotNull
245 private Number parseAndValidateNumber(R c, Number maxValue) throws InvalidCommandArgument {
-246 Number val = ACFUtil.parseNumber(c.popFirstArg(), c.hasFlag("suffixes"));
+246 Number val = ACFUtil.parseNumber(c.getFirstArg(), c.hasFlag("suffixes"));
247 validateMinMax(c, val, maxValue);
-248 return val;
-249 }
-250
-251 private void validateMinMax(R c, Number val, Number maxValue) throws InvalidCommandArgument {
-252 Number minValue = c.getFlagValue("min", (Integer) null);
-253 maxValue = c.getFlagValue("max", maxValue != null ? maxValue.intValue() : null);
-254 if (maxValue != null && val.doubleValue() > maxValue.doubleValue()) {
-255 throw new InvalidCommandArgument(MessageKeys.PLEASE_SPECIFY_AT_MOST, "{max}", String.valueOf(maxValue));
-256 }
-257 if (minValue != null && val.doubleValue() < minValue.doubleValue()) {
-258 throw new InvalidCommandArgument(MessageKeys.PLEASE_SPECIFY_AT_LEAST, "{min}", String.valueOf(minValue));
-259 }
-260 }
-261
+248 c.popFirstArg(); // pop later so we can have a chance to display a nicer error message
+249 return val;
+250 }
+251
+252 private void validateMinMax(R c, Number val, Number maxValue) throws InvalidCommandArgument {
+253 Number minValue = c.getFlagValue("min", (Integer) null);
+254 maxValue = c.getFlagValue("max", maxValue != null ? maxValue.intValue() : null);
+255 if (maxValue != null && val.doubleValue() > maxValue.doubleValue()) {
+256 throw new InvalidCommandArgument(MessageKeys.PLEASE_SPECIFY_AT_MOST, "{max}", String.valueOf(maxValue));
+257 }
+258 if (minValue != null && val.doubleValue() < minValue.doubleValue()) {
+259 throw new InvalidCommandArgument(MessageKeys.PLEASE_SPECIFY_AT_LEAST, "{min}", String.valueOf(minValue));
+260 }
+261 }
262
-263 /**
-264 * @deprecated Please switch to {@link #registerIssuerAwareContext(Class, IssuerAwareContextResolver)}
-265 * as the core wants to use the platform agnostic term of "Issuer" instead of Sender
-266 * @see #registerIssuerAwareContext(Class, IssuerAwareContextResolver)
-267 */
-268 @Deprecated
-269 public <T> void registerSenderAwareContext(Class<T> context, IssuerAwareContextResolver<T, R> supplier) {
-270 contextMap.put(context, supplier);
-271 }
-272
-273 /**
-274 * Registers a context resolver that may conditionally consume input, falling back to using the context of the
-275 * issuer to potentially fulfill this context.
-276 * You may call {@link CommandExecutionContext#getFirstArg()} and then conditionally call {@link CommandExecutionContext#popFirstArg()}
-277 * if you want to consume that input.
-278 */
-279 public <T> void registerIssuerAwareContext(Class<T> context, IssuerAwareContextResolver<T, R> supplier) {
-280 contextMap.put(context, supplier);
-281 }
-282
-283 /**
-284 * Registers a context resolver that will never consume input. It will always satisfy its context based on the
-285 * issuer of the command, so it will not appear in syntax strings.
-286 */
-287 public <T> void registerIssuerOnlyContext(Class<T> context, IssuerOnlyContextResolver<T, R> supplier) {
-288 contextMap.put(context, supplier);
-289 }
-290
-291 /**
-292 * Registers a context that can safely accept a null input from the command issuer to resolve. This resolver should always
-293 * call {@link CommandExecutionContext#popFirstArg()}
-294 */
-295 public <T> void registerOptionalContext(Class<T> context, OptionalContextResolver<T, R> supplier) {
-296 contextMap.put(context, supplier);
-297 }
-298
-299 /**
-300 * Registers a context that requires input from the command issuer to resolve. This resolver should always
-301 * call {@link CommandExecutionContext#popFirstArg()}
-302 */
-303 public <T> void registerContext(Class<T> context, ContextResolver<T, R> supplier) {
-304 contextMap.put(context, supplier);
-305 }
-306
-307 public ContextResolver<?, R> getResolver(Class<?> type) {
-308 Class<?> rootType = type;
-309 do {
-310 if (type == Object.class) {
-311 break;
-312 }
-313
-314 final ContextResolver<?, R> resolver = contextMap.get(type);
-315 if (resolver != null) {
-316 return resolver;
-317 }
-318 } while ((type = type.getSuperclass()) != null);
-319
-320 this.manager.log(LogLevel.ERROR, "Could not find context resolver", new IllegalStateException("No context resolver defined for " + rootType.getName()));
-321 return null;
-322 }
-323}
+263
+264 /**
+265 * @deprecated Please switch to {@link #registerIssuerAwareContext(Class, IssuerAwareContextResolver)}
+266 * as the core wants to use the platform agnostic term of "Issuer" instead of Sender
+267 * @see #registerIssuerAwareContext(Class, IssuerAwareContextResolver)
+268 */
+269 @Deprecated
+270 public <T> void registerSenderAwareContext(Class<T> context, IssuerAwareContextResolver<T, R> supplier) {
+271 contextMap.put(context, supplier);
+272 }
+273
+274 /**
+275 * Registers a context resolver that may conditionally consume input, falling back to using the context of the
+276 * issuer to potentially fulfill this context.
+277 * You may call {@link CommandExecutionContext#getFirstArg()} and then conditionally call {@link CommandExecutionContext#popFirstArg()}
+278 * if you want to consume that input.
+279 */
+280 public <T> void registerIssuerAwareContext(Class<T> context, IssuerAwareContextResolver<T, R> supplier) {
+281 contextMap.put(context, supplier);
+282 }
+283
+284 /**
+285 * Registers a context resolver that will never consume input. It will always satisfy its context based on the
+286 * issuer of the command, so it will not appear in syntax strings.
+287 */
+288 public <T> void registerIssuerOnlyContext(Class<T> context, IssuerOnlyContextResolver<T, R> supplier) {
+289 contextMap.put(context, supplier);
+290 }
+291
+292 /**
+293 * Registers a context that can safely accept a null input from the command issuer to resolve. This resolver should always
+294 * call {@link CommandExecutionContext#popFirstArg()}
+295 */
+296 public <T> void registerOptionalContext(Class<T> context, OptionalContextResolver<T, R> supplier) {
+297 contextMap.put(context, supplier);
+298 }
+299
+300 /**
+301 * Registers a context that requires input from the command issuer to resolve. This resolver should always
+302 * call {@link CommandExecutionContext#popFirstArg()}
+303 */
+304 public <T> void registerContext(Class<T> context, ContextResolver<T, R> supplier) {
+305 contextMap.put(context, supplier);
+306 }
+307
+308 public ContextResolver<?, R> getResolver(Class<?> type) {
+309 Class<?> rootType = type;
+310 do {
+311 if (type == Object.class) {
+312 break;
+313 }
+314
+315 final ContextResolver<?, R> resolver = contextMap.get(type);
+316 if (resolver != null) {
+317 return resolver;
+318 }
+319 } while ((type = type.getSuperclass()) != null);
+320
+321 this.manager.log(LogLevel.ERROR, "Could not find context resolver", new IllegalStateException("No context resolver defined for " + rootType.getName()));
+322 return null;
+323 }
+324}
diff --git a/docs/acf-core/src-html/co/aikar/commands/CommandExecutionContext.html b/docs/acf-core/src-html/co/aikar/commands/CommandExecutionContext.html
index c44a6864..a644c228 100644
--- a/docs/acf-core/src-html/co/aikar/commands/CommandExecutionContext.html
+++ b/docs/acf-core/src-html/co/aikar/commands/CommandExecutionContext.html
@@ -31,196 +31,151 @@
023
024package co.aikar.commands;
025
-026import co.aikar.commands.annotation.Default;
-027import co.aikar.commands.annotation.Flags;
-028import co.aikar.commands.annotation.Optional;
-029import co.aikar.commands.contexts.ContextResolver;
-030import co.aikar.commands.contexts.IssuerAwareContextResolver;
-031import co.aikar.commands.contexts.IssuerOnlyContextResolver;
-032import com.google.common.collect.Maps;
-033
-034import java.lang.annotation.Annotation;
-035import java.lang.reflect.Parameter;
-036import java.util.List;
-037import java.util.Map;
-038
-039@SuppressWarnings({"WeakerAccess", "unused"})
-040public class CommandExecutionContext <CEC extends CommandExecutionContext, I extends CommandIssuer> {
-041 private final RegisteredCommand cmd;
-042 private final Parameter param;
-043 protected final I issuer;
-044 private final List<String> args;
-045 private final int index;
-046 private final Map<String, Object> passedArgs;
-047 private final Map<String, String> flags;
-048 private final CommandManager manager;
-049
-050 CommandExecutionContext(RegisteredCommand cmd, Parameter param, I sender, List<String> args,
-051 int index, Map<String, Object> passedArgs) {
-052 this.cmd = cmd;
-053 this.manager = cmd.scope.manager;
-054 this.param = param;
-055 this.issuer = sender;
-056 this.args = args;
-057 this.index = index;
-058 this.passedArgs = passedArgs;
-059 this.flags = Maps.newHashMap();
-060 Flags flags = param.getAnnotation(Flags.class);
-061 if (flags != null) {
-062 parseFlags(flags.value());
-063 }
-064 inheritContextFlags(cmd.scope);
-065 }
-066
-067 private void inheritContextFlags(BaseCommand scope) {
-068 if (!scope.contextFlags.isEmpty()) {
-069 Class<?> pCls = param.getType();
-070 do {
-071 parseFlags(scope.contextFlags.get(pCls));
-072 } while ((pCls = pCls.getSuperclass()) != null);
-073 }
-074 if (scope.parentCommand != null) {
-075 inheritContextFlags(scope.parentCommand);
-076 }
-077 }
-078
-079 private void parseFlags(String flags) {
-080 if (flags != null) {
-081 for (String s : ACFPatterns.COMMA.split(manager.getCommandReplacements().replace(flags))) {
-082 String[] v = ACFPatterns.EQUALS.split(s, 2);
-083 if (!this.flags.containsKey(v[0])) {
-084 this.flags.put(v[0], v.length > 1 ? v[1] : null);
-085 }
-086 }
-087 }
-088 }
-089
-090 public String popFirstArg() {
-091 return !args.isEmpty() ? args.remove(0) : null;
-092 }
-093
-094 public String popLastArg() {
-095 return !args.isEmpty() ? args.remove(args.size() - 1) : null;
-096 }
+026import co.aikar.commands.contexts.ContextResolver;
+027
+028import java.lang.annotation.Annotation;
+029import java.lang.reflect.Parameter;
+030import java.util.List;
+031import java.util.Map;
+032
+033@SuppressWarnings({"WeakerAccess", "unused"})
+034public class CommandExecutionContext <CEC extends CommandExecutionContext, I extends CommandIssuer> {
+035 private final RegisteredCommand cmd;
+036 private final CommandParameter param;
+037 protected final I issuer;
+038 private final List<String> args;
+039 private final int index;
+040 private final Map<String, Object> passedArgs;
+041 private final Map<String, String> flags;
+042 private final CommandManager manager;
+043
+044 CommandExecutionContext(RegisteredCommand cmd, CommandParameter param, I sender, List<String> args,
+045 int index, Map<String, Object> passedArgs) {
+046 this.cmd = cmd;
+047 this.manager = cmd.scope.manager;
+048 this.param = param;
+049 this.issuer = sender;
+050 this.args = args;
+051 this.index = index;
+052 this.passedArgs = passedArgs;
+053 this.flags = param.getFlags();
+054
+055 }
+056
+057 public String popFirstArg() {
+058 return !args.isEmpty() ? args.remove(0) : null;
+059 }
+060
+061 public String popLastArg() {
+062 return !args.isEmpty() ? args.remove(args.size() - 1) : null;
+063 }
+064
+065 public String getFirstArg() {
+066 return !args.isEmpty() ? args.get(0) : null;
+067 }
+068
+069 public String getLastArg() {
+070 return !args.isEmpty() ? args.get(args.size() - 1) : null;
+071 }
+072
+073 public boolean isLastArg() {
+074 return cmd.parameters.length -1 == index;
+075 }
+076
+077 public int getNumParams() {
+078 return cmd.parameters.length;
+079 }
+080
+081 public boolean canOverridePlayerContext() {
+082 return cmd.requiredResolvers >= args.size();
+083 }
+084
+085 public Object getResolvedArg(String arg) {
+086 return passedArgs.get(arg);
+087 }
+088
+089 public Object getResolvedArg(Class<?>... classes) {
+090 for (Class<?> clazz : classes) {
+091 for (Object passedArg : passedArgs.values()) {
+092 if (clazz.isInstance(passedArg)) {
+093 return passedArg;
+094 }
+095 }
+096 }
097
-098 public String getFirstArg() {
-099 return !args.isEmpty() ? args.get(0) : null;
-100 }
-101
-102 public String getLastArg() {
-103 return !args.isEmpty() ? args.get(args.size() - 1) : null;
-104 }
-105
-106 public boolean isLastArg() {
-107 return cmd.parameters.length -1 == index;
-108 }
+098 return null;
+099 }
+100
+101 public <T> T getResolvedArg(String key, Class<?>... classes) {
+102 final Object o = passedArgs.get(key);
+103 for (Class<?> clazz : classes) {
+104 if (clazz.isInstance(o)) {
+105 //noinspection unchecked
+106 return (T) o;
+107 }
+108 }
109
-110 public int getNumParams() {
-111 return cmd.parameters.length;
-112 }
-113
-114 public boolean canOverridePlayerContext() {
-115 int numRequired = getNumParams();
-116 for (int i = 0; i < cmd.resolvers.length; i++) {
-117 Parameter parameter = cmd.parameters[i];
-118 //noinspection unchecked
-119 ContextResolver<?, ?> resolver = cmd.resolvers[i];
-120 if (parameter.getAnnotation(Optional.class) != null || parameter.getAnnotation(Default.class) != null) {
-121 numRequired--;
-122 } else if (resolver instanceof IssuerAwareContextResolver || resolver instanceof IssuerOnlyContextResolver) {
-123 numRequired--;
-124 }
-125 }
-126
-127 return numRequired >= args.size();
-128 }
-129
-130 public Object getResolvedArg(String arg) {
-131 return passedArgs.get(arg);
-132 }
-133
-134 public Object getResolvedArg(Class<?>... classes) {
-135 for (Class<?> clazz : classes) {
-136 for (Object passedArg : passedArgs.values()) {
-137 if (clazz.isInstance(passedArg)) {
-138 return passedArg;
-139 }
-140 }
-141 }
-142
-143 return null;
-144 }
-145
-146 public <T> T getResolvedArg(String key, Class<?>... classes) {
-147 final Object o = passedArgs.get(key);
-148 for (Class<?> clazz : classes) {
-149 if (clazz.isInstance(o)) {
-150 //noinspection unchecked
-151 return (T) o;
-152 }
-153 }
-154
-155 return null;
-156 }
-157
-158 public boolean isOptional() {
-159 return param.getAnnotation(Optional.class) != null;
-160 }
-161 public boolean hasFlag(String flag) {
-162 return flags.containsKey(flag);
-163 }
-164
-165 public String getFlagValue(String flag, String def) {
-166 return flags.getOrDefault(flag, def);
-167 }
-168
-169 public Integer getFlagValue(String flag, Integer def) {
-170 return ACFUtil.parseInt(this.flags.get(flag), def);
-171 }
-172
-173 public <T extends Annotation> T getAnnotation(Class<T> cls) {
-174 return param.getAnnotation(cls);
-175 }
-176
-177 public <T extends Annotation> boolean hasAnnotation(Class<T> cls) {
-178 return param.getAnnotation(cls) != null;
-179 }
-180
-181 public RegisteredCommand getCmd() {
-182 return this.cmd;
-183 }
-184
-185 public Parameter getParam() {
-186 return this.param;
-187 }
-188
-189 public I getIssuer() {
-190 return this.issuer;
-191 }
-192
-193 public List<String> getArgs() {
-194 return this.args;
-195 }
-196
-197 public int getIndex() {
-198 return this.index;
-199 }
-200
-201 public Map<String, Object> getPassedArgs() {
-202 return this.passedArgs;
-203 }
-204
-205 public Map<String, String> getFlags() {
-206 return this.flags;
-207 }
-208
-209 public String joinArgs() {
-210 return ACFUtil.join(args, " ");
-211 }
-212 public String joinArgs(String sep) {
-213 return ACFUtil.join(args, sep);
-214 }
-215}
+110 return null;
+111 }
+112
+113 public boolean isOptional() {
+114 return param.isOptional();
+115 }
+116 public boolean hasFlag(String flag) {
+117 return flags.containsKey(flag);
+118 }
+119
+120 public String getFlagValue(String flag, String def) {
+121 return flags.getOrDefault(flag, def);
+122 }
+123
+124 public Integer getFlagValue(String flag, Integer def) {
+125 return ACFUtil.parseInt(this.flags.get(flag), def);
+126 }
+127
+128 public <T extends Annotation> T getAnnotation(Class<T> cls) {
+129 return param.getParameter().getAnnotation(cls);
+130 }
+131
+132 public <T extends Annotation> boolean hasAnnotation(Class<T> cls) {
+133 return param.getParameter().isAnnotationPresent(cls);
+134 }
+135
+136 public RegisteredCommand getCmd() {
+137 return this.cmd;
+138 }
+139
+140 public Parameter getParam() {
+141 return this.param.getParameter();
+142 }
+143
+144 public I getIssuer() {
+145 return this.issuer;
+146 }
+147
+148 public List<String> getArgs() {
+149 return this.args;
+150 }
+151
+152 public int getIndex() {
+153 return this.index;
+154 }
+155
+156 public Map<String, Object> getPassedArgs() {
+157 return this.passedArgs;
+158 }
+159
+160 public Map<String, String> getFlags() {
+161 return this.flags;
+162 }
+163
+164 public String joinArgs() {
+165 return ACFUtil.join(args, " ");
+166 }
+167 public String joinArgs(String sep) {
+168 return ACFUtil.join(args, sep);
+169 }
+170}
diff --git a/docs/acf-core/src-html/co/aikar/commands/CommandManager.html b/docs/acf-core/src-html/co/aikar/commands/CommandManager.html
index 8a6ab13b..dc79274a 100644
--- a/docs/acf-core/src-html/co/aikar/commands/CommandManager.html
+++ b/docs/acf-core/src-html/co/aikar/commands/CommandManager.html
@@ -43,459 +43,458 @@
035import java.lang.reflect.Field;
036import java.lang.reflect.InvocationTargetException;
037import java.lang.reflect.Method;
-038import java.lang.reflect.Parameter;
-039import java.util.HashMap;
-040import java.util.IdentityHashMap;
-041import java.util.List;
-042import java.util.Locale;
-043import java.util.Map;
-044import java.util.Objects;
-045import java.util.Set;
-046import java.util.Stack;
-047import java.util.UUID;
+038import java.util.HashMap;
+039import java.util.IdentityHashMap;
+040import java.util.List;
+041import java.util.Locale;
+042import java.util.Map;
+043import java.util.Objects;
+044import java.util.Set;
+045import java.util.Stack;
+046import java.util.UUID;
+047
048
-049
-050@SuppressWarnings("WeakerAccess")
-051public abstract class CommandManager <
-052 IT,
-053 I extends CommandIssuer,
-054 FT,
-055 MF extends MessageFormatter<FT>,
-056 CEC extends CommandExecutionContext<CEC, I>,
-057 CC extends ConditionContext<I>
-058 > {
-059
-060 /**
-061 * This is a stack incase a command calls a command
-062 */
-063 static ThreadLocal<Stack<CommandOperationContext>> commandOperationContext = ThreadLocal.withInitial(() -> new Stack<CommandOperationContext>() {
-064 @Override
-065 public synchronized CommandOperationContext peek() {
-066 return super.size() == 0 ? null : super.peek();
-067 }
-068 });
-069 protected Map<String, RootCommand> rootCommands = new HashMap<>();
-070 protected final CommandReplacements replacements = new CommandReplacements(this);
-071 protected final CommandConditions<I, CEC, CC> conditions = new CommandConditions<>(this);
-072 protected ExceptionHandler defaultExceptionHandler = null;
-073 protected Table<Class<?>, String, Object> dependencies = HashBasedTable.create();
-074
-075 protected boolean usePerIssuerLocale = false;
-076 protected List<IssuerLocaleChangedCallback<I>> localeChangedCallbacks = Lists.newArrayList();
-077 protected Set<Locale> supportedLanguages = Sets.newHashSet(Locales.ENGLISH, Locales.GERMAN, Locales.SPANISH, Locales.CZECH, Locales.PORTUGUESE);
-078 protected Map<MessageType, MF> formatters = new IdentityHashMap<>();
-079 protected MF defaultFormatter;
-080 protected int defaultHelpPerPage = 10;
-081
-082 protected Map<UUID, Locale> issuersLocale = Maps.newConcurrentMap();
-083
-084 private Set<String> unstableAPIs = Sets.newHashSet();
-085
-086 public static CommandOperationContext getCurrentCommandOperationContext() {
-087 return commandOperationContext.get().peek();
-088 }
-089
-090 public static CommandIssuer getCurrentCommandIssuer() {
-091 CommandOperationContext context = commandOperationContext.get().peek();
-092 return context != null ? context.getCommandIssuer() : null;
-093 }
-094
-095 public static CommandManager getCurrentCommandManager() {
-096 CommandOperationContext context = commandOperationContext.get().peek();
-097 return context != null ? context.getCommandManager() : null;
-098 }
-099
-100 public MF setFormat(MessageType type, MF formatter) {
-101 return formatters.put(type, formatter);
-102 }
-103
-104 public MF getFormat(MessageType type) {
-105 return formatters.getOrDefault(type, defaultFormatter);
-106 }
-107
-108 public void setFormat(MessageType type, FT... colors) {
-109 MF format = getFormat(type);
-110 for (int i = 1; i <= colors.length; i++) {
-111 format.setColor(i, colors[i-1]);
-112 }
-113 }
-114
-115 public void setFormat(MessageType type, int i, FT color) {
-116 MF format = getFormat(type);
-117 format.setColor(i, color);
-118 }
-119
-120 public MF getDefaultFormatter() {
-121 return defaultFormatter;
-122 }
-123
-124 public void setDefaultFormatter(MF defaultFormatter) {
-125 this.defaultFormatter = defaultFormatter;
-126 }
-127
-128 public CommandConditions<I, CEC, CC> getCommandConditions() {
-129 return conditions;
-130 }
-131
-132 /**
-133 * Gets the command contexts manager
-134 * @return Command Contexts
-135 */
-136 public abstract CommandContexts<?> getCommandContexts();
-137
-138 /**
-139 * Gets the command completions manager
-140 * @return Command Completions
-141 */
-142 public abstract CommandCompletions<?> getCommandCompletions();
-143
-144 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
-145 public CommandHelp generateCommandHelp(@NotNull String command) {
-146 verifyUnstableAPI("help");
-147 CommandOperationContext context = getCurrentCommandOperationContext();
-148 if (context == null) {
-149 throw new IllegalStateException("This method can only be called as part of a command execution.");
-150 }
-151 return generateCommandHelp(context.getCommandIssuer(), command);
-152 }
-153
-154 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
-155 public CommandHelp generateCommandHelp(CommandIssuer issuer, @NotNull String command) {
-156 verifyUnstableAPI("help");
-157 return generateCommandHelp(issuer, obtainRootCommand(command));
-158 }
-159
-160 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
-161 public CommandHelp generateCommandHelp() {
-162 verifyUnstableAPI("help");
-163 CommandOperationContext context = getCurrentCommandOperationContext();
-164 if (context == null) {
-165 throw new IllegalStateException("This method can only be called as part of a command execution.");
-166 }
-167 String commandLabel = context.getCommandLabel();
-168 return generateCommandHelp(context.getCommandIssuer(), this.obtainRootCommand(commandLabel));
-169 }
-170
-171 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
-172 public CommandHelp generateCommandHelp(CommandIssuer issuer, RootCommand rootCommand) {
-173 verifyUnstableAPI("help");
-174 return new CommandHelp(this, rootCommand, issuer);
-175 }
-176
-177 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
-178 public int getDefaultHelpPerPage() {
-179 verifyUnstableAPI("help");
-180 return defaultHelpPerPage;
-181 }
-182
-183 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
-184 public void setDefaultHelpPerPage(int defaultHelpPerPage) {
-185 verifyUnstableAPI("help");
-186 this.defaultHelpPerPage = defaultHelpPerPage;
-187 }
-188
-189 /**
-190 * Registers a command with ACF
-191 *
-192 * @param command The command to register
-193 * @return boolean
-194 */
-195 public abstract void registerCommand(BaseCommand command);
-196 public abstract boolean hasRegisteredCommands();
-197 public abstract boolean isCommandIssuer(Class<?> type);
-198
-199 // TODO: Change this to IT if we make a breaking change
-200 public abstract I getCommandIssuer(Object issuer);
-201
-202 public abstract RootCommand createRootCommand(String cmd);
-203
-204 /**
-205 * Returns a Locales Manager to add and modify language tables for your commands.
-206 * @return
-207 */
-208 public abstract Locales getLocales();
-209
-210 public boolean usingPerIssuerLocale() {
-211 return usePerIssuerLocale;
-212 }
-213
-214 public boolean usePerIssuerLocale(boolean setting) {
-215 boolean old = usePerIssuerLocale;
-216 usePerIssuerLocale = setting;
-217 return old;
-218 }
-219
-220 public ConditionContext createConditionContext(CommandIssuer issuer, String config) {
-221 //noinspection unchecked
-222 return new ConditionContext(issuer, config);
-223 }
-224
-225 public abstract CommandExecutionContext createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs);
-226
-227 public abstract CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args);
-228
-229 public abstract void log(final LogLevel level, final String message, final Throwable throwable);
-230
-231 public void log(final LogLevel level, final String message) {
-232 log(level, message, null);
-233 }
-234
-235 /**
-236 * Lets you add custom string replacements that can be applied to annotation values,
-237 * to reduce duplication/repetition of common values such as permission nodes and command prefixes.
-238 *
-239 * Any replacement registered starts with a %
-240 *
-241 * So for ex @CommandPermission("%staff")
-242 * @return Replacements Manager
-243 */
-244 public CommandReplacements getCommandReplacements() {
-245 return replacements;
-246 }
-247
-248 public boolean hasPermission(CommandIssuer issuer, String permission) {
-249 if (permission == null || permission.isEmpty()) {
-250 return true;
-251 }
-252 for (String perm : ACFPatterns.COMMA.split(permission)) {
-253 if (!perm.isEmpty() && !issuer.hasPermission(perm)) {
-254 return false;
-255 }
-256 }
-257 return true;
-258 }
-259
-260 BaseCommand getBaseCommand(String commandLabel, @NotNull String[] args) {
-261 RootCommand rootCommand = obtainRootCommand(commandLabel);
-262 if (rootCommand == null) {
-263 return null;
-264 }
-265 return rootCommand.getBaseCommand(args);
-266 }
-267
-268 public synchronized RootCommand getRootCommand(@NotNull String cmd) {
-269 return rootCommands.get(ACFPatterns.SPACE.split(cmd.toLowerCase(), 2)[0]);
-270 }
-271
-272 public synchronized RootCommand obtainRootCommand(@NotNull String cmd) {
-273 return rootCommands.computeIfAbsent(ACFPatterns.SPACE.split(cmd.toLowerCase(), 2)[0], this::createRootCommand);
-274 }
-275
-276 public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) {
-277 return new RegisteredCommand(command, cmdName, method, prefSubCommand);
-278 }
-279
-280 /**
-281 * Sets the default {@link ExceptionHandler} that is called when an exception occurs while executing a command, if the command doesn't have it's own exception handler registered.
-282 *
-283 * @param exceptionHandler the handler that should handle uncaught exceptions
-284 */
-285 public void setDefaultExceptionHandler(ExceptionHandler exceptionHandler) {
-286 defaultExceptionHandler = exceptionHandler;
-287 }
-288
-289 /**
-290 * Gets the current default exception handler, might be null.
-291 *
-292 * @return the default exception handler
-293 */
-294 public ExceptionHandler getDefaultExceptionHandler() {
-295 return defaultExceptionHandler;
-296 }
-297
-298 protected boolean handleUncaughtException(BaseCommand scope, RegisteredCommand registeredCommand, CommandIssuer sender, List<String> args, Throwable t) {
-299 if (t instanceof InvocationTargetException && t.getCause() != null) {
-300 t = t.getCause();
-301 }
-302 boolean result = false;
-303 if (scope.getExceptionHandler() != null) {
-304 result = scope.getExceptionHandler().execute(scope, registeredCommand, sender, args, t);
-305 } else if (defaultExceptionHandler != null) {
-306 result = defaultExceptionHandler.execute(scope, registeredCommand, sender, args, t);
-307 }
-308 return result;
-309 }
-310
-311 public void sendMessage(IT issuerArg, MessageType type, MessageKeyProvider key, String... replacements) {
-312 sendMessage(getCommandIssuer(issuerArg), type, key, replacements);
-313 }
-314
-315 public void sendMessage(CommandIssuer issuer, MessageType type, MessageKeyProvider key, String... replacements) {
-316 String message = formatMessage(issuer, type, key, replacements);
-317
-318 for (String msg : ACFPatterns.NEWLINE.split(message)) {
-319 issuer.sendMessageInternal(ACFUtil.rtrim(msg));
-320 }
-321 }
-322
-323 public String formatMessage(CommandIssuer issuer, MessageType type, MessageKeyProvider key, String... replacements) {
-324 String message = getLocales().getMessage(issuer, key.getMessageKey());
-325 if (replacements.length > 0) {
-326 message = ACFUtil.replaceStrings(message, replacements);
-327 }
-328
-329 message = getCommandReplacements().replace(message);
-330
-331 MessageFormatter formatter = formatters.getOrDefault(type, defaultFormatter);
-332 if (formatter != null) {
-333 message = formatter.format(message);
-334 }
-335 return message;
-336 }
-337
-338 public void onLocaleChange(IssuerLocaleChangedCallback<I> onChange) {
-339 localeChangedCallbacks.add(onChange);
-340 }
-341
-342 public void notifyLocaleChange(I issuer, Locale oldLocale, Locale newLocale) {
-343 localeChangedCallbacks.forEach(cb -> {
-344 try {
-345 cb.onIssuerLocaleChange(issuer, oldLocale, newLocale);
-346 } catch (Exception e) {
-347 this.log(LogLevel.ERROR, "Error in notifyLocaleChange", e);
-348 }
-349 });
-350 }
-351
-352 public Locale setIssuerLocale(IT issuer, Locale locale) {
-353 I commandIssuer = getCommandIssuer(issuer);
-354
-355 Locale old = issuersLocale.put(commandIssuer.getUniqueId(), locale);
-356 if (!Objects.equals(old, locale)) {
-357 this.notifyLocaleChange(commandIssuer, old, locale);
-358 }
-359
-360 return old;
-361 }
-362
-363 public Locale getIssuerLocale(CommandIssuer issuer) {
-364 if (usingPerIssuerLocale()) {
-365 Locale locale = issuersLocale.get(issuer.getUniqueId());
-366 if (locale != null) {
-367 return locale;
-368 }
-369 }
-370
-371 return getLocales().getDefaultLocale();
-372 }
-373
-374 CommandOperationContext<I> createCommandOperationContext(BaseCommand command, CommandIssuer issuer, String commandLabel, String[] args, boolean isAsync) {
-375 //noinspection unchecked
-376 return new CommandOperationContext<>(
-377 this,
-378 (I) issuer,
-379 command,
-380 commandLabel,
-381 args,
-382 isAsync
-383 );
-384 }
-385
-386 /**
-387 * Gets a list of all currently supported languages for this manager.
-388 * These locales will be automatically loaded from
-389 * @return
-390 */
-391 public Set<Locale> getSupportedLanguages() {
-392 return supportedLanguages;
-393 }
-394
-395 /**
-396 * Adds a new locale to the list of automatic Locales to load Message Bundles for.
-397 * All bundles loaded under the previous supported languages will now automatically load for this new locale too.
-398 *
-399 * @param locale
-400 */
-401 public void addSupportedLanguage(Locale locale) {
-402 supportedLanguages.add(locale);
-403 getLocales().loadMissingBundles();
-404 }
-405
-406 /**
-407 * Registers an instance of a class to be registered as an injectable dependency.<br>
-408 * The command manager will attempt to inject all fields in a command class that are annotated with
-409 * {@link co.aikar.commands.annotation.Dependency} with the provided instance.
-410 *
-411 * @param clazz the class the injector should look for when injecting
-412 * @param instance the instance of the class that should be injected
-413 * @throws IllegalStateException when there is already an instance for the provided class registered
-414 */
-415 public <T> void registerDependency(Class<? extends T> clazz, T instance){
-416 registerDependency(clazz, clazz.getName(), instance);
-417 }
-418
-419 /**
-420 * Registers an instance of a class to be registered as an injectable dependency.<br>
-421 * The command manager will attempt to inject all fields in a command class that are annotated with
-422 * {@link co.aikar.commands.annotation.Dependency} with the provided instance.
-423 *
-424 * @param clazz the class the injector should look for when injecting
-425 * @param key the key which needs to be present if that
-426 * @param instance the instance of the class that should be injected
-427 * @throws IllegalStateException when there is already an instance for the provided class registered
-428 */
-429 public <T> void registerDependency(Class<? extends T> clazz, String key, T instance){
-430 if(dependencies.containsRow(clazz) && dependencies.containsColumn(key)){
-431 throw new IllegalStateException("There is already an instance of " + clazz.getName() + " with the key " + key + " registered!");
-432 }
-433
-434 dependencies.put(clazz, key, instance);
-435 }
-436
-437 /**
-438 * Attempts to inject instances of classes registered with {@link CommandManager#registerDependency(Class, Object)}
-439 * into all fields of the class and its superclasses that are marked with {@link Dependency}.
-440 *
-441 * @param baseCommand the instance which fields should be filled
-442 */
-443 void injectDependencies(BaseCommand baseCommand) {
-444 Class clazz = baseCommand.getClass();
-445 do {
-446 for (Field field : clazz.getDeclaredFields()) {
-447 if (field.isAnnotationPresent(Dependency.class)) {
-448 Dependency dependency = field.getAnnotation(Dependency.class);
-449 String key = (key = dependency.value()).equals("") ? field.getType().getName() : key;
-450 Object object = dependencies.row(field.getType()).get(key);
-451 if (object == null) {
-452 throw new UnresolvedDependencyException("Could not find a registered instance of " +
-453 field.getType().getName() + " with key " + key + " for field " + field.getName() +
-454 " in class " + baseCommand.getClass().getName());
-455 }
-456
-457 try {
-458 boolean accessible = field.isAccessible();
-459 if (!accessible) {
-460 field.setAccessible(true);
-461 }
-462 field.set(baseCommand, object);
-463 field.setAccessible(accessible);
-464 } catch (IllegalAccessException e) {
-465 e.printStackTrace(); //TODO should we print our own exception here to make a more descriptive error?
-466 }
-467 }
-468 }
-469 clazz = clazz.getSuperclass();
-470 } while (!clazz.equals(BaseCommand.class));
-471 }
-472
-473 /**
-474 * @deprecated Use this with caution! If you enable and use Unstable API's, your next compile using ACF
-475 * may require you to update your implementation to those unstable API's
-476 */
-477 @Deprecated
-478 public void enableUnstableAPI(String api) {
-479 unstableAPIs.add(api);
-480 }
-481 void verifyUnstableAPI(String api) {
-482 if (!unstableAPIs.contains(api)) {
-483 throw new IllegalStateException("Using an unstable API that has not been enabled ( " + api + "). See https://acfunstable.emc.gs");
-484 }
-485 }
-486
-487 boolean hasUnstableAPI(String api) {
-488 return unstableAPIs.contains(api);
-489 }
-490}
+049@SuppressWarnings("WeakerAccess")
+050public abstract class CommandManager <
+051 IT,
+052 I extends CommandIssuer,
+053 FT,
+054 MF extends MessageFormatter<FT>,
+055 CEC extends CommandExecutionContext<CEC, I>,
+056 CC extends ConditionContext<I>
+057 > {
+058
+059 /**
+060 * This is a stack incase a command calls a command
+061 */
+062 static ThreadLocal<Stack<CommandOperationContext>> commandOperationContext = ThreadLocal.withInitial(() -> new Stack<CommandOperationContext>() {
+063 @Override
+064 public synchronized CommandOperationContext peek() {
+065 return super.size() == 0 ? null : super.peek();
+066 }
+067 });
+068 protected Map<String, RootCommand> rootCommands = new HashMap<>();
+069 protected final CommandReplacements replacements = new CommandReplacements(this);
+070 protected final CommandConditions<I, CEC, CC> conditions = new CommandConditions<>(this);
+071 protected ExceptionHandler defaultExceptionHandler = null;
+072 protected Table<Class<?>, String, Object> dependencies = HashBasedTable.create();
+073
+074 protected boolean usePerIssuerLocale = false;
+075 protected List<IssuerLocaleChangedCallback<I>> localeChangedCallbacks = Lists.newArrayList();
+076 protected Set<Locale> supportedLanguages = Sets.newHashSet(Locales.ENGLISH, Locales.GERMAN, Locales.SPANISH, Locales.CZECH, Locales.PORTUGUESE);
+077 protected Map<MessageType, MF> formatters = new IdentityHashMap<>();
+078 protected MF defaultFormatter;
+079 protected int defaultHelpPerPage = 10;
+080
+081 protected Map<UUID, Locale> issuersLocale = Maps.newConcurrentMap();
+082
+083 private Set<String> unstableAPIs = Sets.newHashSet();
+084
+085 public static CommandOperationContext getCurrentCommandOperationContext() {
+086 return commandOperationContext.get().peek();
+087 }
+088
+089 public static CommandIssuer getCurrentCommandIssuer() {
+090 CommandOperationContext context = commandOperationContext.get().peek();
+091 return context != null ? context.getCommandIssuer() : null;
+092 }
+093
+094 public static CommandManager getCurrentCommandManager() {
+095 CommandOperationContext context = commandOperationContext.get().peek();
+096 return context != null ? context.getCommandManager() : null;
+097 }
+098
+099 public MF setFormat(MessageType type, MF formatter) {
+100 return formatters.put(type, formatter);
+101 }
+102
+103 public MF getFormat(MessageType type) {
+104 return formatters.getOrDefault(type, defaultFormatter);
+105 }
+106
+107 public void setFormat(MessageType type, FT... colors) {
+108 MF format = getFormat(type);
+109 for (int i = 1; i <= colors.length; i++) {
+110 format.setColor(i, colors[i-1]);
+111 }
+112 }
+113
+114 public void setFormat(MessageType type, int i, FT color) {
+115 MF format = getFormat(type);
+116 format.setColor(i, color);
+117 }
+118
+119 public MF getDefaultFormatter() {
+120 return defaultFormatter;
+121 }
+122
+123 public void setDefaultFormatter(MF defaultFormatter) {
+124 this.defaultFormatter = defaultFormatter;
+125 }
+126
+127 public CommandConditions<I, CEC, CC> getCommandConditions() {
+128 return conditions;
+129 }
+130
+131 /**
+132 * Gets the command contexts manager
+133 * @return Command Contexts
+134 */
+135 public abstract CommandContexts<?> getCommandContexts();
+136
+137 /**
+138 * Gets the command completions manager
+139 * @return Command Completions
+140 */
+141 public abstract CommandCompletions<?> getCommandCompletions();
+142
+143 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
+144 public CommandHelp generateCommandHelp(@NotNull String command) {
+145 verifyUnstableAPI("help");
+146 CommandOperationContext context = getCurrentCommandOperationContext();
+147 if (context == null) {
+148 throw new IllegalStateException("This method can only be called as part of a command execution.");
+149 }
+150 return generateCommandHelp(context.getCommandIssuer(), command);
+151 }
+152
+153 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
+154 public CommandHelp generateCommandHelp(CommandIssuer issuer, @NotNull String command) {
+155 verifyUnstableAPI("help");
+156 return generateCommandHelp(issuer, obtainRootCommand(command));
+157 }
+158
+159 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
+160 public CommandHelp generateCommandHelp() {
+161 verifyUnstableAPI("help");
+162 CommandOperationContext context = getCurrentCommandOperationContext();
+163 if (context == null) {
+164 throw new IllegalStateException("This method can only be called as part of a command execution.");
+165 }
+166 String commandLabel = context.getCommandLabel();
+167 return generateCommandHelp(context.getCommandIssuer(), this.obtainRootCommand(commandLabel));
+168 }
+169
+170 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
+171 public CommandHelp generateCommandHelp(CommandIssuer issuer, RootCommand rootCommand) {
+172 verifyUnstableAPI("help");
+173 return new CommandHelp(this, rootCommand, issuer);
+174 }
+175
+176 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
+177 public int getDefaultHelpPerPage() {
+178 verifyUnstableAPI("help");
+179 return defaultHelpPerPage;
+180 }
+181
+182 /** @deprecated Unstable API */ @Deprecated @UnstableAPI
+183 public void setDefaultHelpPerPage(int defaultHelpPerPage) {
+184 verifyUnstableAPI("help");
+185 this.defaultHelpPerPage = defaultHelpPerPage;
+186 }
+187
+188 /**
+189 * Registers a command with ACF
+190 *
+191 * @param command The command to register
+192 * @return boolean
+193 */
+194 public abstract void registerCommand(BaseCommand command);
+195 public abstract boolean hasRegisteredCommands();
+196 public abstract boolean isCommandIssuer(Class<?> type);
+197
+198 // TODO: Change this to IT if we make a breaking change
+199 public abstract I getCommandIssuer(Object issuer);
+200
+201 public abstract RootCommand createRootCommand(String cmd);
+202
+203 /**
+204 * Returns a Locales Manager to add and modify language tables for your commands.
+205 * @return
+206 */
+207 public abstract Locales getLocales();
+208
+209 public boolean usingPerIssuerLocale() {
+210 return usePerIssuerLocale;
+211 }
+212
+213 public boolean usePerIssuerLocale(boolean setting) {
+214 boolean old = usePerIssuerLocale;
+215 usePerIssuerLocale = setting;
+216 return old;
+217 }
+218
+219 public ConditionContext createConditionContext(CommandIssuer issuer, String config) {
+220 //noinspection unchecked
+221 return new ConditionContext(issuer, config);
+222 }
+223
+224 public abstract CommandExecutionContext createCommandContext(RegisteredCommand command, CommandParameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs);
+225
+226 public abstract CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args);
+227
+228 public abstract void log(final LogLevel level, final String message, final Throwable throwable);
+229
+230 public void log(final LogLevel level, final String message) {
+231 log(level, message, null);
+232 }
+233
+234 /**
+235 * Lets you add custom string replacements that can be applied to annotation values,
+236 * to reduce duplication/repetition of common values such as permission nodes and command prefixes.
+237 *
+238 * Any replacement registered starts with a %
+239 *
+240 * So for ex @CommandPermission("%staff")
+241 * @return Replacements Manager
+242 */
+243 public CommandReplacements getCommandReplacements() {
+244 return replacements;
+245 }
+246
+247 public boolean hasPermission(CommandIssuer issuer, String permission) {
+248 if (permission == null || permission.isEmpty()) {
+249 return true;
+250 }
+251 for (String perm : ACFPatterns.COMMA.split(permission)) {
+252 if (!perm.isEmpty() && !issuer.hasPermission(perm)) {
+253 return false;
+254 }
+255 }
+256 return true;
+257 }
+258
+259 BaseCommand getBaseCommand(String commandLabel, @NotNull String[] args) {
+260 RootCommand rootCommand = obtainRootCommand(commandLabel);
+261 if (rootCommand == null) {
+262 return null;
+263 }
+264 return rootCommand.getBaseCommand(args);
+265 }
+266
+267 public synchronized RootCommand getRootCommand(@NotNull String cmd) {
+268 return rootCommands.get(ACFPatterns.SPACE.split(cmd.toLowerCase(), 2)[0]);
+269 }
+270
+271 public synchronized RootCommand obtainRootCommand(@NotNull String cmd) {
+272 return rootCommands.computeIfAbsent(ACFPatterns.SPACE.split(cmd.toLowerCase(), 2)[0], this::createRootCommand);
+273 }
+274
+275 public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) {
+276 return new RegisteredCommand(command, cmdName, method, prefSubCommand);
+277 }
+278
+279 /**
+280 * Sets the default {@link ExceptionHandler} that is called when an exception occurs while executing a command, if the command doesn't have it's own exception handler registered.
+281 *
+282 * @param exceptionHandler the handler that should handle uncaught exceptions
+283 */
+284 public void setDefaultExceptionHandler(ExceptionHandler exceptionHandler) {
+285 defaultExceptionHandler = exceptionHandler;
+286 }
+287
+288 /**
+289 * Gets the current default exception handler, might be null.
+290 *
+291 * @return the default exception handler
+292 */
+293 public ExceptionHandler getDefaultExceptionHandler() {
+294 return defaultExceptionHandler;
+295 }
+296
+297 protected boolean handleUncaughtException(BaseCommand scope, RegisteredCommand registeredCommand, CommandIssuer sender, List<String> args, Throwable t) {
+298 if (t instanceof InvocationTargetException && t.getCause() != null) {
+299 t = t.getCause();
+300 }
+301 boolean result = false;
+302 if (scope.getExceptionHandler() != null) {
+303 result = scope.getExceptionHandler().execute(scope, registeredCommand, sender, args, t);
+304 } else if (defaultExceptionHandler != null) {
+305 result = defaultExceptionHandler.execute(scope, registeredCommand, sender, args, t);
+306 }
+307 return result;
+308 }
+309
+310 public void sendMessage(IT issuerArg, MessageType type, MessageKeyProvider key, String... replacements) {
+311 sendMessage(getCommandIssuer(issuerArg), type, key, replacements);
+312 }
+313
+314 public void sendMessage(CommandIssuer issuer, MessageType type, MessageKeyProvider key, String... replacements) {
+315 String message = formatMessage(issuer, type, key, replacements);
+316
+317 for (String msg : ACFPatterns.NEWLINE.split(message)) {
+318 issuer.sendMessageInternal(ACFUtil.rtrim(msg));
+319 }
+320 }
+321
+322 public String formatMessage(CommandIssuer issuer, MessageType type, MessageKeyProvider key, String... replacements) {
+323 String message = getLocales().getMessage(issuer, key.getMessageKey());
+324 if (replacements.length > 0) {
+325 message = ACFUtil.replaceStrings(message, replacements);
+326 }
+327
+328 message = getCommandReplacements().replace(message);
+329
+330 MessageFormatter formatter = formatters.getOrDefault(type, defaultFormatter);
+331 if (formatter != null) {
+332 message = formatter.format(message);
+333 }
+334 return message;
+335 }
+336
+337 public void onLocaleChange(IssuerLocaleChangedCallback<I> onChange) {
+338 localeChangedCallbacks.add(onChange);
+339 }
+340
+341 public void notifyLocaleChange(I issuer, Locale oldLocale, Locale newLocale) {
+342 localeChangedCallbacks.forEach(cb -> {
+343 try {
+344 cb.onIssuerLocaleChange(issuer, oldLocale, newLocale);
+345 } catch (Exception e) {
+346 this.log(LogLevel.ERROR, "Error in notifyLocaleChange", e);
+347 }
+348 });
+349 }
+350
+351 public Locale setIssuerLocale(IT issuer, Locale locale) {
+352 I commandIssuer = getCommandIssuer(issuer);
+353
+354 Locale old = issuersLocale.put(commandIssuer.getUniqueId(), locale);
+355 if (!Objects.equals(old, locale)) {
+356 this.notifyLocaleChange(commandIssuer, old, locale);
+357 }
+358
+359 return old;
+360 }
+361
+362 public Locale getIssuerLocale(CommandIssuer issuer) {
+363 if (usingPerIssuerLocale()) {
+364 Locale locale = issuersLocale.get(issuer.getUniqueId());
+365 if (locale != null) {
+366 return locale;
+367 }
+368 }
+369
+370 return getLocales().getDefaultLocale();
+371 }
+372
+373 CommandOperationContext<I> createCommandOperationContext(BaseCommand command, CommandIssuer issuer, String commandLabel, String[] args, boolean isAsync) {
+374 //noinspection unchecked
+375 return new CommandOperationContext<>(
+376 this,
+377 (I) issuer,
+378 command,
+379 commandLabel,
+380 args,
+381 isAsync
+382 );
+383 }
+384
+385 /**
+386 * Gets a list of all currently supported languages for this manager.
+387 * These locales will be automatically loaded from
+388 * @return
+389 */
+390 public Set<Locale> getSupportedLanguages() {
+391 return supportedLanguages;
+392 }
+393
+394 /**
+395 * Adds a new locale to the list of automatic Locales to load Message Bundles for.
+396 * All bundles loaded under the previous supported languages will now automatically load for this new locale too.
+397 *
+398 * @param locale
+399 */
+400 public void addSupportedLanguage(Locale locale) {
+401 supportedLanguages.add(locale);
+402 getLocales().loadMissingBundles();
+403 }
+404
+405 /**
+406 * Registers an instance of a class to be registered as an injectable dependency.<br>
+407 * The command manager will attempt to inject all fields in a command class that are annotated with
+408 * {@link co.aikar.commands.annotation.Dependency} with the provided instance.
+409 *
+410 * @param clazz the class the injector should look for when injecting
+411 * @param instance the instance of the class that should be injected
+412 * @throws IllegalStateException when there is already an instance for the provided class registered
+413 */
+414 public <T> void registerDependency(Class<? extends T> clazz, T instance){
+415 registerDependency(clazz, clazz.getName(), instance);
+416 }
+417
+418 /**
+419 * Registers an instance of a class to be registered as an injectable dependency.<br>
+420 * The command manager will attempt to inject all fields in a command class that are annotated with
+421 * {@link co.aikar.commands.annotation.Dependency} with the provided instance.
+422 *
+423 * @param clazz the class the injector should look for when injecting
+424 * @param key the key which needs to be present if that
+425 * @param instance the instance of the class that should be injected
+426 * @throws IllegalStateException when there is already an instance for the provided class registered
+427 */
+428 public <T> void registerDependency(Class<? extends T> clazz, String key, T instance){
+429 if(dependencies.containsRow(clazz) && dependencies.containsColumn(key)){
+430 throw new IllegalStateException("There is already an instance of " + clazz.getName() + " with the key " + key + " registered!");
+431 }
+432
+433 dependencies.put(clazz, key, instance);
+434 }
+435
+436 /**
+437 * Attempts to inject instances of classes registered with {@link CommandManager#registerDependency(Class, Object)}
+438 * into all fields of the class and its superclasses that are marked with {@link Dependency}.
+439 *
+440 * @param baseCommand the instance which fields should be filled
+441 */
+442 void injectDependencies(BaseCommand baseCommand) {
+443 Class clazz = baseCommand.getClass();
+444 do {
+445 for (Field field : clazz.getDeclaredFields()) {
+446 if (field.isAnnotationPresent(Dependency.class)) {
+447 Dependency dependency = field.getAnnotation(Dependency.class);
+448 String key = (key = dependency.value()).equals("") ? field.getType().getName() : key;
+449 Object object = dependencies.row(field.getType()).get(key);
+450 if (object == null) {
+451 throw new UnresolvedDependencyException("Could not find a registered instance of " +
+452 field.getType().getName() + " with key " + key + " for field " + field.getName() +
+453 " in class " + baseCommand.getClass().getName());
+454 }
+455
+456 try {
+457 boolean accessible = field.isAccessible();
+458 if (!accessible) {
+459 field.setAccessible(true);
+460 }
+461 field.set(baseCommand, object);
+462 field.setAccessible(accessible);
+463 } catch (IllegalAccessException e) {
+464 e.printStackTrace(); //TODO should we print our own exception here to make a more descriptive error?
+465 }
+466 }
+467 }
+468 clazz = clazz.getSuperclass();
+469 } while (!clazz.equals(BaseCommand.class));
+470 }
+471
+472 /**
+473 * @deprecated Use this with caution! If you enable and use Unstable API's, your next compile using ACF
+474 * may require you to update your implementation to those unstable API's
+475 */
+476 @Deprecated
+477 public void enableUnstableAPI(String api) {
+478 unstableAPIs.add(api);
+479 }
+480 void verifyUnstableAPI(String api) {
+481 if (!unstableAPIs.contains(api)) {
+482 throw new IllegalStateException("Using an unstable API that has not been enabled ( " + api + "). See https://acfunstable.emc.gs");
+483 }
+484 }
+485
+486 boolean hasUnstableAPI(String api) {
+487 return unstableAPIs.contains(api);
+488 }
+489}
diff --git a/docs/acf-core/src-html/co/aikar/commands/CommandParameter.html b/docs/acf-core/src-html/co/aikar/commands/CommandParameter.html
new file mode 100644
index 00000000..3bba04ae
--- /dev/null
+++ b/docs/acf-core/src-html/co/aikar/commands/CommandParameter.html
@@ -0,0 +1,305 @@
+
+
+
+Source code
+
+
+
+
+001/*
+002 * Copyright (c) 2016-2018 Daniel Ennis (Aikar) - MIT License
+003 *
+004 * Permission is hereby granted, free of charge, to any person obtaining
+005 * a copy of this software and associated documentation files (the
+006 * "Software"), to deal in the Software without restriction, including
+007 * without limitation the rights to use, copy, modify, merge, publish,
+008 * distribute, sublicense, and/or sell copies of the Software, and to
+009 * permit persons to whom the Software is furnished to do so, subject to
+010 * the following conditions:
+011 *
+012 * The above copyright notice and this permission notice shall be
+013 * included in all copies or substantial portions of the Software.
+014 *
+015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+022 */
+023
+024package co.aikar.commands;
+025
+026import co.aikar.commands.annotation.Default;
+027import co.aikar.commands.annotation.Description;
+028import co.aikar.commands.annotation.Flags;
+029import co.aikar.commands.annotation.Optional;
+030import co.aikar.commands.annotation.Values;
+031import co.aikar.commands.contexts.ContextResolver;
+032import co.aikar.commands.contexts.IssuerAwareContextResolver;
+033import co.aikar.commands.contexts.IssuerOnlyContextResolver;
+034import co.aikar.commands.contexts.OptionalContextResolver;
+035import com.google.common.collect.Maps;
+036
+037import java.lang.reflect.Parameter;
+038import java.util.Map;
+039
+040public class CommandParameter <CEC extends CommandExecutionContext<CEC, ? extends CommandIssuer>> {
+041 private final Parameter parameter;
+042 private final Class<?> type;
+043 private final String name;
+044 private final CommandManager manager;
+045 private final int paramIndex;
+046 private ContextResolver<?, CEC> resolver;
+047 private boolean optional;
+048 private String description;
+049 private String defaultValue;
+050 private boolean requiresInput;
+051 private boolean commandIssuer;
+052 private String[] values;
+053 private Map<String, String> flags;
+054 private boolean canConsumeInput;
+055 private boolean optionalResolver;
+056
+057 public CommandParameter(RegisteredCommand<CEC> command, Parameter param, int paramIndex) {
+058 this.parameter = param;
+059 this.type = param.getType();
+060 this.name = param.getName(); // do we care for an annotation to supply name?
+061 //noinspection unchecked
+062 this.manager = command.manager;
+063 this.paramIndex = paramIndex;
+064 CommandReplacements replacements = manager.getCommandReplacements();
+065
+066 Default defaultAnno = param.getAnnotation(Default.class);
+067 Description descAnno = param.getAnnotation(Description.class);
+068
+069 //noinspection unchecked
+070 this.resolver = manager.getCommandContexts().getResolver(type);
+071 if (this.resolver == null) {
+072 ACFUtil.sneaky(new InvalidCommandContextException(
+073 "Parameter " + type.getSimpleName() + " of " + command + " has no applicable context resolver"
+074 ));
+075 }
+076
+077 this.description = descAnno != null ? descAnno.value() : null;
+078 String defaultValue = defaultAnno != null ? replacements.replace(defaultAnno.value()) : null;
+079 this.defaultValue = defaultValue != null && (type == String.class || !defaultValue.isEmpty()) ? defaultValue : null;
+080
+081
+082 this.optional = param.isAnnotationPresent(Optional.class) || this.defaultValue != null;
+083 this.optionalResolver = isOptionalResolver(resolver);
+084 this.requiresInput = !this.optional && !this.optionalResolver;
+085 //noinspection unchecked
+086 this.commandIssuer = manager.isCommandIssuer(type);
+087 this.canConsumeInput = !(resolver instanceof IssuerOnlyContextResolver);
+088
+089 final Values values = param.getAnnotation(Values.class);
+090 if (values != null) {
+091 this.values = ACFPatterns.PIPE.split(manager.getCommandReplacements().replace(values.value()));
+092 } else {
+093 this.values = null;
+094 }
+095 this.flags = Maps.newHashMap();
+096 Flags flags = param.getAnnotation(Flags.class);
+097 if (flags != null) {
+098 parseFlags(flags.value());
+099 }
+100 inheritContextFlags(command.scope);
+101 }
+102
+103 private void inheritContextFlags(BaseCommand scope) {
+104 if (!scope.contextFlags.isEmpty()) {
+105 Class<?> pCls = this.type;
+106 do {
+107 parseFlags(scope.contextFlags.get(pCls));
+108 } while ((pCls = pCls.getSuperclass()) != null);
+109 }
+110 if (scope.parentCommand != null) {
+111 inheritContextFlags(scope.parentCommand);
+112 }
+113 }
+114
+115 private void parseFlags(String flags) {
+116 if (flags != null) {
+117 for (String s : ACFPatterns.COMMA.split(manager.getCommandReplacements().replace(flags))) {
+118 String[] v = ACFPatterns.EQUALS.split(s, 2);
+119 if (!this.flags.containsKey(v[0])) {
+120 this.flags.put(v[0], v.length > 1 ? v[1] : null);
+121 }
+122 }
+123 }
+124 }
+125
+126 private boolean isOptionalResolver(ContextResolver<?, CEC> resolver) {
+127 return resolver instanceof IssuerAwareContextResolver
+128 || resolver instanceof IssuerOnlyContextResolver
+129 || resolver instanceof OptionalContextResolver;
+130 }
+131
+132
+133 public Parameter getParameter() {
+134 return parameter;
+135 }
+136
+137 public Class<?> getType() {
+138 return type;
+139 }
+140
+141 public String getName() {
+142 return name;
+143 }
+144
+145 public CommandManager getManager() {
+146 return manager;
+147 }
+148
+149 public int getParamIndex() {
+150 return paramIndex;
+151 }
+152
+153 public ContextResolver<?, CEC> getResolver() {
+154 return resolver;
+155 }
+156
+157 public void setResolver(ContextResolver<?, CEC> resolver) {
+158 this.resolver = resolver;
+159 }
+160
+161 public boolean isOptional() {
+162 return optional;
+163 }
+164
+165 public void setOptional(boolean optional) {
+166 this.optional = optional;
+167 }
+168
+169 public String getDescription() {
+170 return description;
+171 }
+172
+173 public void setDescription(String description) {
+174 this.description = description;
+175 }
+176
+177 public String getDefaultValue() {
+178 return defaultValue;
+179 }
+180
+181 public void setDefaultValue(String defaultValue) {
+182 this.defaultValue = defaultValue;
+183 }
+184
+185 public boolean isCommandIssuer() {
+186 return commandIssuer;
+187 }
+188
+189 public void setCommandIssuer(boolean commandIssuer) {
+190 this.commandIssuer = commandIssuer;
+191 }
+192
+193 public String[] getValues() {
+194 return values;
+195 }
+196
+197 public void setValues(String[] values) {
+198 this.values = values;
+199 }
+200
+201 public Map<String, String> getFlags() {
+202 return flags;
+203 }
+204
+205 public void setFlags(Map<String, String> flags) {
+206 this.flags = flags;
+207 }
+208
+209 public boolean canConsumeInput() {
+210 return canConsumeInput;
+211 }
+212
+213 public void setCanConsumeInput(boolean canConsumeInput) {
+214 this.canConsumeInput = canConsumeInput;
+215 }
+216
+217 public void setOptionalResolver(boolean optionalResolver) {
+218 this.optionalResolver = optionalResolver;
+219 }
+220
+221 public boolean isOptionalResolver() {
+222 return optionalResolver;
+223 }
+224
+225 public boolean requiresInput() {
+226 return requiresInput;
+227 }
+228
+229 public void setRequiresInput(boolean requiresInput) {
+230 this.requiresInput = requiresInput;
+231 }
+232
+233}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/acf-core/src-html/co/aikar/commands/RegisteredCommand.html b/docs/acf-core/src-html/co/aikar/commands/RegisteredCommand.html
index e04ce3cc..f9d3a027 100644
--- a/docs/acf-core/src-html/co/aikar/commands/RegisteredCommand.html
+++ b/docs/acf-core/src-html/co/aikar/commands/RegisteredCommand.html
@@ -34,295 +34,264 @@
026import co.aikar.commands.annotation.CommandAlias;
027import co.aikar.commands.annotation.CommandCompletion;
028import co.aikar.commands.annotation.CommandPermission;
-029import co.aikar.commands.annotation.Default;
-030import co.aikar.commands.annotation.Description;
-031import co.aikar.commands.annotation.Optional;
-032import co.aikar.commands.annotation.Syntax;
-033import co.aikar.commands.annotation.Values;
-034import co.aikar.commands.contexts.ContextResolver;
-035import co.aikar.commands.contexts.IssuerAwareContextResolver;
-036import co.aikar.commands.contexts.IssuerOnlyContextResolver;
-037import co.aikar.commands.contexts.OptionalContextResolver;
-038import com.google.common.collect.ImmutableSet;
-039import com.google.common.collect.Lists;
-040import com.google.common.collect.Maps;
-041import com.google.common.collect.Sets;
-042import org.jetbrains.annotations.Nullable;
-043
-044import java.lang.reflect.InvocationTargetException;
-045import java.lang.reflect.Method;
-046import java.lang.reflect.Parameter;
-047import java.util.ArrayList;
-048import java.util.Collection;
-049import java.util.List;
-050import java.util.Map;
-051import java.util.Set;
-052import java.util.stream.Collectors;
-053
-054@SuppressWarnings("WeakerAccess")
-055public class RegisteredCommand <CEC extends CommandExecutionContext<CEC, ? extends CommandIssuer>> {
-056 final BaseCommand scope;
-057 final String command;
-058 final Method method;
-059 final String prefSubCommand;
-060 final Parameter[] parameters;
-061 final ContextResolver<?, CEC>[] resolvers;
-062 final String syntaxText;
-063 final String helpText;
+029import co.aikar.commands.annotation.Description;
+030import co.aikar.commands.annotation.Syntax;
+031import co.aikar.commands.contexts.ContextResolver;
+032import com.google.common.collect.ImmutableSet;
+033import com.google.common.collect.Lists;
+034import com.google.common.collect.Maps;
+035import com.google.common.collect.Sets;
+036import org.jetbrains.annotations.Nullable;
+037
+038import java.lang.reflect.InvocationTargetException;
+039import java.lang.reflect.Method;
+040import java.lang.reflect.Parameter;
+041import java.util.ArrayList;
+042import java.util.Collection;
+043import java.util.List;
+044import java.util.Map;
+045import java.util.Set;
+046import java.util.stream.Collectors;
+047
+048@SuppressWarnings("WeakerAccess")
+049public class RegisteredCommand <CEC extends CommandExecutionContext<CEC, ? extends CommandIssuer>> {
+050 final BaseCommand scope;
+051 final String command;
+052 final Method method;
+053 final String prefSubCommand;
+054 final CommandParameter<CEC>[] parameters;
+055 final String syntaxText;
+056 final String helpText;
+057
+058 private final String permission;
+059 final String complete;
+060 final int requiredResolvers;
+061 final int optionalResolvers;
+062 final List<String> registeredSubcommands = new ArrayList<>();
+063 final CommandManager manager;
064
-065 private final String permission;
-066 final String complete;
-067 final int requiredResolvers;
-068 final int optionalResolvers;
-069 final List<String> registeredSubcommands = new ArrayList<>();
-070 private final CommandManager manager;
-071
-072 RegisteredCommand(BaseCommand scope, String command, Method method, String prefSubCommand) {
-073 this.scope = scope;
-074 this.manager = this.scope.manager;
-075 if (BaseCommand.CATCHUNKNOWN.equals(prefSubCommand) || BaseCommand.DEFAULT.equals(prefSubCommand)) {
-076 prefSubCommand = "";
-077 }
-078 this.command = command + (method.getAnnotation(CommandAlias.class) == null && !prefSubCommand.isEmpty() ? prefSubCommand : "");
-079 this.method = method;
-080 this.prefSubCommand = prefSubCommand;
-081 CommandPermission permissionAnno = method.getAnnotation(CommandPermission.class);
-082 this.permission = permissionAnno != null ? scope.manager.getCommandReplacements().replace(permissionAnno.value()) : null;
-083 CommandCompletion completionAnno = method.getAnnotation(CommandCompletion.class);
-084 this.complete = completionAnno != null ? scope.manager.getCommandReplacements().replace(completionAnno.value()) : null;
-085 this.parameters = method.getParameters();
+065 RegisteredCommand(BaseCommand scope, String command, Method method, String prefSubCommand) {
+066 this.scope = scope;
+067 this.manager = this.scope.manager;
+068 if (BaseCommand.CATCHUNKNOWN.equals(prefSubCommand) || BaseCommand.DEFAULT.equals(prefSubCommand)) {
+069 prefSubCommand = "";
+070 }
+071 this.command = command + (method.getAnnotation(CommandAlias.class) == null && !prefSubCommand.isEmpty() ? prefSubCommand : "");
+072 this.method = method;
+073 this.prefSubCommand = prefSubCommand;
+074 CommandPermission permissionAnno = method.getAnnotation(CommandPermission.class);
+075 this.permission = permissionAnno != null ? scope.manager.getCommandReplacements().replace(permissionAnno.value()) : null;
+076 CommandCompletion completionAnno = method.getAnnotation(CommandCompletion.class);
+077 this.complete = completionAnno != null ? scope.manager.getCommandReplacements().replace(completionAnno.value()) : null;
+078 Parameter[] parameters = method.getParameters();
+079 //noinspection unchecked
+080 this.parameters = new CommandParameter[parameters.length];
+081
+082 Description descriptionAnno = method.getAnnotation(Description.class);
+083 this.helpText = descriptionAnno != null ? descriptionAnno.value() : "";
+084 final Syntax syntaxStr = method.getAnnotation(Syntax.class);
+085
086
-087 Description descriptionAnno = method.getAnnotation(Description.class);
-088 this.helpText = descriptionAnno != null ? descriptionAnno.value() : "";
-089 //noinspection unchecked
-090 this.resolvers = new ContextResolver[this.parameters.length];
-091 final Syntax syntaxStr = method.getAnnotation(Syntax.class);
-092 //noinspection unchecked
-093 final CommandContexts commandContexts = this.manager.getCommandContexts();
-094
-095 int requiredResolvers = 0;
-096 int optionalResolvers = 0;
-097 StringBuilder syntaxB = new StringBuilder(64);
-098
-099 for (int i = 0; i < parameters.length; i++) {
-100 final Parameter parameter = parameters[i];
-101 final Class<?> type = parameter.getType();
-102
-103 //noinspection unchecked
-104 final ContextResolver<?, CEC> resolver = commandContexts.getResolver(type);
-105 if (resolver != null) {
-106 resolvers[i] = resolver;
-107
-108 if (!scope.manager.isCommandIssuer(type)) {
-109 String name = parameter.getName();
-110 if (isOptionalResolver(resolver, parameter)) {
-111 optionalResolvers++;
-112 if (!(resolver instanceof IssuerOnlyContextResolver)) {
-113 syntaxB.append('[').append(name).append("] ");
-114 }
-115 } else {
-116 requiredResolvers++;
-117 syntaxB.append('<').append(name).append("> ");
-118 }
-119 }
-120 } else {
-121 ACFUtil.sneaky(new InvalidCommandContextException(
-122 "Parameter " + type.getSimpleName() + " of " + this.command + " has no applicable context resolver"
-123 ));
-124 }
-125 }
-126 String syntaxText = syntaxB.toString();
-127 this.syntaxText = this.manager.getCommandReplacements().replace(syntaxStr != null ?
-128 ACFUtil.replace(syntaxStr.value(), "@syntax", syntaxText) : syntaxText);
-129 this.requiredResolvers = requiredResolvers;
-130 this.optionalResolvers = optionalResolvers;
+087 int requiredResolvers = 0;
+088 int optionalResolvers = 0;
+089 StringBuilder syntaxB = new StringBuilder(64);
+090
+091 for (int i = 0; i < parameters.length; i++) {
+092 CommandParameter<CEC> parameter = this.parameters[i] = new CommandParameter<>(this, parameters[i], i);
+093
+094 if (!parameter.isCommandIssuer()) {
+095 String name = parameter.getName();
+096 if (!parameter.requiresInput()) {
+097 optionalResolvers++;
+098 if (parameter.canConsumeInput()) {
+099 syntaxB.append('[').append(name).append("] ");
+100 }
+101 } else {
+102 requiredResolvers++;
+103 syntaxB.append('<').append(name).append("> ");
+104 }
+105 }
+106
+107 }
+108 String syntaxText = syntaxB.toString();
+109 this.syntaxText = this.manager.getCommandReplacements().replace(syntaxStr != null ?
+110 ACFUtil.replace(syntaxStr.value(), "@syntax", syntaxText) : syntaxText);
+111 this.requiredResolvers = requiredResolvers;
+112 this.optionalResolvers = optionalResolvers;
+113 }
+114
+115
+116 void invoke(CommandIssuer sender, List<String> args, CommandOperationContext context) {
+117 if (!scope.canExecute(sender, this)) {
+118 return;
+119 }
+120 preCommand();
+121 try {
+122 this.manager.conditions.validateConditions(context);
+123 Map<String, Object> passedArgs = resolveContexts(sender, args);
+124 if (passedArgs == null) return;
+125
+126 method.invoke(scope, passedArgs.values().toArray());
+127 } catch (Exception e) {
+128 handleException(sender, args, e);
+129 }
+130 postCommand();
131 }
-132
-133 private boolean isOptionalResolver(ContextResolver<?, CEC> resolver, Parameter parameter) {
-134 return isOptionalResolver(resolver)
-135 || parameter.getAnnotation(Optional.class) != null
-136 || parameter.getAnnotation(Default.class) != null;
-137 }
-138
-139 private boolean isOptionalResolver(ContextResolver<?, CEC> resolver) {
-140 return resolver instanceof IssuerAwareContextResolver || resolver instanceof IssuerOnlyContextResolver
-141 || resolver instanceof OptionalContextResolver;
-142 }
-143
-144 void invoke(CommandIssuer sender, List<String> args, CommandOperationContext context) {
-145 if (!scope.canExecute(sender, this)) {
-146 return;
-147 }
-148 preCommand();
-149 try {
-150 this.manager.conditions.validateConditions(context);
-151 Map<String, Object> passedArgs = resolveContexts(sender, args);
-152 if (passedArgs == null) return;
-153
-154 method.invoke(scope, passedArgs.values().toArray());
-155 } catch (Exception e) {
-156 handleException(sender, args, e);
-157 }
-158 postCommand();
-159 }
-160 public void preCommand() {}
-161 public void postCommand() {}
-162
-163 void handleException(CommandIssuer sender, List<String> args, Exception e) {
-164 if (e instanceof InvocationTargetException && e.getCause() instanceof InvalidCommandArgument) {
-165 e = (Exception) e.getCause();
+132 public void preCommand() {}
+133 public void postCommand() {}
+134
+135 void handleException(CommandIssuer sender, List<String> args, Exception e) {
+136 if (e instanceof InvocationTargetException && e.getCause() instanceof InvalidCommandArgument) {
+137 e = (Exception) e.getCause();
+138 }
+139 if (e instanceof ShowCommandHelp) {
+140 ShowCommandHelp showHelp = (ShowCommandHelp) e;
+141 CommandHelp commandHelp = manager.generateCommandHelp();
+142 if (showHelp.search) {
+143 commandHelp.setSearch(showHelp.searchArgs == null ? args : showHelp.searchArgs);
+144 }
+145 commandHelp.showHelp(sender);
+146 } else if (e instanceof InvalidCommandArgument) {
+147 InvalidCommandArgument invalidCommandArg = (InvalidCommandArgument) e;
+148 if (invalidCommandArg.key != null) {
+149 sender.sendMessage(MessageType.ERROR, invalidCommandArg.key, invalidCommandArg.replacements);
+150 } else if (e.getMessage() != null && !e.getMessage().isEmpty()) {
+151 sender.sendMessage(MessageType.ERROR, MessageKeys.ERROR_PREFIX, "{message}", e.getMessage());
+152 }
+153 if (invalidCommandArg.showSyntax) {
+154 scope.showSyntax(sender, this);
+155 }
+156 } else {
+157 try {
+158 if (!this.manager.handleUncaughtException(scope, this, sender, args, e)) {
+159 sender.sendMessage(MessageType.ERROR, MessageKeys.ERROR_PERFORMING_COMMAND);
+160 }
+161 this.manager.log(LogLevel.ERROR, "Exception in command: " + command + " " + ACFUtil.join(args), e);
+162 } catch (Exception e2) {
+163 this.manager.log(LogLevel.ERROR, "Exception in handleException for command: " + command + " " + ACFUtil.join(args), e);
+164 this.manager.log(LogLevel.ERROR, "Exception triggered by exception handler:", e2);
+165 }
166 }
-167 if (e instanceof ShowCommandHelp) {
-168 ShowCommandHelp showHelp = (ShowCommandHelp) e;
-169 CommandHelp commandHelp = manager.generateCommandHelp();
-170 if (showHelp.search) {
-171 commandHelp.setSearch(showHelp.searchArgs == null ? args : showHelp.searchArgs);
-172 }
-173 commandHelp.showHelp(sender);
-174 } else if (e instanceof InvalidCommandArgument) {
-175 InvalidCommandArgument invalidCommandArg = (InvalidCommandArgument) e;
-176 if (invalidCommandArg.key != null) {
-177 sender.sendMessage(MessageType.ERROR, invalidCommandArg.key, invalidCommandArg.replacements);
-178 } else if (e.getMessage() != null && !e.getMessage().isEmpty()) {
-179 sender.sendMessage(MessageType.ERROR, MessageKeys.ERROR_PREFIX, "{message}", e.getMessage());
-180 }
-181 if (invalidCommandArg.showSyntax) {
-182 scope.showSyntax(sender, this);
-183 }
-184 } else {
-185 try {
-186 if (!this.manager.handleUncaughtException(scope, this, sender, args, e)) {
-187 sender.sendMessage(MessageType.ERROR, MessageKeys.ERROR_PERFORMING_COMMAND);
-188 }
-189 this.manager.log(LogLevel.ERROR, "Exception in command: " + command + " " + ACFUtil.join(args), e);
-190 } catch (Exception e2) {
-191 this.manager.log(LogLevel.ERROR, "Exception in handleException for command: " + command + " " + ACFUtil.join(args), e);
-192 this.manager.log(LogLevel.ERROR, "Exception triggered by exception handler:", e2);
+167 }
+168
+169 @Nullable
+170 Map<String, Object> resolveContexts(CommandIssuer sender, List<String> args) throws InvalidCommandArgument {
+171 return resolveContexts(sender, args, parameters.length);
+172 }
+173 @Nullable
+174 Map<String, Object> resolveContexts(CommandIssuer sender, List<String> args, int argLimit) throws InvalidCommandArgument {
+175 args = Lists.newArrayList(args);
+176 String[] origArgs = args.toArray(new String[args.size()]);
+177 Map<String, Object> passedArgs = Maps.newLinkedHashMap();
+178 int remainingRequired = requiredResolvers;
+179 CommandOperationContext opContext = CommandManager.getCurrentCommandOperationContext();
+180 for (int i = 0; i < parameters.length && i < argLimit; i++) {
+181 boolean isLast = i == parameters.length - 1;
+182 boolean allowOptional = remainingRequired == 0;
+183 final CommandParameter<CEC> parameter = parameters[i];
+184 final String parameterName = parameter.getName();
+185 final Class<?> type = parameter.getType();
+186 //noinspection unchecked
+187 final ContextResolver<?, CEC> resolver = parameter.getResolver();
+188 //noinspection unchecked
+189 CEC context = (CEC) this.manager.createCommandContext(this, parameter, sender, args, i, passedArgs);
+190 boolean requiresInput = parameter.requiresInput();
+191 if (requiresInput && remainingRequired > 0) {
+192 remainingRequired--;
193 }
-194 }
-195 }
-196
-197 @Nullable
-198 Map<String, Object> resolveContexts(CommandIssuer sender, List<String> args) throws InvalidCommandArgument {
-199 return resolveContexts(sender, args, parameters.length);
-200 }
-201 @Nullable
-202 Map<String, Object> resolveContexts(CommandIssuer sender, List<String> args, int argLimit) throws InvalidCommandArgument {
-203 args = Lists.newArrayList(args);
-204 String[] origArgs = args.toArray(new String[args.size()]);
-205 Map<String, Object> passedArgs = Maps.newLinkedHashMap();
-206 int remainingRequired = requiredResolvers;
-207 CommandOperationContext opContext = CommandManager.getCurrentCommandOperationContext();
-208 for (int i = 0; i < parameters.length && i < argLimit; i++) {
-209 boolean isLast = i == parameters.length - 1;
-210 boolean allowOptional = remainingRequired == 0;
-211 final Parameter parameter = parameters[i];
-212 final String parameterName = parameter.getName();
-213 final Class<?> type = parameter.getType();
-214 //noinspection unchecked
-215 final ContextResolver<?, CEC> resolver = resolvers[i];
-216 //noinspection unchecked
-217 CEC context = (CEC) this.manager.createCommandContext(this, parameter, sender, args, i, passedArgs);
-218 boolean isOptionalResolver = isOptionalResolver(resolver, parameter);
-219 if (!isOptionalResolver) {
-220 remainingRequired--;
-221 }
-222 if (args.isEmpty() && !(isLast && type == String[].class)) {
-223 Default def = parameter.getAnnotation(Default.class);
-224 Optional opt = parameter.getAnnotation(Optional.class);
-225 if (allowOptional && def != null) {
-226 args.add(scope.manager.getCommandReplacements().replace(def.value()));
-227 } else if (allowOptional && opt != null) {
-228 Object value = isOptionalResolver(resolver) ? resolver.getContext(context) : null;
-229 if (value == null && parameter.getClass().isPrimitive()) {
-230 throw new IllegalStateException("Parameter " + parameter.getName() + " is primitive and does not support Optional.");
-231 }
-232 //noinspection unchecked
-233 this.manager.conditions.validateConditions(context, value);
-234 passedArgs.put(parameterName, value);
-235 //noinspection UnnecessaryContinue
-236 continue;
-237 } else if (!isOptionalResolver) {
-238 scope.showSyntax(sender, this);
-239 return null;
-240 }
-241 }
-242 final Values values = parameter.getAnnotation(Values.class);
-243 if (values != null) {
-244 String arg = !args.isEmpty() ? args.get(0) : "";
-245
-246 final String[] split = ACFPatterns.PIPE.split(scope.manager.getCommandReplacements().replace(values.value()));
-247 Set<String> possible = Sets.newHashSet();
-248 for (String s : split) {
-249 //noinspection unchecked
-250 List<String> check = this.manager.getCommandCompletions().getCompletionValues(this, sender, s, origArgs, opContext.isAsync());
-251 if (!check.isEmpty()) {
-252 possible.addAll(check.stream().map(String::toLowerCase).collect(Collectors.toList()));
-253 } else {
-254 possible.add(s.toLowerCase());
-255 }
-256 }
-257
-258 if (!possible.contains(arg.toLowerCase())) {
-259 throw new InvalidCommandArgument(MessageKeys.PLEASE_SPECIFY_ONE_OF,
-260 "{valid}", ACFUtil.join(possible, ", "));
-261 }
-262 }
-263 Object paramValue = resolver.getContext(context);
-264 //noinspection unchecked
-265 this.manager.conditions.validateConditions(context, paramValue);
-266 passedArgs.put(parameterName, paramValue);
-267 }
-268 return passedArgs;
-269 }
-270
-271 boolean hasPermission(CommandIssuer issuer) {
-272 return (permission == null || permission.isEmpty() || scope.manager.hasPermission(issuer, permission)) && scope.hasPermission(issuer);
-273 }
-274
+194 if (args.isEmpty() && !(isLast && type == String[].class)) {
+195 if (allowOptional && parameter.getDefaultValue() != null) {
+196 args.add(parameter.getDefaultValue());
+197 } else if (allowOptional && parameter.isOptional()) {
+198 Object value = parameter.isOptionalResolver() ? resolver.getContext(context) : null;
+199 if (value == null && parameter.getClass().isPrimitive()) {
+200 throw new IllegalStateException("Parameter " + parameter.getName() + " is primitive and does not support Optional.");
+201 }
+202 //noinspection unchecked
+203 this.manager.conditions.validateConditions(context, value);
+204 passedArgs.put(parameterName, value);
+205 //noinspection UnnecessaryContinue
+206 continue;
+207 } else if (requiresInput) {
+208 scope.showSyntax(sender, this);
+209 return null;
+210 }
+211 }
+212 if (parameter.getValues() != null) {
+213 String arg = !args.isEmpty() ? args.get(0) : "";
+214
+215 Set<String> possible = Sets.newHashSet();
+216 CommandCompletions commandCompletions = this.manager.getCommandCompletions();
+217 for (String s : parameter.getValues()) {
+218 //noinspection unchecked
+219 List<String> check = commandCompletions.getCompletionValues(this, sender, s, origArgs, opContext.isAsync());
+220 if (!check.isEmpty()) {
+221 possible.addAll(check.stream().map(String::toLowerCase).collect(Collectors.toList()));
+222 } else {
+223 possible.add(s.toLowerCase());
+224 }
+225 }
+226
+227 if (!possible.contains(arg.toLowerCase())) {
+228 throw new InvalidCommandArgument(MessageKeys.PLEASE_SPECIFY_ONE_OF,
+229 "{valid}", ACFUtil.join(possible, ", "));
+230 }
+231 }
+232 Object paramValue = resolver.getContext(context);
+233 //noinspection unchecked
+234 this.manager.conditions.validateConditions(context, paramValue);
+235 passedArgs.put(parameterName, paramValue);
+236 }
+237 return passedArgs;
+238 }
+239
+240 boolean hasPermission(CommandIssuer issuer) {
+241 return (permission == null || permission.isEmpty() || scope.manager.hasPermission(issuer, permission)) && scope.hasPermission(issuer);
+242 }
+243
+244
+245 /**
+246 * @see #getRequiredPermissions()
+247 * @deprecated
+248 */
+249 @Deprecated
+250 public String getPermission() {
+251 if (this.permission == null || this.permission.isEmpty()) {
+252 return null;
+253 }
+254 return ACFPatterns.COMMA.split(this.permission)[0];
+255 }
+256
+257 public Set<String> getRequiredPermissions() {
+258 if (this.permission == null || this.permission.isEmpty()) {
+259 return ImmutableSet.of();
+260 }
+261 return Sets.newHashSet(ACFPatterns.COMMA.split(this.permission));
+262 }
+263
+264 public boolean requiresPermission(String permission) {
+265 return getRequiredPermissions().contains(permission) || scope.requiresPermission(permission);
+266 }
+267
+268 public String getPrefSubCommand() {
+269 return prefSubCommand;
+270 }
+271
+272 public String getSyntaxText() {
+273 return syntaxText;
+274 }
275
-276 /**
-277 * @see #getRequiredPermissions()
-278 * @deprecated
-279 */
-280 @Deprecated
-281 public String getPermission() {
-282 if (this.permission == null || this.permission.isEmpty()) {
-283 return null;
-284 }
-285 return ACFPatterns.COMMA.split(this.permission)[0];
-286 }
-287
-288 public Set<String> getRequiredPermissions() {
-289 if (this.permission == null || this.permission.isEmpty()) {
-290 return ImmutableSet.of();
-291 }
-292 return Sets.newHashSet(ACFPatterns.COMMA.split(this.permission));
-293 }
-294
-295 public boolean requiresPermission(String permission) {
-296 return getRequiredPermissions().contains(permission) || scope.requiresPermission(permission);
-297 }
-298
-299 public String getPrefSubCommand() {
-300 return prefSubCommand;
-301 }
-302
-303 public String getSyntaxText() {
-304 return syntaxText;
-305 }
-306
-307 public String getCommand() {
-308 return command;
-309 }
-310
-311 public void addSubcommand(String cmd) {
-312 this.registeredSubcommands.add(cmd);
-313 }
-314 public void addSubcommands(Collection<String> cmd) {
-315 this.registeredSubcommands.addAll(cmd);
-316 }
-317}
+276 public String getCommand() {
+277 return command;
+278 }
+279
+280 public void addSubcommand(String cmd) {
+281 this.registeredSubcommands.add(cmd);
+282 }
+283 public void addSubcommands(Collection<String> cmd) {
+284 this.registeredSubcommands.addAll(cmd);
+285 }
+286}
diff --git a/docs/acf-jda/co/aikar/commands/JDACommandManager.html b/docs/acf-jda/co/aikar/commands/JDACommandManager.html
index 2cf2865f..fefa5db5 100644
--- a/docs/acf-jda/co/aikar/commands/JDACommandManager.html
+++ b/docs/acf-jda/co/aikar/commands/JDACommandManager.html
@@ -112,7 +112,7 @@ var activeTableTab = "activeTableTab";
-
-public class JDACommandManager
+public class JDACommandManager
extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.MessageReceivedEvent,JDACommandEvent,String,co.aikar.commands.MessageFormatter<String>,JDACommandExecutionContext,JDAConditionContext>
@@ -193,8 +193,8 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
co.aikar.commands.CommandExecutionContext
-createCommandContext(co.aikar.commands.RegisteredCommand command,
- Parameter parameter,
+createCommandContext(co.aikar.commands.RegisteredCommand command,
+ co.aikar.commands.CommandParameter parameter,
co.aikar.commands.CommandIssuer sender,
List<String> args,
int i,
@@ -321,7 +321,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
completions
-protected JDACommandCompletions completions
+protected JDACommandCompletions completions
@@ -330,7 +330,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
contexts
-protected JDACommandContexts contexts
+protected JDACommandContexts contexts
@@ -339,7 +339,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
locales
-protected JDALocales locales
+protected JDALocales locales
@@ -348,7 +348,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
commands
-protected Map<String,JDARootCommand> commands
+protected Map<String,JDARootCommand> commands
@@ -365,7 +365,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
JDACommandManager
-public JDACommandManager(net.dv8tion.jda.core.JDA jda)
+public JDACommandManager(net.dv8tion.jda.core.JDA jda)
@@ -374,7 +374,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
JDACommandManager
-public JDACommandManager(net.dv8tion.jda.core.JDA jda,
+public JDACommandManager(net.dv8tion.jda.core.JDA jda,
JDAOptions options)
@@ -392,7 +392,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
options
-public static JDAOptions options()
+public static JDAOptions options()
@@ -401,7 +401,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
@@ -410,7 +410,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
@@ -419,7 +419,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
@@ -428,7 +428,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
getDefaultConfig
-public CommandConfig getDefaultConfig()
+public CommandConfig getDefaultConfig()
@@ -437,7 +437,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
setDefaultConfig
-public void setDefaultConfig(@NotNull
+public void setDefaultConfig(@NotNull
@NotNull CommandConfig defaultConfig)
@@ -447,7 +447,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
getConfigProvider
-public CommandConfigProvider getConfigProvider()
+public CommandConfigProvider getConfigProvider()
@@ -456,7 +456,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
setConfigProvider
-public void setConfigProvider(CommandConfigProvider configProvider)
+public void setConfigProvider(CommandConfigProvider configProvider)
@@ -465,7 +465,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
getPermissionResolver
-public CommandPermissionResolver getPermissionResolver()
+public CommandPermissionResolver getPermissionResolver()
@@ -474,7 +474,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
setPermissionResolver
-public void setPermissionResolver(CommandPermissionResolver permissionResolver)
+public void setPermissionResolver(CommandPermissionResolver permissionResolver)
@@ -483,7 +483,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
getCommandContexts
-public co.aikar.commands.CommandContexts<?> getCommandContexts()
+public co.aikar.commands.CommandContexts<?> getCommandContexts()
- Specified by:
getCommandContexts in class co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.MessageReceivedEvent,JDACommandEvent,String,co.aikar.commands.MessageFormatter<String>,JDACommandExecutionContext,JDAConditionContext>
@@ -496,7 +496,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
getCommandCompletions
-public co.aikar.commands.CommandCompletions<?> getCommandCompletions()
+public co.aikar.commands.CommandCompletions<?> getCommandCompletions()
- Specified by:
getCommandCompletions in class co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.MessageReceivedEvent,JDACommandEvent,String,co.aikar.commands.MessageFormatter<String>,JDACommandExecutionContext,JDAConditionContext>
@@ -509,7 +509,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
registerCommand
-public void registerCommand(co.aikar.commands.BaseCommand command)
+public void registerCommand(co.aikar.commands.BaseCommand command)
- Specified by:
registerCommand in class co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.MessageReceivedEvent,JDACommandEvent,String,co.aikar.commands.MessageFormatter<String>,JDACommandExecutionContext,JDAConditionContext>
@@ -522,7 +522,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
hasRegisteredCommands
-public boolean hasRegisteredCommands()
+public boolean hasRegisteredCommands()
- Specified by:
hasRegisteredCommands in class co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.MessageReceivedEvent,JDACommandEvent,String,co.aikar.commands.MessageFormatter<String>,JDACommandExecutionContext,JDAConditionContext>
@@ -535,7 +535,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
isCommandIssuer
-public boolean isCommandIssuer(Class<?> type)
+public boolean isCommandIssuer(Class<?> type)
- Specified by:
isCommandIssuer in class co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.MessageReceivedEvent,JDACommandEvent,String,co.aikar.commands.MessageFormatter<String>,JDACommandExecutionContext,JDAConditionContext>
@@ -548,7 +548,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
getCommandIssuer
-public JDACommandEvent getCommandIssuer(Object issuer)
+public JDACommandEvent getCommandIssuer(Object issuer)
- Specified by:
getCommandIssuer in class co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.MessageReceivedEvent,JDACommandEvent,String,co.aikar.commands.MessageFormatter<String>,JDACommandExecutionContext,JDAConditionContext>
@@ -561,7 +561,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
createRootCommand
-public co.aikar.commands.RootCommand createRootCommand(String cmd)
+public co.aikar.commands.RootCommand createRootCommand(String cmd)
- Specified by:
createRootCommand in class co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.MessageReceivedEvent,JDACommandEvent,String,co.aikar.commands.MessageFormatter<String>,JDACommandExecutionContext,JDAConditionContext>
@@ -574,21 +574,21 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
getLocales
-public co.aikar.commands.Locales getLocales()
+public co.aikar.commands.Locales getLocales()
- Specified by:
getLocales in class co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.MessageReceivedEvent,JDACommandEvent,String,co.aikar.commands.MessageFormatter<String>,JDACommandExecutionContext,JDAConditionContext>
-
+
-
createCommandContext
-public co.aikar.commands.CommandExecutionContext createCommandContext(co.aikar.commands.RegisteredCommand command,
- Parameter parameter,
+public co.aikar.commands.CommandExecutionContext createCommandContext(co.aikar.commands.RegisteredCommand command,
+ co.aikar.commands.CommandParameter parameter,
co.aikar.commands.CommandIssuer sender,
List<String> args,
int i,
@@ -605,7 +605,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
createCompletionContext
-public co.aikar.commands.CommandCompletionContext createCompletionContext(co.aikar.commands.RegisteredCommand command,
+public co.aikar.commands.CommandCompletionContext createCompletionContext(co.aikar.commands.RegisteredCommand command,
co.aikar.commands.CommandIssuer sender,
String input,
String config,
@@ -622,7 +622,7 @@ extends co.aikar.commands.CommandManager<net.dv8tion.jda.core.events.message.
-
log
-public void log(co.aikar.commands.LogLevel level,
+public void log(co.aikar.commands.LogLevel level,
String message,
Throwable throwable)
diff --git a/docs/acf-jda/index-all.html b/docs/acf-jda/index-all.html
index ad7e58db..04cdf6c9 100644
--- a/docs/acf-jda/index-all.html
+++ b/docs/acf-jda/index-all.html
@@ -100,7 +100,7 @@
-
- create(JDA) - Method in class co.aikar.commands.JDAOptions
-
-- createCommandContext(RegisteredCommand, Parameter, CommandIssuer, List<String>, int, Map<String, Object>) - Method in class co.aikar.commands.JDACommandManager
+- createCommandContext(RegisteredCommand, CommandParameter, CommandIssuer, List<String>, int, Map<String, Object>) - Method in class co.aikar.commands.JDACommandManager
-
- createCompletionContext(RegisteredCommand, CommandIssuer, String, String, String[]) - Method in class co.aikar.commands.JDACommandManager
-
diff --git a/docs/acf-jda/src-html/co/aikar/commands/JDACommandExecutionContext.html b/docs/acf-jda/src-html/co/aikar/commands/JDACommandExecutionContext.html
index fb5050f4..5d6bd14e 100644
--- a/docs/acf-jda/src-html/co/aikar/commands/JDACommandExecutionContext.html
+++ b/docs/acf-jda/src-html/co/aikar/commands/JDACommandExecutionContext.html
@@ -13,7 +13,7 @@
005import java.util.Map;
006
007public class JDACommandExecutionContext extends CommandExecutionContext<JDACommandExecutionContext,JDACommandEvent> {
-008 JDACommandExecutionContext(RegisteredCommand cmd, Parameter param, JDACommandEvent sender, List<String> args, int index, Map<String, Object> passedArgs) {
+008 JDACommandExecutionContext(RegisteredCommand cmd, CommandParameter param, JDACommandEvent sender, List<String> args, int index, Map<String, Object> passedArgs) {
009 super(cmd, param, sender, args, index, passedArgs);
010 }
011}
diff --git a/docs/acf-jda/src-html/co/aikar/commands/JDACommandManager.html b/docs/acf-jda/src-html/co/aikar/commands/JDACommandManager.html
index 20cdf02d..9c5bce14 100644
--- a/docs/acf-jda/src-html/co/aikar/commands/JDACommandManager.html
+++ b/docs/acf-jda/src-html/co/aikar/commands/JDACommandManager.html
@@ -17,254 +17,253 @@
009import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
010import org.jetbrains.annotations.NotNull;
011
-012import java.lang.reflect.Parameter;
-013import java.util.Arrays;
-014import java.util.List;
-015import java.util.Map;
-016import java.util.logging.Level;
-017import java.util.logging.Logger;
-018
-019public class JDACommandManager extends CommandManager<
-020 MessageReceivedEvent,
-021 JDACommandEvent,
-022 String,
-023 MessageFormatter<String>,
-024 JDACommandExecutionContext,
-025 JDAConditionContext
-026 > {
-027
-028 private final JDA jda;
-029
-030 private Logger logger;
-031 private CommandConfig defaultConfig;
-032 private CommandConfigProvider configProvider;
-033 private CommandPermissionResolver permissionResolver;
-034 protected JDACommandCompletions completions;
-035 protected JDACommandContexts contexts;
-036 protected JDALocales locales;
-037 private long botOwner = 0L;
-038
-039 protected Map<String, JDARootCommand> commands = Maps.newHashMap();
-040
-041 public JDACommandManager(JDA jda) {
-042 this(jda, null);
-043 }
-044
-045 public JDACommandManager(JDA jda, JDAOptions options) {
-046 if (options == null) {
-047 options = new JDAOptions();
-048 }
-049 this.jda = jda;
-050 this.permissionResolver = options.permissionResolver;
-051 jda.addEventListener(new JDAListener(this));
-052 this.defaultConfig = options.defaultConfig == null ? new JDACommandConfig() : options.defaultConfig;
-053 this.configProvider = options.configProvider;
-054 this.completions = new JDACommandCompletions(this);
-055 this.logger = Logger.getLogger(this.getClass().getSimpleName());
-056
-057 getCommandConditions().addCondition("owneronly", context -> {
-058 if (context.getIssuer().getEvent().getAuthor().getIdLong() != getBotOwnerId()) {
-059 throw new ConditionFailedException("Only the bot owner can use this command."); // TODO: MessageKey
-060 }
-061 });
-062
-063 getCommandConditions().addCondition("guildonly", context -> {
-064 if (context.getIssuer().getEvent().getChannelType() != ChannelType.TEXT) {
-065 throw new ConditionFailedException("This command must be used in guild chat."); // TODO: MessageKey
-066 }
-067 });
-068
-069 getCommandConditions().addCondition("privateonly", context -> {
-070 if (context.getIssuer().getEvent().getChannelType() != ChannelType.PRIVATE) {
-071 throw new ConditionFailedException("This command must be used in private chat."); // TODO: MessageKey
-072 }
-073 });
-074
-075 getCommandConditions().addCondition("grouponly", context -> {
-076 if (context.getIssuer().getEvent().getChannelType() != ChannelType.GROUP) {
-077 throw new ConditionFailedException("This command must be used in group chat."); // TODO: MessageKey
-078 }
-079 });
-080 }
-081
-082 void initializeBotOwner() {
-083 if (botOwner == 0L) {
-084 if (jda.getAccountType() == AccountType.BOT) {
-085 botOwner = jda.asBot().getApplicationInfo().complete().getOwner().getIdLong();
-086 } else {
-087 botOwner = jda.getSelfUser().getIdLong();
-088 }
-089 }
-090 }
-091
-092 private long getBotOwnerId() {
-093 // Just in case initialization on ReadyEvent fails.
-094 initializeBotOwner();
-095 return botOwner;
-096 }
+012import java.util.Arrays;
+013import java.util.List;
+014import java.util.Map;
+015import java.util.logging.Level;
+016import java.util.logging.Logger;
+017
+018public class JDACommandManager extends CommandManager<
+019 MessageReceivedEvent,
+020 JDACommandEvent,
+021 String,
+022 MessageFormatter<String>,
+023 JDACommandExecutionContext,
+024 JDAConditionContext
+025 > {
+026
+027 private final JDA jda;
+028
+029 private Logger logger;
+030 private CommandConfig defaultConfig;
+031 private CommandConfigProvider configProvider;
+032 private CommandPermissionResolver permissionResolver;
+033 protected JDACommandCompletions completions;
+034 protected JDACommandContexts contexts;
+035 protected JDALocales locales;
+036 private long botOwner = 0L;
+037
+038 protected Map<String, JDARootCommand> commands = Maps.newHashMap();
+039
+040 public JDACommandManager(JDA jda) {
+041 this(jda, null);
+042 }
+043
+044 public JDACommandManager(JDA jda, JDAOptions options) {
+045 if (options == null) {
+046 options = new JDAOptions();
+047 }
+048 this.jda = jda;
+049 this.permissionResolver = options.permissionResolver;
+050 jda.addEventListener(new JDAListener(this));
+051 this.defaultConfig = options.defaultConfig == null ? new JDACommandConfig() : options.defaultConfig;
+052 this.configProvider = options.configProvider;
+053 this.completions = new JDACommandCompletions(this);
+054 this.logger = Logger.getLogger(this.getClass().getSimpleName());
+055
+056 getCommandConditions().addCondition("owneronly", context -> {
+057 if (context.getIssuer().getEvent().getAuthor().getIdLong() != getBotOwnerId()) {
+058 throw new ConditionFailedException("Only the bot owner can use this command."); // TODO: MessageKey
+059 }
+060 });
+061
+062 getCommandConditions().addCondition("guildonly", context -> {
+063 if (context.getIssuer().getEvent().getChannelType() != ChannelType.TEXT) {
+064 throw new ConditionFailedException("This command must be used in guild chat."); // TODO: MessageKey
+065 }
+066 });
+067
+068 getCommandConditions().addCondition("privateonly", context -> {
+069 if (context.getIssuer().getEvent().getChannelType() != ChannelType.PRIVATE) {
+070 throw new ConditionFailedException("This command must be used in private chat."); // TODO: MessageKey
+071 }
+072 });
+073
+074 getCommandConditions().addCondition("grouponly", context -> {
+075 if (context.getIssuer().getEvent().getChannelType() != ChannelType.GROUP) {
+076 throw new ConditionFailedException("This command must be used in group chat."); // TODO: MessageKey
+077 }
+078 });
+079 }
+080
+081 void initializeBotOwner() {
+082 if (botOwner == 0L) {
+083 if (jda.getAccountType() == AccountType.BOT) {
+084 botOwner = jda.asBot().getApplicationInfo().complete().getOwner().getIdLong();
+085 } else {
+086 botOwner = jda.getSelfUser().getIdLong();
+087 }
+088 }
+089 }
+090
+091 private long getBotOwnerId() {
+092 // Just in case initialization on ReadyEvent fails.
+093 initializeBotOwner();
+094 return botOwner;
+095 }
+096
097
-098
-099 public static JDAOptions options() {
-100 return new JDAOptions();
-101 }
-102
-103 public JDA getJDA() {
-104 return jda;
-105 }
-106
-107 public Logger getLogger() {
-108 return logger;
-109 }
-110
-111 public void setLogger(Logger logger) {
-112 this.logger = logger;
-113 }
-114
-115 public CommandConfig getDefaultConfig() {
-116 return defaultConfig;
-117 }
-118
-119 public void setDefaultConfig(@NotNull CommandConfig defaultConfig) {
-120 this.defaultConfig = defaultConfig;
-121 }
-122
-123 public CommandConfigProvider getConfigProvider() {
-124 return configProvider;
-125 }
-126
-127 public void setConfigProvider(CommandConfigProvider configProvider) {
-128 this.configProvider = configProvider;
-129 }
-130
-131 public CommandPermissionResolver getPermissionResolver() {
-132 return permissionResolver;
-133 }
-134
-135 public void setPermissionResolver(CommandPermissionResolver permissionResolver) {
-136 this.permissionResolver = permissionResolver;
-137 }
-138
-139 @Override
-140 public CommandContexts<?> getCommandContexts() {
-141 if (this.contexts == null) {
-142 this.contexts = new JDACommandContexts(this);
-143 }
-144 return this.contexts;
-145 }
-146
-147 @Override
-148 public CommandCompletions<?> getCommandCompletions() {
-149 return this.completions;
-150 }
-151
-152 @Override
-153 public void registerCommand(BaseCommand command) {
-154 command.onRegister(this);
-155 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) {
-156 String commandName = entry.getKey().toLowerCase();
-157 JDARootCommand cmd = (JDARootCommand) entry.getValue();
-158 if (!cmd.isRegistered) {
-159 cmd.isRegistered = true;
-160 commands.put(commandName, cmd);
-161 }
-162 }
-163 }
-164
-165 @Override
-166 public boolean hasRegisteredCommands() {
-167 return !this.commands.isEmpty();
-168 }
-169
-170 @Override
-171 public boolean isCommandIssuer(Class<?> type) {
-172 return JDACommandEvent.class.isAssignableFrom(type);
-173 }
-174
-175 @Override
-176 public JDACommandEvent getCommandIssuer(Object issuer) {
-177 if (!(issuer instanceof MessageReceivedEvent)) {
-178 throw new IllegalArgumentException(issuer.getClass().getName() + " is not a Message Received Event.");
-179 }
-180 return new JDACommandEvent(this, (MessageReceivedEvent) issuer);
-181 }
-182
-183 @Override
-184 public RootCommand createRootCommand(String cmd) {
-185 return new JDARootCommand(this, cmd);
-186 }
-187
-188 @Override
-189 public Locales getLocales() {
-190 if (this.locales == null) {
-191 this.locales = new JDALocales(this);
-192 this.locales.loadLanguages();
-193 }
-194 return this.locales;
-195 }
-196
-197 @Override
-198 public CommandExecutionContext createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs) {
-199 return new JDACommandExecutionContext(command, parameter, (JDACommandEvent) sender, args, i, passedArgs);
-200 }
-201
-202 @Override
-203 public CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args) {
-204 // Not really going to be used;
-205 //noinspection unchecked
-206 return new CommandCompletionContext(command, sender, input, config, args);
-207 }
-208
-209 @Override
-210 public void log(LogLevel level, String message, Throwable throwable) {
-211 Level logLevel = level == LogLevel.INFO ? Level.INFO : Level.SEVERE;
-212 logger.log(logLevel, LogLevel.LOG_PREFIX + message);
-213 if (throwable != null) {
-214 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) {
-215 logger.log(logLevel, LogLevel.LOG_PREFIX + line);
-216 }
-217 }
-218 }
-219
-220 void dispatchEvent(MessageReceivedEvent event) {
-221 Message message = event.getMessage();
-222 String msg = message.getContentDisplay();
-223
-224 CommandConfig config = this.defaultConfig;
-225 if (this.configProvider != null) {
-226 CommandConfig provided = this.configProvider.provide(event);
-227 if (provided != null) {
-228 config = provided;
-229 }
-230 }
-231
-232 String prefixFound = null;
-233 for (String prefix : config.getCommandPrefixes()) {
-234 if (msg.startsWith(prefix)) {
-235 prefixFound = prefix;
-236 break;
-237 }
-238 }
-239 if (prefixFound == null) {
-240 return;
-241 }
-242
-243 String[] args = ACFPatterns.SPACE.split(msg.substring(prefixFound.length()), -1);
-244 if (args.length == 0) {
-245 return;
-246 }
-247 String cmd = args[0].toLowerCase();
-248 JDARootCommand rootCommand = this.commands.get(cmd);
-249 if (rootCommand == null) {
-250 return;
-251 }
-252 if (args.length > 1) {
-253 args = Arrays.copyOfRange(args, 1, args.length);
-254 } else {
-255 args = new String[0];
-256 }
-257 rootCommand.execute(this.getCommandIssuer(event), cmd, args);
-258 }
-259}
+098 public static JDAOptions options() {
+099 return new JDAOptions();
+100 }
+101
+102 public JDA getJDA() {
+103 return jda;
+104 }
+105
+106 public Logger getLogger() {
+107 return logger;
+108 }
+109
+110 public void setLogger(Logger logger) {
+111 this.logger = logger;
+112 }
+113
+114 public CommandConfig getDefaultConfig() {
+115 return defaultConfig;
+116 }
+117
+118 public void setDefaultConfig(@NotNull CommandConfig defaultConfig) {
+119 this.defaultConfig = defaultConfig;
+120 }
+121
+122 public CommandConfigProvider getConfigProvider() {
+123 return configProvider;
+124 }
+125
+126 public void setConfigProvider(CommandConfigProvider configProvider) {
+127 this.configProvider = configProvider;
+128 }
+129
+130 public CommandPermissionResolver getPermissionResolver() {
+131 return permissionResolver;
+132 }
+133
+134 public void setPermissionResolver(CommandPermissionResolver permissionResolver) {
+135 this.permissionResolver = permissionResolver;
+136 }
+137
+138 @Override
+139 public CommandContexts<?> getCommandContexts() {
+140 if (this.contexts == null) {
+141 this.contexts = new JDACommandContexts(this);
+142 }
+143 return this.contexts;
+144 }
+145
+146 @Override
+147 public CommandCompletions<?> getCommandCompletions() {
+148 return this.completions;
+149 }
+150
+151 @Override
+152 public void registerCommand(BaseCommand command) {
+153 command.onRegister(this);
+154 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) {
+155 String commandName = entry.getKey().toLowerCase();
+156 JDARootCommand cmd = (JDARootCommand) entry.getValue();
+157 if (!cmd.isRegistered) {
+158 cmd.isRegistered = true;
+159 commands.put(commandName, cmd);
+160 }
+161 }
+162 }
+163
+164 @Override
+165 public boolean hasRegisteredCommands() {
+166 return !this.commands.isEmpty();
+167 }
+168
+169 @Override
+170 public boolean isCommandIssuer(Class<?> type) {
+171 return JDACommandEvent.class.isAssignableFrom(type);
+172 }
+173
+174 @Override
+175 public JDACommandEvent getCommandIssuer(Object issuer) {
+176 if (!(issuer instanceof MessageReceivedEvent)) {
+177 throw new IllegalArgumentException(issuer.getClass().getName() + " is not a Message Received Event.");
+178 }
+179 return new JDACommandEvent(this, (MessageReceivedEvent) issuer);
+180 }
+181
+182 @Override
+183 public RootCommand createRootCommand(String cmd) {
+184 return new JDARootCommand(this, cmd);
+185 }
+186
+187 @Override
+188 public Locales getLocales() {
+189 if (this.locales == null) {
+190 this.locales = new JDALocales(this);
+191 this.locales.loadLanguages();
+192 }
+193 return this.locales;
+194 }
+195
+196 @Override
+197 public CommandExecutionContext createCommandContext(RegisteredCommand command, CommandParameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs) {
+198 return new JDACommandExecutionContext(command, parameter, (JDACommandEvent) sender, args, i, passedArgs);
+199 }
+200
+201 @Override
+202 public CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args) {
+203 // Not really going to be used;
+204 //noinspection unchecked
+205 return new CommandCompletionContext(command, sender, input, config, args);
+206 }
+207
+208 @Override
+209 public void log(LogLevel level, String message, Throwable throwable) {
+210 Level logLevel = level == LogLevel.INFO ? Level.INFO : Level.SEVERE;
+211 logger.log(logLevel, LogLevel.LOG_PREFIX + message);
+212 if (throwable != null) {
+213 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) {
+214 logger.log(logLevel, LogLevel.LOG_PREFIX + line);
+215 }
+216 }
+217 }
+218
+219 void dispatchEvent(MessageReceivedEvent event) {
+220 Message message = event.getMessage();
+221 String msg = message.getContentDisplay();
+222
+223 CommandConfig config = this.defaultConfig;
+224 if (this.configProvider != null) {
+225 CommandConfig provided = this.configProvider.provide(event);
+226 if (provided != null) {
+227 config = provided;
+228 }
+229 }
+230
+231 String prefixFound = null;
+232 for (String prefix : config.getCommandPrefixes()) {
+233 if (msg.startsWith(prefix)) {
+234 prefixFound = prefix;
+235 break;
+236 }
+237 }
+238 if (prefixFound == null) {
+239 return;
+240 }
+241
+242 String[] args = ACFPatterns.SPACE.split(msg.substring(prefixFound.length()), -1);
+243 if (args.length == 0) {
+244 return;
+245 }
+246 String cmd = args[0].toLowerCase();
+247 JDARootCommand rootCommand = this.commands.get(cmd);
+248 if (rootCommand == null) {
+249 return;
+250 }
+251 if (args.length > 1) {
+252 args = Arrays.copyOfRange(args, 1, args.length);
+253 } else {
+254 args = new String[0];
+255 }
+256 rootCommand.execute(this.getCommandIssuer(event), cmd, args);
+257 }
+258}
diff --git a/docs/acf-sponge/co/aikar/commands/SpongeCommandManager.html b/docs/acf-sponge/co/aikar/commands/SpongeCommandManager.html
index 4d97b035..9d512ce1 100644
--- a/docs/acf-sponge/co/aikar/commands/SpongeCommandManager.html
+++ b/docs/acf-sponge/co/aikar/commands/SpongeCommandManager.html
@@ -113,7 +113,7 @@ var activeTableTab = "activeTableTab";
-
-public class SpongeCommandManager
+public class SpongeCommandManager
extends co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,SpongeCommandIssuer,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter,SpongeCommandExecutionContext,SpongeConditionContext>
@@ -194,8 +194,8 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
SpongeCommandExecutionContext
-createCommandContext(co.aikar.commands.RegisteredCommand command,
- Parameter parameter,
+createCommandContext(co.aikar.commands.RegisteredCommand command,
+ co.aikar.commands.CommandParameter parameter,
co.aikar.commands.CommandIssuer sender,
List<String> args,
int i,
@@ -302,7 +302,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
plugin
-protected final org.spongepowered.api.plugin.PluginContainer plugin
+protected final org.spongepowered.api.plugin.PluginContainer plugin
@@ -311,7 +311,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
registeredCommands
-protected Map<String,SpongeRootCommand> registeredCommands
+protected Map<String,SpongeRootCommand> registeredCommands
@@ -320,7 +320,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
contexts
-protected SpongeCommandContexts contexts
+protected SpongeCommandContexts contexts
@@ -329,7 +329,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
completions
-protected SpongeCommandCompletions completions
+protected SpongeCommandCompletions completions
@@ -338,7 +338,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
locales
-protected SpongeLocales locales
+protected SpongeLocales locales
@@ -355,7 +355,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
SpongeCommandManager
-public SpongeCommandManager(org.spongepowered.api.plugin.PluginContainer plugin)
+public SpongeCommandManager(org.spongepowered.api.plugin.PluginContainer plugin)
@@ -372,7 +372,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
@@ -381,7 +381,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
isCommandIssuer
-public boolean isCommandIssuer(Class<?> type)
+public boolean isCommandIssuer(Class<?> type)
- Specified by:
isCommandIssuer in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,SpongeCommandIssuer,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter,SpongeCommandExecutionContext,SpongeConditionContext>
@@ -394,7 +394,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
getCommandContexts
-public co.aikar.commands.CommandContexts<SpongeCommandExecutionContext> getCommandContexts()
+public co.aikar.commands.CommandContexts<SpongeCommandExecutionContext> getCommandContexts()
- Specified by:
getCommandContexts in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,SpongeCommandIssuer,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter,SpongeCommandExecutionContext,SpongeConditionContext>
@@ -407,7 +407,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
getCommandCompletions
-public co.aikar.commands.CommandCompletions<SpongeCommandCompletionContext> getCommandCompletions()
+public co.aikar.commands.CommandCompletions<SpongeCommandCompletionContext> getCommandCompletions()
- Specified by:
getCommandCompletions in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,SpongeCommandIssuer,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter,SpongeCommandExecutionContext,SpongeConditionContext>
@@ -420,7 +420,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
getLocales
-public SpongeLocales getLocales()
+public SpongeLocales getLocales()
- Specified by:
getLocales in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,SpongeCommandIssuer,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter,SpongeCommandExecutionContext,SpongeConditionContext>
@@ -433,7 +433,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
hasRegisteredCommands
-public boolean hasRegisteredCommands()
+public boolean hasRegisteredCommands()
- Specified by:
hasRegisteredCommands in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,SpongeCommandIssuer,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter,SpongeCommandExecutionContext,SpongeConditionContext>
@@ -446,7 +446,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
registerCommand
-public void registerCommand(co.aikar.commands.BaseCommand command)
+public void registerCommand(co.aikar.commands.BaseCommand command)
- Specified by:
registerCommand in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,SpongeCommandIssuer,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter,SpongeCommandExecutionContext,SpongeConditionContext>
@@ -459,7 +459,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
createTiming
-public co.aikar.timings.Timing createTiming(String name)
+public co.aikar.timings.Timing createTiming(String name)
@@ -468,7 +468,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
createRootCommand
-public co.aikar.commands.RootCommand createRootCommand(String cmd)
+public co.aikar.commands.RootCommand createRootCommand(String cmd)
- Specified by:
createRootCommand in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,SpongeCommandIssuer,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter,SpongeCommandExecutionContext,SpongeConditionContext>
@@ -481,21 +481,21 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
getCommandIssuer
-public SpongeCommandIssuer getCommandIssuer(Object issuer)
+public SpongeCommandIssuer getCommandIssuer(Object issuer)
- Specified by:
getCommandIssuer in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,SpongeCommandIssuer,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter,SpongeCommandExecutionContext,SpongeConditionContext>
-
+
-
createCommandContext
-public SpongeCommandExecutionContext createCommandContext(co.aikar.commands.RegisteredCommand command,
- Parameter parameter,
+public SpongeCommandExecutionContext createCommandContext(co.aikar.commands.RegisteredCommand command,
+ co.aikar.commands.CommandParameter parameter,
co.aikar.commands.CommandIssuer sender,
List<String> args,
int i,
@@ -512,7 +512,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
createCompletionContext
-public co.aikar.commands.CommandCompletionContext createCompletionContext(co.aikar.commands.RegisteredCommand command,
+public co.aikar.commands.CommandCompletionContext createCompletionContext(co.aikar.commands.RegisteredCommand command,
co.aikar.commands.CommandIssuer sender,
String input,
String config,
@@ -529,7 +529,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
createRegisteredCommand
-public co.aikar.commands.RegisteredCommand createRegisteredCommand(co.aikar.commands.BaseCommand command,
+public co.aikar.commands.RegisteredCommand createRegisteredCommand(co.aikar.commands.BaseCommand command,
String cmdName,
Method method,
String prefSubCommand)
@@ -545,7 +545,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
log
-public void log(co.aikar.commands.LogLevel level,
+public void log(co.aikar.commands.LogLevel level,
String message,
Throwable throwable)
@@ -560,7 +560,7 @@ extends co.aikar.commands.CommandManager<org.spongepowered.api.command.Comman
-
createConditionContext
-public SpongeConditionContext createConditionContext(co.aikar.commands.CommandIssuer issuer,
+public SpongeConditionContext createConditionContext(co.aikar.commands.CommandIssuer issuer,
String config)
- Overrides:
diff --git a/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandExecutionContext.html b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandExecutionContext.html
index 8d04d9a6..ab12d0c5 100644
--- a/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandExecutionContext.html
+++ b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandExecutionContext.html
@@ -103,8 +103,8 @@
SpongeCommandExecutionContext
-SpongeCommandManager.createCommandContext(co.aikar.commands.RegisteredCommand command,
- Parameter parameter,
+SpongeCommandManager.createCommandContext(co.aikar.commands.RegisteredCommand command,
+ co.aikar.commands.CommandParameter parameter,
co.aikar.commands.CommandIssuer sender,
List<String> args,
int i,
diff --git a/docs/acf-sponge/index-all.html b/docs/acf-sponge/index-all.html
index 0fb82fbf..be60ca03 100644
--- a/docs/acf-sponge/index-all.html
+++ b/docs/acf-sponge/index-all.html
@@ -103,7 +103,7 @@
-
- contexts - Variable in class co.aikar.commands.SpongeCommandManager
-
-- createCommandContext(RegisteredCommand, Parameter, CommandIssuer, List<String>, int, Map<String, Object>) - Method in class co.aikar.commands.SpongeCommandManager
+- createCommandContext(RegisteredCommand, CommandParameter, CommandIssuer, List<String>, int, Map<String, Object>) - Method in class co.aikar.commands.SpongeCommandManager
-
- createCompletionContext(RegisteredCommand, CommandIssuer, String, String, String[]) - Method in class co.aikar.commands.SpongeCommandManager
-
diff --git a/docs/acf-sponge/src-html/co/aikar/commands/SpongeCommandExecutionContext.html b/docs/acf-sponge/src-html/co/aikar/commands/SpongeCommandExecutionContext.html
index 729e742b..de80122e 100644
--- a/docs/acf-sponge/src-html/co/aikar/commands/SpongeCommandExecutionContext.html
+++ b/docs/acf-sponge/src-html/co/aikar/commands/SpongeCommandExecutionContext.html
@@ -40,7 +40,7 @@
032
033public class SpongeCommandExecutionContext extends CommandExecutionContext<SpongeCommandExecutionContext, SpongeCommandIssuer> {
034
-035 SpongeCommandExecutionContext(RegisteredCommand cmd, Parameter param, SpongeCommandIssuer sender, List<String> args,
+035 SpongeCommandExecutionContext(RegisteredCommand cmd, CommandParameter param, SpongeCommandIssuer sender, List<String> args,
036 int index, Map<String, Object> passedArgs) {
037 super(cmd, param, sender, args, index, passedArgs);
038 }
diff --git a/docs/acf-sponge/src-html/co/aikar/commands/SpongeCommandManager.html b/docs/acf-sponge/src-html/co/aikar/commands/SpongeCommandManager.html
index cc49ce3d..a3fa7672 100644
--- a/docs/acf-sponge/src-html/co/aikar/commands/SpongeCommandManager.html
+++ b/docs/acf-sponge/src-html/co/aikar/commands/SpongeCommandManager.html
@@ -42,171 +42,170 @@
034import org.spongepowered.api.text.format.TextColors;
035
036import java.lang.reflect.Method;
-037import java.lang.reflect.Parameter;
-038import java.util.HashMap;
-039import java.util.List;
-040import java.util.Map;
-041
-042@SuppressWarnings("WeakerAccess")
-043public class SpongeCommandManager extends CommandManager<
-044 CommandSource,
-045 SpongeCommandIssuer,
-046 TextColor,
-047 SpongeMessageFormatter,
-048 SpongeCommandExecutionContext,
-049 SpongeConditionContext
-050 > {
-051
-052 protected final PluginContainer plugin;
-053 protected Map<String, SpongeRootCommand> registeredCommands = new HashMap<>();
-054 protected SpongeCommandContexts contexts;
-055 protected SpongeCommandCompletions completions;
-056 private Timing commandTiming;
-057 protected SpongeLocales locales;
-058
-059 public SpongeCommandManager(PluginContainer plugin) {
-060 this.plugin = plugin;
-061 String pluginName = "acf-" + plugin.getName();
-062 getLocales().addMessageBundles("acf-minecraft", pluginName, pluginName.toLowerCase());
-063 this.commandTiming = Timings.of(plugin, "Commands");
-064
-065 this.formatters.put(MessageType.ERROR, defaultFormatter = new SpongeMessageFormatter(TextColors.RED, TextColors.YELLOW, TextColors.RED));
-066 this.formatters.put(MessageType.SYNTAX, new SpongeMessageFormatter(TextColors.YELLOW, TextColors.GREEN, TextColors.WHITE));
-067 this.formatters.put(MessageType.INFO, new SpongeMessageFormatter(TextColors.BLUE, TextColors.DARK_GREEN, TextColors.GREEN));
-068 this.formatters.put(MessageType.HELP, new SpongeMessageFormatter(TextColors.AQUA, TextColors.GREEN, TextColors.YELLOW));
-069 getLocales(); // auto load locales
-070
-071 Sponge.getEventManager().registerListeners(plugin, new ACFSpongeListener(this));
-072
-073 //TODO more default dependencies for sponge
-074 registerDependency(plugin.getClass(), plugin);
-075 }
-076
-077 public PluginContainer getPlugin() {
-078 return plugin;
-079 }
-080
-081 @Override
-082 public boolean isCommandIssuer(Class<?> type) {
-083 return CommandSource.class.isAssignableFrom(type);
-084 }
-085
-086 @Override
-087 public synchronized CommandContexts<SpongeCommandExecutionContext> getCommandContexts() {
-088 if (this.contexts == null) {
-089 this.contexts = new SpongeCommandContexts(this);
-090 }
-091 return contexts;
-092 }
-093
-094 @Override
-095 public synchronized CommandCompletions<SpongeCommandCompletionContext> getCommandCompletions() {
-096 if (this.completions == null) {
-097 this.completions = new SpongeCommandCompletions(this);
-098 }
-099 return completions;
-100 }
-101
-102 @Override
-103 public SpongeLocales getLocales() {
-104 if (this.locales == null) {
-105 this.locales = new SpongeLocales(this);
-106 this.locales.loadLanguages();
-107 }
-108 return locales;
-109 }
-110
-111 @Override
-112 public boolean hasRegisteredCommands() {
-113 return !registeredCommands.isEmpty();
-114 }
-115
-116 @Override
-117 public void registerCommand(BaseCommand command) {
-118 command.onRegister(this);
-119
-120 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) {
-121 String commandName = entry.getKey().toLowerCase();
-122 SpongeRootCommand spongeCommand = (SpongeRootCommand) entry.getValue();
-123 if (!spongeCommand.isRegistered) {
-124 Sponge.getCommandManager().register(this.plugin, spongeCommand, commandName);
-125 }
-126 spongeCommand.isRegistered = true;
-127 registeredCommands.put(commandName, spongeCommand);
-128 }
-129 }
-130
-131 public Timing createTiming(final String name) {
-132 return Timings.of(this.plugin, name, this.commandTiming);
-133 }
-134
-135 @Override
-136 public RootCommand createRootCommand(String cmd) {
-137 return new SpongeRootCommand(this, cmd);
-138 }
-139
-140 @Override
-141 public SpongeCommandIssuer getCommandIssuer(Object issuer) {
-142 if (!(issuer instanceof CommandSource)) {
-143 throw new IllegalArgumentException(issuer.getClass().getName() + " is not a Command Issuer.");
-144 }
-145 return new SpongeCommandIssuer(this, (CommandSource) issuer);
-146 }
-147
-148 @Override
-149 public SpongeCommandExecutionContext createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs) {
-150 return new SpongeCommandExecutionContext(command, parameter, (SpongeCommandIssuer) sender, args, i, passedArgs);
-151 }
-152
-153 @Override
-154 public CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args) {
-155 return new SpongeCommandCompletionContext(command, (SpongeCommandIssuer) sender, input, config, args);
-156 }
-157
-158 @Override
-159 public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) {
-160 return new SpongeRegisteredCommand(command, cmdName, method, prefSubCommand);
-161 }
-162
-163 @Override
-164 public void log(final LogLevel level, final String message, final Throwable throwable) {
-165 Logger logger = this.plugin.getLogger();
-166 switch(level) {
-167 case INFO:
-168 logger.info(LogLevel.LOG_PREFIX + message);
-169 if (throwable != null) {
-170 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) {
-171 logger.info(LogLevel.LOG_PREFIX + line);
-172 }
-173 }
-174 return;
-175 case ERROR:
-176 logger.error(LogLevel.LOG_PREFIX + message);
-177 if (throwable != null) {
-178 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) {
-179 logger.error(LogLevel.LOG_PREFIX + line);
-180 }
-181 }
-182 }
-183 }
-184
-185 @Override
-186 CommandOperationContext createCommandOperationContext(BaseCommand command, CommandIssuer issuer, String commandLabel, String[] args, boolean isAsync) {
-187 return new SpongeCommandOperationContext(
-188 this,
-189 issuer,
-190 command,
-191 commandLabel,
-192 args,
-193 isAsync
-194 );
-195 }
-196
-197 @Override
-198 public SpongeConditionContext createConditionContext(CommandIssuer issuer, String config) {
-199 return new SpongeConditionContext((SpongeCommandIssuer) issuer, config);
-200 }
-201}
+037import java.util.HashMap;
+038import java.util.List;
+039import java.util.Map;
+040
+041@SuppressWarnings("WeakerAccess")
+042public class SpongeCommandManager extends CommandManager<
+043 CommandSource,
+044 SpongeCommandIssuer,
+045 TextColor,
+046 SpongeMessageFormatter,
+047 SpongeCommandExecutionContext,
+048 SpongeConditionContext
+049 > {
+050
+051 protected final PluginContainer plugin;
+052 protected Map<String, SpongeRootCommand> registeredCommands = new HashMap<>();
+053 protected SpongeCommandContexts contexts;
+054 protected SpongeCommandCompletions completions;
+055 private Timing commandTiming;
+056 protected SpongeLocales locales;
+057
+058 public SpongeCommandManager(PluginContainer plugin) {
+059 this.plugin = plugin;
+060 String pluginName = "acf-" + plugin.getName();
+061 getLocales().addMessageBundles("acf-minecraft", pluginName, pluginName.toLowerCase());
+062 this.commandTiming = Timings.of(plugin, "Commands");
+063
+064 this.formatters.put(MessageType.ERROR, defaultFormatter = new SpongeMessageFormatter(TextColors.RED, TextColors.YELLOW, TextColors.RED));
+065 this.formatters.put(MessageType.SYNTAX, new SpongeMessageFormatter(TextColors.YELLOW, TextColors.GREEN, TextColors.WHITE));
+066 this.formatters.put(MessageType.INFO, new SpongeMessageFormatter(TextColors.BLUE, TextColors.DARK_GREEN, TextColors.GREEN));
+067 this.formatters.put(MessageType.HELP, new SpongeMessageFormatter(TextColors.AQUA, TextColors.GREEN, TextColors.YELLOW));
+068 getLocales(); // auto load locales
+069
+070 Sponge.getEventManager().registerListeners(plugin, new ACFSpongeListener(this));
+071
+072 //TODO more default dependencies for sponge
+073 registerDependency(plugin.getClass(), plugin);
+074 }
+075
+076 public PluginContainer getPlugin() {
+077 return plugin;
+078 }
+079
+080 @Override
+081 public boolean isCommandIssuer(Class<?> type) {
+082 return CommandSource.class.isAssignableFrom(type);
+083 }
+084
+085 @Override
+086 public synchronized CommandContexts<SpongeCommandExecutionContext> getCommandContexts() {
+087 if (this.contexts == null) {
+088 this.contexts = new SpongeCommandContexts(this);
+089 }
+090 return contexts;
+091 }
+092
+093 @Override
+094 public synchronized CommandCompletions<SpongeCommandCompletionContext> getCommandCompletions() {
+095 if (this.completions == null) {
+096 this.completions = new SpongeCommandCompletions(this);
+097 }
+098 return completions;
+099 }
+100
+101 @Override
+102 public SpongeLocales getLocales() {
+103 if (this.locales == null) {
+104 this.locales = new SpongeLocales(this);
+105 this.locales.loadLanguages();
+106 }
+107 return locales;
+108 }
+109
+110 @Override
+111 public boolean hasRegisteredCommands() {
+112 return !registeredCommands.isEmpty();
+113 }
+114
+115 @Override
+116 public void registerCommand(BaseCommand command) {
+117 command.onRegister(this);
+118
+119 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) {
+120 String commandName = entry.getKey().toLowerCase();
+121 SpongeRootCommand spongeCommand = (SpongeRootCommand) entry.getValue();
+122 if (!spongeCommand.isRegistered) {
+123 Sponge.getCommandManager().register(this.plugin, spongeCommand, commandName);
+124 }
+125 spongeCommand.isRegistered = true;
+126 registeredCommands.put(commandName, spongeCommand);
+127 }
+128 }
+129
+130 public Timing createTiming(final String name) {
+131 return Timings.of(this.plugin, name, this.commandTiming);
+132 }
+133
+134 @Override
+135 public RootCommand createRootCommand(String cmd) {
+136 return new SpongeRootCommand(this, cmd);
+137 }
+138
+139 @Override
+140 public SpongeCommandIssuer getCommandIssuer(Object issuer) {
+141 if (!(issuer instanceof CommandSource)) {
+142 throw new IllegalArgumentException(issuer.getClass().getName() + " is not a Command Issuer.");
+143 }
+144 return new SpongeCommandIssuer(this, (CommandSource) issuer);
+145 }
+146
+147 @Override
+148 public SpongeCommandExecutionContext createCommandContext(RegisteredCommand command, CommandParameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs) {
+149 return new SpongeCommandExecutionContext(command, parameter, (SpongeCommandIssuer) sender, args, i, passedArgs);
+150 }
+151
+152 @Override
+153 public CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args) {
+154 return new SpongeCommandCompletionContext(command, (SpongeCommandIssuer) sender, input, config, args);
+155 }
+156
+157 @Override
+158 public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) {
+159 return new SpongeRegisteredCommand(command, cmdName, method, prefSubCommand);
+160 }
+161
+162 @Override
+163 public void log(final LogLevel level, final String message, final Throwable throwable) {
+164 Logger logger = this.plugin.getLogger();
+165 switch(level) {
+166 case INFO:
+167 logger.info(LogLevel.LOG_PREFIX + message);
+168 if (throwable != null) {
+169 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) {
+170 logger.info(LogLevel.LOG_PREFIX + line);
+171 }
+172 }
+173 return;
+174 case ERROR:
+175 logger.error(LogLevel.LOG_PREFIX + message);
+176 if (throwable != null) {
+177 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) {
+178 logger.error(LogLevel.LOG_PREFIX + line);
+179 }
+180 }
+181 }
+182 }
+183
+184 @Override
+185 CommandOperationContext createCommandOperationContext(BaseCommand command, CommandIssuer issuer, String commandLabel, String[] args, boolean isAsync) {
+186 return new SpongeCommandOperationContext(
+187 this,
+188 issuer,
+189 command,
+190 commandLabel,
+191 args,
+192 isAsync
+193 );
+194 }
+195
+196 @Override
+197 public SpongeConditionContext createConditionContext(CommandIssuer issuer, String config) {
+198 return new SpongeConditionContext((SpongeCommandIssuer) issuer, config);
+199 }
+200}
diff --git a/docs/acf-sponge/src-html/co/aikar/commands/SpongeRootCommand.html b/docs/acf-sponge/src-html/co/aikar/commands/SpongeRootCommand.html
index 7b484dad..6cc09542 100644
--- a/docs/acf-sponge/src-html/co/aikar/commands/SpongeRootCommand.html
+++ b/docs/acf-sponge/src-html/co/aikar/commands/SpongeRootCommand.html
@@ -74,7 +74,7 @@
066
067 @Override
068 public List<String> getSuggestions(@NotNull CommandSource source, @NotNull String arguments, @Nullable Location<World> location) throws CommandException {
-069 String[] args = arguments.isEmpty() ? new String[0] : arguments.split(" ");
+069 String[] args = arguments.isEmpty() ? new String[]{""} : arguments.split(" ");
070 return getTabCompletions(manager.getCommandIssuer(source), this.name, args);
071 }
072