diff --git a/docs/acf-bukkit/co/aikar/commands/BukkitCommandIssuer.html b/docs/acf-bukkit/co/aikar/commands/BukkitCommandIssuer.html index 374161c9..1426c79e 100644 --- a/docs/acf-bukkit/co/aikar/commands/BukkitCommandIssuer.html +++ b/docs/acf-bukkit/co/aikar/commands/BukkitCommandIssuer.html @@ -18,7 +18,7 @@ catch(err) { } //--> -var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10}; +var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; @@ -112,7 +112,7 @@ var activeTableTab = "activeTableTab";
public class BukkitCommandIssuer +public class BukkitCommandIssuer extends Object implements co.aikar.commands.CommandIssuer@@ -150,18 +150,22 @@ implements co.aikar.commands.CommandIssuer
getPlayer() @NotNull UUIDgetUniqueId() inthashCode() booleanhasPermission(String name) booleanisPlayer() voidsendMessageInternal(String message) public boolean isPlayer()+
public boolean isPlayer()
isPlayer in interface co.aikar.commands.CommandIssuerpublic org.bukkit.command.CommandSender getIssuer()+
public org.bukkit.command.CommandSender getIssuer()
getIssuer in interface co.aikar.commands.CommandIssuerpublic org.bukkit.entity.Player getPlayer()+
public org.bukkit.entity.Player getPlayer()+
@NotNull +public @NotNull UUID getUniqueId()+
getUniqueId in interface co.aikar.commands.CommandIssuerpublic co.aikar.commands.CommandManager getManager()+
public co.aikar.commands.CommandManager getManager()
getManager in interface co.aikar.commands.CommandIssuerpublic void sendMessageInternal(String message)+
public void sendMessageInternal(String message)
sendMessageInternal in interface co.aikar.commands.CommandIssuerpublic boolean hasPermission(String name)+
public boolean hasPermission(String name)
hasPermission in interface co.aikar.commands.CommandIssuerpublic boolean equals(Object o)+
public boolean equals(Object o)
equals in class Objectpublic int hashCode()+
public int hashCode()
hashCode in class Objectpublic class BukkitCommandManager +public class BukkitCommandManager extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>
contexts
protected Map<UUID,Locale>issuersLocale protected Map<String,org.bukkit.command.Command>knownCommands protected BukkitLocaleslocales protected org.bukkit.plugin.Pluginplugin protected Map<String,BukkitRootCommand>registeredCommands conditions, defaultExceptionHandler, defaultFormatter, defaultHelpPerPage, dependencies, formatters, localeChangedCallbacks, replacements, rootCommands, supportedLanguages, usePerIssuerLocaleconditions, defaultExceptionHandler, defaultFormatter, defaultHelpPerPage, dependencies, formatters, issuersLocale, localeChangedCallbacks, replacements, rootCommands, supportedLanguages, usePerIssuerLocalegetCommandIssuer(Object issuer)
LocalegetIssuerLocale(co.aikar.commands.CommandIssuer issuer) BukkitLocalesgetLocales() org.bukkit.plugin.PlugingetPlugin() co.aikar.timings.lib.TimingManagergetTimings() booleanhasRegisteredCommands() booleanisCommandIssuer(Class<?> type) voidlog(co.aikar.commands.LogLevel level,
String message,
Throwable throwable) voidregisterCommand(co.aikar.commands.BaseCommand command) voidregisterCommand(co.aikar.commands.BaseCommand command,
boolean force) LocalesetPlayerLocale(org.bukkit.entity.Player player,
Locale locale) voidunregisterCommand(co.aikar.commands.BaseCommand command) voidunregisterCommand(BukkitRootCommand command)
voidunregisterCommands() booleanusePerIssuerLocale(boolean usePerIssuerLocale,
boolean autoDetectFromClient) addSupportedLanguage, enableUnstableAPI, formatMessage, generateCommandHelp, generateCommandHelp, generateCommandHelp, generateCommandHelp, getCommandConditions, getCommandReplacements, getCurrentCommandIssuer, getCurrentCommandManager, getCurrentCommandOperationContext, getDefaultExceptionHandler, getDefaultFormatter, getDefaultHelpPerPage, getFormat, getRootCommand, getSupportedLanguages, handleUncaughtException, hasPermission, log, notifyLocaleChange, obtainRootCommand, onLocaleChange, registerDependency, registerDependency, sendMessage, sendMessage, setDefaultExceptionHandler, setDefaultFormatter, setDefaultHelpPerPage, setFormat, setFormat, setFormat, usePerIssuerLocale, usingPerIssuerLocale
+addSupportedLanguage, enableUnstableAPI, formatMessage, generateCommandHelp, generateCommandHelp, generateCommandHelp, generateCommandHelp, getCommandConditions, getCommandReplacements, getCurrentCommandIssuer, getCurrentCommandManager, getCurrentCommandOperationContext, getDefaultExceptionHandler, getDefaultFormatter, getDefaultHelpPerPage, getFormat, getIssuerLocale, getRootCommand, getSupportedLanguages, handleUncaughtException, hasPermission, log, notifyLocaleChange, obtainRootCommand, onLocaleChange, registerDependency, registerDependency, sendMessage, sendMessage, setDefaultExceptionHandler, setDefaultFormatter, setDefaultHelpPerPage, setFormat, setFormat, setFormat, setIssuerLocale, usePerIssuerLocale, usingPerIssuerLocale
protected final org.bukkit.plugin.Plugin plugin+
protected final org.bukkit.plugin.Plugin plugin
protected Map<String,org.bukkit.command.Command> knownCommands+
protected Map<String,org.bukkit.command.Command> knownCommands
protected Map<String,BukkitRootCommand> registeredCommands+
protected Map<String,BukkitRootCommand> registeredCommands
protected BukkitCommandContexts contexts+
protected BukkitCommandContexts contexts
protected BukkitCommandCompletions completions+
protected BukkitCommandCompletions completions
protected BukkitLocales locales+
protected BukkitLocales locales
protected boolean autoDetectFromClient-
protected Map<UUID,Locale> issuersLocale+
protected boolean autoDetectFromClient
public BukkitCommandManager(org.bukkit.plugin.Plugin plugin)+
public BukkitCommandManager(org.bukkit.plugin.Plugin plugin)
public org.bukkit.plugin.Plugin getPlugin()+
public org.bukkit.plugin.Plugin getPlugin()
public boolean isCommandIssuer(Class<?> type)+
public boolean isCommandIssuer(Class<?> type)
isCommandIssuer in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>public co.aikar.commands.CommandContexts<BukkitCommandExecutionContext> getCommandContexts()+
public co.aikar.commands.CommandContexts<BukkitCommandExecutionContext> getCommandContexts()
getCommandContexts in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>public co.aikar.commands.CommandCompletions<BukkitCommandCompletionContext> getCommandCompletions()+
public co.aikar.commands.CommandCompletions<BukkitCommandCompletionContext> getCommandCompletions()
getCommandCompletions in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>public BukkitLocales getLocales()+
public BukkitLocales getLocales()
getLocales in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>public boolean hasRegisteredCommands()+
public boolean hasRegisteredCommands()
hasRegisteredCommands in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>public void registerCommand(co.aikar.commands.BaseCommand command, +public void registerCommand(co.aikar.commands.BaseCommand command, boolean force)
public void registerCommand(co.aikar.commands.BaseCommand command)+
public void registerCommand(co.aikar.commands.BaseCommand command)
registerCommand in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>public void unregisterCommand(co.aikar.commands.BaseCommand command)+
public void unregisterCommand(co.aikar.commands.BaseCommand command)
@Deprecated -public void unregisterCommand(BukkitRootCommand command)+public void unregisterCommand(BukkitRootCommand command)
public void unregisterCommands()+
public void unregisterCommands()+
public Locale setPlayerLocale(org.bukkit.entity.Player player, + Locale locale)
public co.aikar.timings.lib.TimingManager getTimings()+
public co.aikar.timings.lib.TimingManager getTimings()
public co.aikar.commands.RootCommand createRootCommand(String cmd)+
public co.aikar.commands.RootCommand createRootCommand(String cmd)
createRootCommand in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>public BukkitCommandIssuer getCommandIssuer(Object issuer)+
public BukkitCommandIssuer getCommandIssuer(Object issuer)
getCommandIssuer in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>public BukkitCommandExecutionContext createCommandContext(co.aikar.commands.RegisteredCommand command, +public BukkitCommandExecutionContext createCommandContext(co.aikar.commands.RegisteredCommand command, Parameter parameter, co.aikar.commands.CommandIssuer sender, List<String> args, @@ -629,7 +622,7 @@ public voidcreateCompletionContext
-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, @@ -646,7 +639,7 @@ public voidcreateRegisteredCommand
-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)@@ -662,7 +655,7 @@ public voidcreateConditionContext
-public BukkitConditionContext createConditionContext(co.aikar.commands.CommandIssuer issuer, +public BukkitConditionContext createConditionContext(co.aikar.commands.CommandIssuer issuer, String config)
- Overrides:
@@ -676,7 +669,7 @@ public voidlog
-public void log(co.aikar.commands.LogLevel level, +public void log(co.aikar.commands.LogLevel level, String message, Throwable throwable)@@ -685,36 +678,13 @@ public void - - -
@@ -287,8 +287,6 @@-
- - - -- -
-setPlayerLocale
-public Locale setPlayerLocale(org.bukkit.entity.Player player, - Locale locale)--
- -
-getIssuerLocale
-public Locale getIssuerLocale(co.aikar.commands.CommandIssuer issuer)--
-- Overrides:
-- -
getIssuerLocalein classco.aikar.commands.CommandManager<org.bukkit.command.CommandSender,BukkitCommandIssuer,org.bukkit.ChatColor,BukkitMessageFormatter,BukkitCommandExecutionContext,BukkitConditionContext>diff --git a/docs/acf-bukkit/index-all.html b/docs/acf-bukkit/index-all.html index acb000a7..f547d7a5 100644 --- a/docs/acf-bukkit/index-all.html +++ b/docs/acf-bukkit/index-all.html @@ -213,8 +213,6 @@
usePerIssuerLocale
-public boolean usePerIssuerLocale(boolean usePerIssuerLocale, +public boolean usePerIssuerLocale(boolean usePerIssuerLocale, boolean autoDetectFromClient)- getIssuer() - Method in class co.aikar.commands.BukkitCommandIssuer
- -
- getIssuerLocale(CommandIssuer) - Method in class co.aikar.commands.BukkitCommandManager
-- getLocales() - Method in class co.aikar.commands.BukkitCommandManager
- getManager() - Method in class co.aikar.commands.BukkitCommandIssuer
@@ -261,6 +259,8 @@- getTimings() - Method in class co.aikar.commands.BukkitCommandManager
- +
- getUniqueId() - Method in class co.aikar.commands.BukkitCommandIssuer
+- getUsage() - Method in class co.aikar.commands.BukkitRootCommand
- isPlayer() - Method in class co.aikar.commands.BukkitCommandIssuer
- -
- issuersLocale - Variable in class co.aikar.commands.BukkitCommandManager
-- isValidName(String) - Static method in class co.aikar.commands.ACFBukkitUtil
- isWithinDistance(Player, Player, int) - Static method in class co.aikar.commands.ACFBukkitUtil
diff --git a/docs/acf-bukkit/src-html/co/aikar/commands/BukkitCommandIssuer.html b/docs/acf-bukkit/src-html/co/aikar/commands/BukkitCommandIssuer.html index 5f873125..f738890a 100644 --- a/docs/acf-bukkit/src-html/co/aikar/commands/BukkitCommandIssuer.html +++ b/docs/acf-bukkit/src-html/co/aikar/commands/BukkitCommandIssuer.html @@ -33,61 +33,74 @@ 025 026import org.bukkit.command.CommandSender; 027import org.bukkit.entity.Player; -028 -029import java.util.Objects; -030 -031public class BukkitCommandIssuer implements CommandIssuer { -032 private final BukkitCommandManager manager; -033 private final CommandSender sender; -034 -035 BukkitCommandIssuer(BukkitCommandManager manager, CommandSender sender) { -036 this.manager = manager; -037 this.sender = sender; -038 } -039 -040 @Override -041 public boolean isPlayer() { -042 return sender instanceof Player; -043 } -044 -045 @Override -046 public CommandSender getIssuer() { -047 //noinspection unchecked -048 return sender; -049 } -050 -051 public Player getPlayer() { -052 return isPlayer() ? (Player) sender : null; -053 } -054 -055 @Override -056 public CommandManager getManager() { -057 return manager; -058 } -059 -060 @Override -061 public void sendMessageInternal(String message) { -062 sender.sendMessage(ACFBukkitUtil.color(message)); -063 } -064 -065 @Override -066 public boolean hasPermission(String name) { -067 return sender.hasPermission(name); -068 } -069 -070 @Override -071 public boolean equals(Object o) { -072 if (this == o) return true; -073 if (o == null || getClass() != o.getClass()) return false; -074 BukkitCommandIssuer that = (BukkitCommandIssuer) o; -075 return Objects.equals(sender, that.sender); +028import org.jetbrains.annotations.NotNull; +029 +030import java.nio.charset.StandardCharsets; +031import java.util.Objects; +032import java.util.UUID; +033 +034public class BukkitCommandIssuer implements CommandIssuer { +035 private final BukkitCommandManager manager; +036 private final CommandSender sender; +037 +038 BukkitCommandIssuer(BukkitCommandManager manager, CommandSender sender) { +039 this.manager = manager; +040 this.sender = sender; +041 } +042 +043 @Override +044 public boolean isPlayer() { +045 return sender instanceof Player; +046 } +047 +048 @Override +049 public CommandSender getIssuer() { +050 //noinspection unchecked +051 return sender; +052 } +053 +054 public Player getPlayer() { +055 return isPlayer() ? (Player) sender : null; +056 } +057 +058 @Override +059 public @NotNull UUID getUniqueId() { +060 if (isPlayer()) { +061 return ((Player) sender).getUniqueId(); +062 } +063 +064 //generate a unique id based of the name (like for the console command sender) +065 return UUID.nameUUIDFromBytes(sender.getName().getBytes(StandardCharsets.UTF_8)); +066 } +067 +068 @Override +069 public CommandManager getManager() { +070 return manager; +071 } +072 +073 @Override +074 public void sendMessageInternal(String message) { +075 sender.sendMessage(ACFBukkitUtil.color(message)); 076 } 077 078 @Override -079 public int hashCode() { -080 return Objects.hash(sender); +079 public boolean hasPermission(String name) { +080 return sender.hasPermission(name); 081 } -082} +082 +083 @Override +084 public boolean equals(Object o) { +085 if (this == o) return true; +086 if (o == null || getClass() != o.getClass()) return false; +087 BukkitCommandIssuer that = (BukkitCommandIssuer) o; +088 return Objects.equals(sender, that.sender); +089 } +090 +091 @Override +092 public int hashCode() { +093 return Objects.hash(sender); +094 } +095} 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 468bbe31..ae181760 100644 --- a/docs/acf-bukkit/src-html/co/aikar/commands/BukkitCommandManager.html +++ b/docs/acf-bukkit/src-html/co/aikar/commands/BukkitCommandManager.html @@ -34,348 +34,331 @@ 026import co.aikar.commands.apachecommonslang.ApacheCommonsExceptionUtil; 027import co.aikar.timings.lib.MCTiming; 028import co.aikar.timings.lib.TimingManager; -029import com.google.common.collect.Maps; -030import org.bukkit.Bukkit; -031import org.bukkit.ChatColor; -032import org.bukkit.Server; -033import org.bukkit.command.Command; -034import org.bukkit.command.CommandMap; -035import org.bukkit.command.CommandSender; -036import org.bukkit.command.SimpleCommandMap; -037import org.bukkit.entity.Player; -038import org.bukkit.inventory.ItemFactory; -039import org.bukkit.plugin.Plugin; -040import org.bukkit.plugin.PluginManager; -041import org.bukkit.plugin.java.JavaPlugin; -042import org.bukkit.scheduler.BukkitScheduler; -043import org.bukkit.scheduler.BukkitTask; -044import org.bukkit.scoreboard.ScoreboardManager; -045import org.jetbrains.annotations.NotNull; -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.UUID; -056import java.util.logging.Level; -057import java.util.logging.Logger; -058 -059@SuppressWarnings("WeakerAccess") -060public class BukkitCommandManager extends CommandManager< -061 CommandSender, -062 BukkitCommandIssuer, -063 ChatColor, -064 BukkitMessageFormatter, -065 BukkitCommandExecutionContext, -066 BukkitConditionContext -067 > { -068 -069 @SuppressWarnings("WeakerAccess") -070 protected final Plugin plugin; -071 private final CommandMap commandMap; -072 private final TimingManager timingManager; -073 private final BukkitTask localeTask; -074 private final Logger logger; -075 protected Map<String, Command> knownCommands = new HashMap<>(); -076 protected Map<String, BukkitRootCommand> registeredCommands = new HashMap<>(); -077 protected BukkitCommandContexts contexts; -078 protected BukkitCommandCompletions completions; -079 MCTiming commandTiming; -080 protected BukkitLocales locales; -081 private boolean cantReadLocale = false; -082 protected boolean autoDetectFromClient = true; -083 protected Map<UUID, Locale> issuersLocale = Maps.newConcurrentMap(); -084 -085 @SuppressWarnings("JavaReflectionMemberAccess") -086 public BukkitCommandManager(Plugin plugin) { -087 this.plugin = plugin; -088 this.logger = Logger.getLogger(this.plugin.getName()); -089 this.timingManager = TimingManager.of(plugin); -090 this.commandTiming = this.timingManager.of("Commands"); -091 this.commandMap = hookCommandMap(); -092 this.formatters.put(MessageType.ERROR, defaultFormatter = new BukkitMessageFormatter(ChatColor.RED, ChatColor.YELLOW, ChatColor.RED)); -093 this.formatters.put(MessageType.SYNTAX, new BukkitMessageFormatter(ChatColor.YELLOW, ChatColor.GREEN, ChatColor.WHITE)); -094 this.formatters.put(MessageType.INFO, new BukkitMessageFormatter(ChatColor.BLUE, ChatColor.DARK_GREEN, ChatColor.GREEN)); -095 this.formatters.put(MessageType.HELP, new BukkitMessageFormatter(ChatColor.AQUA, ChatColor.GREEN, ChatColor.YELLOW)); -096 Bukkit.getPluginManager().registerEvents(new ACFBukkitListener(this, plugin), plugin); -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 } +029import org.bukkit.Bukkit; +030import org.bukkit.ChatColor; +031import org.bukkit.Server; +032import org.bukkit.command.Command; +033import org.bukkit.command.CommandMap; +034import org.bukkit.command.CommandSender; +035import org.bukkit.command.SimpleCommandMap; +036import org.bukkit.entity.Player; +037import org.bukkit.inventory.ItemFactory; +038import org.bukkit.plugin.Plugin; +039import org.bukkit.plugin.PluginManager; +040import org.bukkit.plugin.java.JavaPlugin; +041import org.bukkit.scheduler.BukkitScheduler; +042import org.bukkit.scheduler.BukkitTask; +043import org.bukkit.scoreboard.ScoreboardManager; +044import org.jetbrains.annotations.NotNull; +045 +046import java.lang.reflect.Field; +047import java.lang.reflect.Method; +048import java.lang.reflect.Parameter; +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 if (force && knownCommands.containsKey(commandName)) { -191 Command oldCommand = commandMap.getCommand(commandName); -192 knownCommands.remove(commandName); -193 for (Map.Entry<String, Command> ce : knownCommands.entrySet()) { -194 String key = ce.getKey(); -195 Command value = ce.getValue(); -196 if (key.contains(":") && oldCommand.equals(value)) { -197 String[] split = ACFPatterns.COLON.split(key, 2); -198 if (split.length > 1) { -199 oldCommand.unregister(commandMap); -200 oldCommand.setLabel(split[0] + ":" + command.getName()); -201 oldCommand.register(commandMap); -202 } -203 } -204 } -205 } -206 commandMap.register(commandName, plugin, bukkitCommand); -207 } -208 bukkitCommand.isRegistered = true; -209 registeredCommands.put(commandName, bukkitCommand); -210 } -211 } -212 -213 @Override -214 public void registerCommand(BaseCommand command) { -215 registerCommand(command, false); -216 } -217 -218 public void unregisterCommand(BaseCommand command) { -219 for (RootCommand rootcommand : command.registeredCommands.values()) { -220 BukkitRootCommand bukkitCommand = (BukkitRootCommand) rootcommand; -221 bukkitCommand.getSubCommands().values().removeAll(command.subCommands.values()); -222 if (bukkitCommand.isRegistered && bukkitCommand.getSubCommands().isEmpty()) { -223 unregisterCommand(bukkitCommand); -224 bukkitCommand.isRegistered = false; -225 } -226 } -227 } -228 -229 /** -230 * @deprecated Use unregisterCommand(BaseCommand) - this will be visibility reduced later. -231 * @param command -232 */ -233 @Deprecated -234 public void unregisterCommand(BukkitRootCommand command) { -235 final String plugin = this.plugin.getName().toLowerCase(); -236 command.unregister(commandMap); -237 String key = command.getName(); -238 Command registered = knownCommands.get(key); -239 if (command.equals(registered)) { -240 knownCommands.remove(key); -241 } -242 knownCommands.remove(plugin + ":" + key); -243 } -244 -245 public void unregisterCommands() { -246 for (Map.Entry<String, BukkitRootCommand> entry : registeredCommands.entrySet()) { -247 unregisterCommand(entry.getValue()); -248 } -249 this.registeredCommands.clear(); -250 } +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 if (force && knownCommands.containsKey(commandName)) { +190 Command oldCommand = commandMap.getCommand(commandName); +191 knownCommands.remove(commandName); +192 for (Map.Entry<String, Command> ce : knownCommands.entrySet()) { +193 String key = ce.getKey(); +194 Command value = ce.getValue(); +195 if (key.contains(":") && oldCommand.equals(value)) { +196 String[] split = ACFPatterns.COLON.split(key, 2); +197 if (split.length > 1) { +198 oldCommand.unregister(commandMap); +199 oldCommand.setLabel(split[0] + ":" + command.getName()); +200 oldCommand.register(commandMap); +201 } +202 } +203 } +204 } +205 commandMap.register(commandName, plugin, bukkitCommand); +206 } +207 bukkitCommand.isRegistered = true; +208 registeredCommands.put(commandName, bukkitCommand); +209 } +210 } +211 +212 @Override +213 public void registerCommand(BaseCommand command) { +214 registerCommand(command, false); +215 } +216 +217 public void unregisterCommand(BaseCommand command) { +218 for (RootCommand rootcommand : command.registeredCommands.values()) { +219 BukkitRootCommand bukkitCommand = (BukkitRootCommand) rootcommand; +220 bukkitCommand.getSubCommands().values().removeAll(command.subCommands.values()); +221 if (bukkitCommand.isRegistered && bukkitCommand.getSubCommands().isEmpty()) { +222 unregisterCommand(bukkitCommand); +223 bukkitCommand.isRegistered = false; +224 } +225 } +226 } +227 +228 /** +229 * @deprecated Use unregisterCommand(BaseCommand) - this will be visibility reduced later. +230 * @param command +231 */ +232 @Deprecated +233 public void unregisterCommand(BukkitRootCommand command) { +234 final String plugin = this.plugin.getName().toLowerCase(); +235 command.unregister(commandMap); +236 String key = command.getName(); +237 Command registered = knownCommands.get(key); +238 if (command.equals(registered)) { +239 knownCommands.remove(key); +240 } +241 knownCommands.remove(plugin + ":" + key); +242 } +243 +244 public void unregisterCommands() { +245 for (Map.Entry<String, BukkitRootCommand> entry : registeredCommands.entrySet()) { +246 unregisterCommand(entry.getValue()); +247 } +248 this.registeredCommands.clear(); +249 } +250 251 -252 -253 private Field getEntityField(Player player) throws NoSuchFieldException { -254 Class cls = player.getClass(); -255 while (cls != Object.class) { -256 if (cls.getName().endsWith("CraftEntity")) { -257 Field field = cls.getDeclaredField("entity"); -258 field.setAccessible(true); -259 return field; -260 } -261 cls = cls.getSuperclass(); -262 } -263 return null; -264 } -265 -266 void readPlayerLocale(Player player) { -267 if (!player.isOnline() || cantReadLocale) { -268 return; -269 } -270 try { -271 Field entityField = getEntityField(player); -272 if (entityField == null) { -273 return; -274 } -275 Object nmsPlayer = entityField.get(player); -276 if (nmsPlayer != null) { -277 Field localeField = nmsPlayer.getClass().getField("locale"); -278 Object localeString = localeField.get(nmsPlayer); -279 if (localeString instanceof String) { -280 String[] split = ACFPatterns.UNDERSCORE.split((String) localeString); -281 Locale locale = split.length > 1 ? new Locale(split[0], split[1]) : new Locale(split[0]); -282 Locale prev = issuersLocale.put(player.getUniqueId(), locale); -283 if (!Objects.equals(locale, prev)) { -284 this.notifyLocaleChange(getCommandIssuer(player), prev, locale); -285 } -286 } -287 } -288 } catch (Exception e) { -289 cantReadLocale = true; -290 this.localeTask.cancel(); -291 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); -292 } -293 } -294 -295 public TimingManager getTimings() { -296 return timingManager; -297 } -298 -299 @Override -300 public RootCommand createRootCommand(String cmd) { -301 return new BukkitRootCommand(this, cmd); -302 } -303 -304 @Override -305 public BukkitCommandIssuer getCommandIssuer(Object issuer) { -306 if (!(issuer instanceof CommandSender)) { -307 throw new IllegalArgumentException(issuer.getClass().getName() + " is not a Command Issuer."); -308 } -309 return new BukkitCommandIssuer(this, (CommandSender) issuer); -310 } -311 -312 @Override -313 public BukkitCommandExecutionContext createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs) { -314 return new BukkitCommandExecutionContext(command, parameter, (BukkitCommandIssuer) sender, args, i, passedArgs); -315 } -316 -317 @Override -318 public BukkitCommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args) { -319 return new BukkitCommandCompletionContext(command, (BukkitCommandIssuer) sender, input, config, args); -320 } -321 -322 @Override -323 public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) { -324 return new BukkitRegisteredCommand(command, cmdName, method, prefSubCommand); -325 } -326 -327 @Override -328 public BukkitConditionContext createConditionContext(CommandIssuer issuer, String config) { -329 return new BukkitConditionContext((BukkitCommandIssuer) issuer, config); -330 } -331 -332 -333 @Override -334 public void log(LogLevel level, String message, Throwable throwable) { -335 Level logLevel = level == LogLevel.INFO ? Level.INFO : Level.SEVERE; -336 logger.log(logLevel, LogLevel.LOG_PREFIX + message); -337 if (throwable != null) { -338 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) { -339 logger.log(logLevel, LogLevel.LOG_PREFIX + line); -340 } -341 } -342 } -343 -344 public Locale setPlayerLocale(Player player, Locale locale) { -345 Locale old = this.issuersLocale.put(player.getUniqueId(), locale); -346 if (!Objects.equals(old, locale)) { -347 this.notifyLocaleChange(getCommandIssuer(player), old, locale); -348 } -349 return old; -350 } -351 -352 @Override -353 public Locale getIssuerLocale(CommandIssuer issuer) { -354 if (usingPerIssuerLocale() && issuer.getIssuer() instanceof Player) { -355 UUID uniqueId = ((Player) issuer.getIssuer()).getUniqueId(); -356 Locale locale = issuersLocale.get(uniqueId); -357 if (locale != null) { -358 return locale; -359 } -360 } -361 return super.getIssuerLocale(issuer); -362 } -363 -364 public boolean usePerIssuerLocale(boolean usePerIssuerLocale, boolean autoDetectFromClient) { -365 boolean old = this.usePerIssuerLocale; -366 this.usePerIssuerLocale = usePerIssuerLocale; -367 this.autoDetectFromClient = autoDetectFromClient; -368 return old; -369 } -370} +252 private Field getEntityField(Player player) throws NoSuchFieldException { +253 Class cls = player.getClass(); +254 while (cls != Object.class) { +255 if (cls.getName().endsWith("CraftEntity")) { +256 Field field = cls.getDeclaredField("entity"); +257 field.setAccessible(true); +258 return field; +259 } +260 cls = cls.getSuperclass(); +261 } +262 return null; +263 } +264 +265 public Locale setPlayerLocale(Player player, Locale locale) { +266 return this.setIssuerLocale(player, locale); +267 } +268 +269 void readPlayerLocale(Player player) { +270 if (!player.isOnline() || cantReadLocale) { +271 return; +272 } +273 try { +274 Field entityField = getEntityField(player); +275 if (entityField == null) { +276 return; +277 } +278 Object nmsPlayer = entityField.get(player); +279 if (nmsPlayer != null) { +280 Field localeField = nmsPlayer.getClass().getField("locale"); +281 Object localeString = localeField.get(nmsPlayer); +282 if (localeString instanceof String) { +283 String[] split = ACFPatterns.UNDERSCORE.split((String) localeString); +284 Locale locale = split.length > 1 ? new Locale(split[0], split[1]) : new Locale(split[0]); +285 Locale prev = issuersLocale.put(player.getUniqueId(), locale); +286 if (!Objects.equals(locale, prev)) { +287 this.notifyLocaleChange(getCommandIssuer(player), prev, locale); +288 } +289 } +290 } +291 } catch (Exception e) { +292 cantReadLocale = true; +293 this.localeTask.cancel(); +294 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); +295 } +296 } +297 +298 public TimingManager getTimings() { +299 return timingManager; +300 } +301 +302 @Override +303 public RootCommand createRootCommand(String cmd) { +304 return new BukkitRootCommand(this, cmd); +305 } +306 +307 @Override +308 public BukkitCommandIssuer getCommandIssuer(Object issuer) { +309 if (!(issuer instanceof CommandSender)) { +310 throw new IllegalArgumentException(issuer.getClass().getName() + " is not a Command Issuer."); +311 } +312 return new BukkitCommandIssuer(this, (CommandSender) issuer); +313 } +314 +315 @Override +316 public BukkitCommandExecutionContext createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs) { +317 return new BukkitCommandExecutionContext(command, parameter, (BukkitCommandIssuer) sender, args, i, passedArgs); +318 } +319 +320 @Override +321 public BukkitCommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args) { +322 return new BukkitCommandCompletionContext(command, (BukkitCommandIssuer) sender, input, config, args); +323 } +324 +325 @Override +326 public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) { +327 return new BukkitRegisteredCommand(command, cmdName, method, prefSubCommand); +328 } +329 +330 @Override +331 public BukkitConditionContext createConditionContext(CommandIssuer issuer, String config) { +332 return new BukkitConditionContext((BukkitCommandIssuer) issuer, config); +333 } +334 +335 +336 @Override +337 public void log(LogLevel level, String message, Throwable throwable) { +338 Level logLevel = level == LogLevel.INFO ? Level.INFO : Level.SEVERE; +339 logger.log(logLevel, LogLevel.LOG_PREFIX + message); +340 if (throwable != null) { +341 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) { +342 logger.log(logLevel, LogLevel.LOG_PREFIX + line); +343 } +344 } +345 } +346 +347 public boolean usePerIssuerLocale(boolean usePerIssuerLocale, boolean autoDetectFromClient) { +348 boolean old = this.usePerIssuerLocale; +349 this.usePerIssuerLocale = usePerIssuerLocale; +350 this.autoDetectFromClient = autoDetectFromClient; +351 return old; +352 } +353} diff --git a/docs/acf-bungee/allclasses-frame.html b/docs/acf-bungee/allclasses-frame.html index 21ca77a0..9a5237dd 100644 --- a/docs/acf-bungee/allclasses-frame.html +++ b/docs/acf-bungee/allclasses-frame.html @@ -12,6 +12,7 @@All Classes
+
- ACFBungeeListener
- ACFBungeeUtil
- BungeeCommandCompletionContext
- BungeeCommandCompletions
diff --git a/docs/acf-bungee/allclasses-noframe.html b/docs/acf-bungee/allclasses-noframe.html index f080e03f..dafb2984 100644 --- a/docs/acf-bungee/allclasses-noframe.html +++ b/docs/acf-bungee/allclasses-noframe.html @@ -12,6 +12,7 @@All Classes
+
- ACFBungeeListener
- ACFBungeeUtil
- BungeeCommandCompletionContext
- BungeeCommandCompletions
diff --git a/docs/acf-bungee/co/aikar/commands/ACFBungeeListener.html b/docs/acf-bungee/co/aikar/commands/ACFBungeeListener.html new file mode 100644 index 00000000..ea82fdd2 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/ACFBungeeListener.html @@ -0,0 +1,290 @@ + + + + + + +ACFBungeeListener (ACF (Bungee) 0.5.0-SNAPSHOT API) + + + + + + + + ++ + + ++ + ++ ++ + + +++co.aikar.commands+Class ACFBungeeListener
+++ + + ++
+- java.lang.Object
+- +
++
+- co.aikar.commands.ACFBungeeListener
++++
+- +
++
+- All Implemented Interfaces:
+- net.md_5.bungee.api.plugin.Listener
+
+
+public class ACFBungeeListener +extends Object +implements net.md_5.bungee.api.plugin.Listener++++
+- + +
++
+ +- + + +
+Constructor Summary
++
+Constructors ++ +Constructor and Description ++ ++ ACFBungeeListener(BungeeCommandManager manager, + net.md_5.bungee.api.plugin.Plugin plugin)+
+- + + +
+Method Summary
++
+ +All Methods Instance Methods Concrete Methods ++ +Modifier and Type +Method and Description ++ ++ void+ onDisconnect(net.md_5.bungee.api.event.PlayerDisconnectEvent disconnectEvent)+ ++ void+ onPlayerJoin(net.md_5.bungee.api.event.PostLoginEvent loginEvent)+++
+- + +
++
+ +- + + +
+Constructor Detail
+ + + ++
+- +
+ACFBungeeListener
+public ACFBungeeListener(BungeeCommandManager manager, + net.md_5.bungee.api.plugin.Plugin plugin)++
+- + + +
+Method Detail
+ + + ++
+ + + +- +
+onPlayerJoin
+public void onPlayerJoin(net.md_5.bungee.api.event.PostLoginEvent loginEvent)++
+- +
+onDisconnect
+public void onDisconnect(net.md_5.bungee.api.event.PlayerDisconnectEvent disconnectEvent)++ + + ++ ++ ++ + + +Copyright © 2018. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/ACFBungeeUtil.html b/docs/acf-bungee/co/aikar/commands/ACFBungeeUtil.html index 182abda0..3fbb5e53 100644 --- a/docs/acf-bungee/co/aikar/commands/ACFBungeeUtil.html +++ b/docs/acf-bungee/co/aikar/commands/ACFBungeeUtil.html @@ -48,7 +48,7 @@ var activeTableTab = "activeTableTab";
@NotNull UUIDgetUniqueId() inthashCode() booleanhasPermission(String name) booleanisPlayer() voidsendMessageInternal(String message) public net.md_5.bungee.api.CommandSender getIssuer()+
public net.md_5.bungee.api.CommandSender getIssuer()
getIssuer in interface co.aikar.commands.CommandIssuerpublic net.md_5.bungee.api.connection.ProxiedPlayer getPlayer()+
public net.md_5.bungee.api.connection.ProxiedPlayer getPlayer()
public co.aikar.commands.CommandManager getManager()+
public co.aikar.commands.CommandManager getManager()
getManager in interface co.aikar.commands.CommandIssuerpublic boolean isPlayer()+
public boolean isPlayer()
isPlayer in interface co.aikar.commands.CommandIssuer@NotNull +public @NotNull UUID getUniqueId()+
getUniqueId in interface co.aikar.commands.CommandIssuerpublic void sendMessageInternal(String message)+
public void sendMessageInternal(String message)
sendMessageInternal in interface co.aikar.commands.CommandIssuerpublic boolean hasPermission(String name)+
public boolean hasPermission(String name)
hasPermission in interface co.aikar.commands.CommandIssuerpublic boolean equals(Object o)+
public boolean equals(Object o)
equals in class Objectpublic int hashCode()+
public int hashCode()
hashCode in class Objectpublic 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>
conditions, defaultExceptionHandler, defaultFormatter, defaultHelpPerPage, dependencies, formatters, localeChangedCallbacks, replacements, rootCommands, supportedLanguages, usePerIssuerLocaleconditions, defaultExceptionHandler, defaultFormatter, defaultHelpPerPage, dependencies, formatters, issuersLocale, localeChangedCallbacks, replacements, rootCommands, supportedLanguages, usePerIssuerLocalevoidregisterCommand(co.aikar.commands.BaseCommand command) readLocale(net.md_5.bungee.api.connection.ProxiedPlayer player) voidunregisterCommand(co.aikar.commands.BaseCommand command) registerCommand(co.aikar.commands.BaseCommand command) voidunregisterCommand(BungeeRootCommand command) unregisterCommand(co.aikar.commands.BaseCommand command) voidunregisterCommand(BungeeRootCommand command) voidunregisterCommands() addSupportedLanguage, enableUnstableAPI, formatMessage, generateCommandHelp, generateCommandHelp, generateCommandHelp, generateCommandHelp, getCommandConditions, getCommandReplacements, getCurrentCommandIssuer, getCurrentCommandManager, getCurrentCommandOperationContext, getDefaultExceptionHandler, getDefaultFormatter, getDefaultHelpPerPage, getFormat, getIssuerLocale, getRootCommand, getSupportedLanguages, handleUncaughtException, hasPermission, log, notifyLocaleChange, obtainRootCommand, onLocaleChange, registerDependency, registerDependency, sendMessage, sendMessage, setDefaultExceptionHandler, setDefaultFormatter, setDefaultHelpPerPage, setFormat, setFormat, setFormat, usePerIssuerLocale, usingPerIssuerLocaleaddSupportedLanguage, enableUnstableAPI, formatMessage, generateCommandHelp, generateCommandHelp, generateCommandHelp, generateCommandHelp, getCommandConditions, getCommandReplacements, getCurrentCommandIssuer, getCurrentCommandManager, getCurrentCommandOperationContext, getDefaultExceptionHandler, getDefaultFormatter, getDefaultHelpPerPage, getFormat, getIssuerLocale, getRootCommand, getSupportedLanguages, handleUncaughtException, hasPermission, log, notifyLocaleChange, obtainRootCommand, onLocaleChange, registerDependency, registerDependency, sendMessage, sendMessage, setDefaultExceptionHandler, setDefaultFormatter, setDefaultHelpPerPage, setFormat, setFormat, setFormat, setIssuerLocale, usePerIssuerLocale, usingPerIssuerLocaleprotected Map<String,BungeeRootCommand> registeredCommands+
protected Map<String,BungeeRootCommand> registeredCommands
protected BungeeCommandContexts contexts+
protected BungeeCommandContexts contexts
protected BungeeCommandCompletions completions+
protected BungeeCommandCompletions completions
protected BungeeLocales locales+
protected BungeeLocales locales
public BungeeCommandManager(net.md_5.bungee.api.plugin.Plugin plugin)+
public BungeeCommandManager(net.md_5.bungee.api.plugin.Plugin plugin)
public net.md_5.bungee.api.plugin.Plugin getPlugin()+
public net.md_5.bungee.api.plugin.Plugin getPlugin()
public co.aikar.commands.CommandContexts<BungeeCommandExecutionContext> getCommandContexts()+
public co.aikar.commands.CommandContexts<BungeeCommandExecutionContext> getCommandContexts()
getCommandContexts in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>public co.aikar.commands.CommandCompletions<BungeeCommandCompletionContext> getCommandCompletions()+
public co.aikar.commands.CommandCompletions<BungeeCommandCompletionContext> getCommandCompletions()
getCommandCompletions in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>public BungeeLocales getLocales()+
public BungeeLocales getLocales()
getLocales in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>public void readLocale(net.md_5.bungee.api.connection.ProxiedPlayer player)+
public void registerCommand(co.aikar.commands.BaseCommand command)+
public void registerCommand(co.aikar.commands.BaseCommand command)
registerCommand in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>public void unregisterCommand(co.aikar.commands.BaseCommand command)+
public void unregisterCommand(co.aikar.commands.BaseCommand command)
public void unregisterCommand(BungeeRootCommand command)+
public void unregisterCommand(BungeeRootCommand command)
public void unregisterCommands()+
public void unregisterCommands()
public boolean hasRegisteredCommands()+
public boolean hasRegisteredCommands()
hasRegisteredCommands in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>public boolean isCommandIssuer(Class<?> aClass)+
public boolean isCommandIssuer(Class<?> aClass)
isCommandIssuer in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>public BungeeCommandIssuer getCommandIssuer(Object issuer)+
public BungeeCommandIssuer getCommandIssuer(Object issuer)
getCommandIssuer in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>public co.aikar.commands.RootCommand createRootCommand(String cmd)+
public co.aikar.commands.RootCommand createRootCommand(String cmd)
createRootCommand in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,BungeeCommandIssuer,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter,BungeeCommandExecutionContext,BungeeConditionContext>public BungeeCommandExecutionContext createCommandContext(co.aikar.commands.RegisteredCommand command, +public BungeeCommandExecutionContext createCommandContext(co.aikar.commands.RegisteredCommand command, Parameter parameter, co.aikar.commands.CommandIssuer sender, List<String> args, @@ -538,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, @@ -555,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)@@ -571,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:
@@ -585,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/ACFBungeeListener.html b/docs/acf-bungee/co/aikar/commands/class-use/ACFBungeeListener.html new file mode 100644 index 00000000..9c4e4bc6 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/class-use/ACFBungeeListener.html @@ -0,0 +1,123 @@ + + + + + + +
Uses of Class co.aikar.commands.ACFBungeeListener (ACF (Bungee) 0.5.0-SNAPSHOT API) + + + + + + + + ++ + + ++ ++ ++ + +++Uses of Class
+
co.aikar.commands.ACFBungeeListenerNo usage of co.aikar.commands.ACFBungeeListener+ + ++ + + ++ ++ ++ + +Copyright © 2018. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandManager.html b/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandManager.html index c564f63a..fcaf0d4a 100644 --- a/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandManager.html +++ b/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandManager.html @@ -101,6 +101,10 @@+ ++ ACFBungeeListener(BungeeCommandManager manager, + net.md_5.bungee.api.plugin.Plugin plugin)diff --git a/docs/acf-bungee/co/aikar/commands/package-frame.html b/docs/acf-bungee/co/aikar/commands/package-frame.html index 46ca97cd..bebc8f18 100644 --- a/docs/acf-bungee/co/aikar/commands/package-frame.html +++ b/docs/acf-bungee/co/aikar/commands/package-frame.html @@ -13,6 +13,7 @@ BungeeLocales(BungeeCommandManager manager)Classes
+
diff --git a/docs/acf-core/co/aikar/commands/class-use/CommandOperationContext.html b/docs/acf-core/co/aikar/commands/class-use/CommandOperationContext.html index fa9bd8b9..fc5cd9b7 100644 --- a/docs/acf-core/co/aikar/commands/class-use/CommandOperationContext.html +++ b/docs/acf-core/co/aikar/commands/class-use/CommandOperationContext.html @@ -85,6 +85,10 @@- ACFBungeeListener
- ACFBungeeUtil
- BungeeCommandCompletionContext
- BungeeCommandCompletions
diff --git a/docs/acf-bungee/co/aikar/commands/package-summary.html b/docs/acf-bungee/co/aikar/commands/package-summary.html index eecfcf9c..adde73ef 100644 --- a/docs/acf-bungee/co/aikar/commands/package-summary.html +++ b/docs/acf-bungee/co/aikar/commands/package-summary.html @@ -82,50 +82,54 @@+ +ACFBungeeListener ++ - ACFBungeeUtil + - BungeeCommandCompletionContext + - BungeeCommandCompletions + - BungeeCommandContexts + - BungeeCommandExecutionContext + - BungeeCommandIssuer + - BungeeCommandManager + - BungeeConditionContext + - BungeeLocales + - BungeeMessageFormatter + - BungeeRegisteredCommand + diff --git a/docs/acf-bungee/co/aikar/commands/package-tree.html b/docs/acf-bungee/co/aikar/commands/package-tree.html index 402ae684..1722fc68 100644 --- a/docs/acf-bungee/co/aikar/commands/package-tree.html +++ b/docs/acf-bungee/co/aikar/commands/package-tree.html @@ -80,6 +80,7 @@ BungeeRootCommand @@ -149,6 +153,28 @@ +
- java.lang.Object
+
- co.aikar.commands.ACFBungeeListener (implements net.md_5.bungee.api.plugin.Listener)
- co.aikar.commands.ACFBungeeUtil
- co.aikar.commands.BungeeCommandIssuer (implements co.aikar.commands.CommandIssuer)
- net.md_5.bungee.api.plugin.Command diff --git a/docs/acf-bungee/index-all.html b/docs/acf-bungee/index-all.html index a1d0456a..ded8a430 100644 --- a/docs/acf-bungee/index-all.html +++ b/docs/acf-bungee/index-all.html @@ -73,6 +73,10 @@
A
+
@@ -271,10 +277,14 @@- ACFBungeeListener - Class in co.aikar.commands
+- +
- ACFBungeeListener(BungeeCommandManager, Plugin) - Constructor for class co.aikar.commands.ACFBungeeListener
+- ACFBungeeUtil - Class in co.aikar.commands
- ACFBungeeUtil() - Constructor for class co.aikar.commands.ACFBungeeUtil
@@ -217,6 +221,8 @@- getSubCommands() - Method in class co.aikar.commands.BungeeRootCommand
- +
- getUniqueId() - Method in class co.aikar.commands.BungeeCommandIssuer
+O
+
@@ -297,6 +307,8 @@- onDisconnect(PlayerDisconnectEvent) - Method in class co.aikar.commands.ACFBungeeListener
+- OnlineProxiedPlayer - Class in co.aikar.commands.contexts
- OnlineProxiedPlayer(ProxiedPlayer) - Constructor for class co.aikar.commands.contexts.OnlineProxiedPlayer
- +
- onPlayerJoin(PostLoginEvent) - Method in class co.aikar.commands.ACFBungeeListener
+- onTabComplete(CommandSender, String[]) - Method in class co.aikar.commands.BungeeRootCommand
R
+
- readLocale(ProxiedPlayer) - Method in class co.aikar.commands.BungeeCommandManager
+- registerCommand(BaseCommand) - Method in class co.aikar.commands.BungeeCommandManager
- registeredCommands - Variable in class co.aikar.commands.BungeeCommandManager
diff --git a/docs/acf-bungee/overview-tree.html b/docs/acf-bungee/overview-tree.html index c5b77895..713f4c27 100644 --- a/docs/acf-bungee/overview-tree.html +++ b/docs/acf-bungee/overview-tree.html @@ -81,6 +81,7 @@
- java.lang.Object
+
- co.aikar.commands.ACFBungeeListener (implements net.md_5.bungee.api.plugin.Listener)
- co.aikar.commands.ACFBungeeUtil
- co.aikar.commands.BungeeCommandIssuer (implements co.aikar.commands.CommandIssuer)
- net.md_5.bungee.api.plugin.Command diff --git a/docs/acf-bungee/src-html/co/aikar/commands/ACFBungeeListener.html b/docs/acf-bungee/src-html/co/aikar/commands/ACFBungeeListener.html new file mode 100644 index 00000000..abfb4276 --- /dev/null +++ b/docs/acf-bungee/src-html/co/aikar/commands/ACFBungeeListener.html @@ -0,0 +1,109 @@ + + + +
Source code + + + +++ + diff --git a/docs/acf-bungee/src-html/co/aikar/commands/BungeeCommandIssuer.html b/docs/acf-bungee/src-html/co/aikar/commands/BungeeCommandIssuer.html index 1d1d8d86..968bed8a 100644 --- a/docs/acf-bungee/src-html/co/aikar/commands/BungeeCommandIssuer.html +++ b/docs/acf-bungee/src-html/co/aikar/commands/BungeeCommandIssuer.html @@ -33,62 +33,75 @@ 025 026import net.md_5.bungee.api.CommandSender; 027import net.md_5.bungee.api.connection.ProxiedPlayer; -028 -029import java.util.Objects; -030 -031public class BungeeCommandIssuer implements CommandIssuer { -032 private final BungeeCommandManager manager; -033 private final CommandSender sender; -034 -035 BungeeCommandIssuer(BungeeCommandManager manager, CommandSender sender) { -036 this.manager = manager; -037 this.sender = sender; -038 } -039 -040 -041 @Override -042 public CommandSender getIssuer() { -043 return sender; -044 } -045 -046 public ProxiedPlayer getPlayer() { -047 return isPlayer() ? (ProxiedPlayer) sender : null; -048 } -049 -050 @Override -051 public CommandManager getManager() { -052 return manager; -053 } -054 -055 @Override -056 public boolean isPlayer() { -057 return sender instanceof ProxiedPlayer; -058 } -059 -060 @Override -061 public void sendMessageInternal(String message) { -062 sender.sendMessage(ACFBungeeUtil.color(message)); -063 } -064 -065 @Override -066 public boolean hasPermission(String name) { -067 return sender.hasPermission(name); -068 } -069 -070 -071 @Override -072 public boolean equals(Object o) { -073 if (this == o) return true; -074 if (o == null || getClass() != o.getClass()) return false; -075 BungeeCommandIssuer that = (BungeeCommandIssuer) o; -076 return Objects.equals(sender, that.sender); -077 } -078 -079 @Override -080 public int hashCode() { -081 return Objects.hash(sender); -082 } -083} +028import org.jetbrains.annotations.NotNull; +029 +030import java.nio.charset.StandardCharsets; +031import java.util.Objects; +032import java.util.UUID; +033 +034public class BungeeCommandIssuer implements CommandIssuer { +035 private final BungeeCommandManager manager; +036 private final CommandSender sender; +037 +038 BungeeCommandIssuer(BungeeCommandManager manager, CommandSender sender) { +039 this.manager = manager; +040 this.sender = sender; +041 } +042 +043 +044 @Override +045 public CommandSender getIssuer() { +046 return sender; +047 } +048 +049 public ProxiedPlayer getPlayer() { +050 return isPlayer() ? (ProxiedPlayer) sender : null; +051 } +052 +053 @Override +054 public CommandManager getManager() { +055 return manager; +056 } +057 +058 @Override +059 public boolean isPlayer() { +060 return sender instanceof ProxiedPlayer; +061 } +062 +063 @Override +064 public @NotNull UUID getUniqueId() { +065 if (isPlayer()) { +066 return ((ProxiedPlayer) sender).getUniqueId(); +067 } +068 +069 //generate a unique id based of the name (like for the console command sender) +070 return UUID.nameUUIDFromBytes(sender.getName().getBytes(StandardCharsets.UTF_8)); +071 } +072 +073 @Override +074 public void sendMessageInternal(String message) { +075 sender.sendMessage(ACFBungeeUtil.color(message)); +076 } +077 +078 @Override +079 public boolean hasPermission(String name) { +080 return sender.hasPermission(name); +081 } +082 +083 +084 @Override +085 public boolean equals(Object o) { +086 if (this == o) return true; +087 if (o == null || getClass() != o.getClass()) return false; +088 BungeeCommandIssuer that = (BungeeCommandIssuer) o; +089 return Objects.equals(sender, that.sender); +090 } +091 +092 @Override +093 public int hashCode() { +094 return Objects.hash(sender); +095 } +096} 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 2566df06..185bc19a 100644 --- a/docs/acf-bungee/src-html/co/aikar/commands/BungeeCommandManager.html +++ b/docs/acf-bungee/src-html/co/aikar/commands/BungeeCommandManager.html @@ -34,166 +34,189 @@ 026import co.aikar.commands.apachecommonslang.ApacheCommonsExceptionUtil; 027import net.md_5.bungee.api.ChatColor; 028import net.md_5.bungee.api.CommandSender; -029import net.md_5.bungee.api.plugin.Plugin; -030 -031import java.lang.reflect.Method; -032import java.lang.reflect.Parameter; -033import java.util.HashMap; -034import java.util.List; -035import java.util.Map; -036import java.util.logging.Level; -037import java.util.logging.Logger; -038 -039public class BungeeCommandManager extends CommandManager< -040 CommandSender, -041 BungeeCommandIssuer, -042 ChatColor, -043 BungeeMessageFormatter, -044 BungeeCommandExecutionContext, -045 BungeeConditionContext -046 > { -047 -048 protected final Plugin plugin; -049 protected Map<String, BungeeRootCommand> registeredCommands = new HashMap<>(); -050 protected BungeeCommandContexts contexts; -051 protected BungeeCommandCompletions completions; -052 protected BungeeLocales locales; -053 -054 public BungeeCommandManager(Plugin plugin) { -055 this.plugin = plugin; -056 this.formatters.put(MessageType.ERROR, defaultFormatter = new BungeeMessageFormatter(ChatColor.RED, ChatColor.YELLOW, ChatColor.RED)); -057 this.formatters.put(MessageType.SYNTAX, new BungeeMessageFormatter(ChatColor.YELLOW, ChatColor.GREEN, ChatColor.WHITE)); -058 this.formatters.put(MessageType.INFO, new BungeeMessageFormatter(ChatColor.BLUE, ChatColor.DARK_GREEN, ChatColor.GREEN)); -059 this.formatters.put(MessageType.HELP, new BungeeMessageFormatter(ChatColor.AQUA, ChatColor.GREEN, ChatColor.YELLOW)); -060 getLocales(); // auto load locales -061 -062 // TODO more default dependencies for bungee -063 registerDependency(plugin.getClass(), plugin); -064 registerDependency(Plugin.class, plugin); -065 } +029import net.md_5.bungee.api.ProxyServer; +030import net.md_5.bungee.api.connection.ProxiedPlayer; +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 public Plugin getPlugin() { -068 return this.plugin; -069 } -070 -071 @Override -072 public synchronized CommandContexts<BungeeCommandExecutionContext> getCommandContexts() { -073 if (this.contexts == null) { -074 this.contexts = new BungeeCommandContexts(this); -075 } -076 return contexts; +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 @Override -080 public synchronized CommandCompletions<BungeeCommandCompletionContext> getCommandCompletions() { -081 if (this.completions == null) { -082 this.completions = new BungeeCommandCompletions(this); -083 } -084 return completions; -085 } -086 -087 @Override -088 public BungeeLocales getLocales() { -089 if (this.locales == null) { -090 this.locales = new BungeeLocales(this); -091 this.locales.loadLanguages(); -092 } -093 return locales; -094 } -095 -096 -097 @Override -098 public void registerCommand(BaseCommand command) { -099 command.onRegister(this); -100 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) { -101 String commandName = entry.getKey().toLowerCase(); -102 BungeeRootCommand bungeeCommand = (BungeeRootCommand) entry.getValue(); -103 if (!bungeeCommand.isRegistered) { -104 this.plugin.getProxy().getPluginManager().registerCommand(this.plugin, bungeeCommand); -105 } -106 bungeeCommand.isRegistered = true; -107 registeredCommands.put(commandName, bungeeCommand); -108 } -109 } -110 -111 public void unregisterCommand(BaseCommand command) { -112 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) { -113 String commandName = entry.getKey().toLowerCase(); -114 BungeeRootCommand bungeeCommand = (BungeeRootCommand) entry.getValue(); -115 bungeeCommand.getSubCommands().values().removeAll(command.subCommands.values()); -116 if (bungeeCommand.getSubCommands().isEmpty() && bungeeCommand.isRegistered) { -117 unregisterCommand(bungeeCommand); -118 bungeeCommand.isRegistered = false; -119 registeredCommands.remove(commandName); -120 } -121 } -122 } -123 -124 public void unregisterCommand(BungeeRootCommand command) { -125 this.plugin.getProxy().getPluginManager().unregisterCommand(command); -126 } -127 -128 public void unregisterCommands() { -129 for (Map.Entry<String, BungeeRootCommand> entry : registeredCommands.entrySet()) { -130 unregisterCommand(entry.getValue()); +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 @Override -135 public boolean hasRegisteredCommands() { -136 return !registeredCommands.isEmpty(); -137 } -138 -139 @Override -140 public boolean isCommandIssuer(Class<?> aClass) { -141 return CommandSender.class.isAssignableFrom(aClass); -142 } -143 -144 @Override -145 public BungeeCommandIssuer getCommandIssuer(Object issuer) { -146 if (!(issuer instanceof CommandSender)) { -147 throw new IllegalArgumentException(issuer.getClass().getName() + " is not a Command Issuer."); -148 } -149 return new BungeeCommandIssuer(this, (CommandSender) issuer); -150 } -151 -152 @Override -153 public RootCommand createRootCommand(String cmd) { -154 return new BungeeRootCommand(this, cmd); +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 BungeeCommandExecutionContext createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs) { -159 return new BungeeCommandExecutionContext(command, parameter, (BungeeCommandIssuer) sender, args, i, passedArgs); +158 public boolean hasRegisteredCommands() { +159 return !registeredCommands.isEmpty(); 160 } 161 162 @Override -163 public CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args) { -164 return new BungeeCommandCompletionContext(command, (BungeeCommandIssuer) sender, input, config, args); +163 public boolean isCommandIssuer(Class<?> aClass) { +164 return CommandSender.class.isAssignableFrom(aClass); 165 } 166 167 @Override -168 public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) { -169 return new RegisteredCommand(command, cmdName, method, prefSubCommand); -170 } -171 -172 @Override -173 public BungeeConditionContext createConditionContext(CommandIssuer issuer, String config) { -174 return new BungeeConditionContext((BungeeCommandIssuer) issuer, config); -175 } -176 -177 @Override -178 public void log(LogLevel level, String message, Throwable throwable) { -179 Logger logger = this.plugin.getLogger(); -180 Level logLevel = level == LogLevel.INFO ? Level.INFO : Level.SEVERE; -181 logger.log(logLevel, LogLevel.LOG_PREFIX + message); -182 if (throwable != null) { -183 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) { -184 logger.log(logLevel, LogLevel.LOG_PREFIX + line); -185 } -186 } -187 } -188} +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} diff --git a/docs/acf-core/allclasses-frame.html b/docs/acf-core/allclasses-frame.html index 6c7a8e35..8d5d498e 100644 --- a/docs/acf-core/allclasses-frame.html +++ b/docs/acf-core/allclasses-frame.html @@ -13,6 +13,7 @@001package co.aikar.commands; +002 +003import net.md_5.bungee.api.connection.ProxiedPlayer; +004import net.md_5.bungee.api.event.PlayerDisconnectEvent; +005import net.md_5.bungee.api.event.PostLoginEvent; +006import net.md_5.bungee.api.plugin.Listener; +007import net.md_5.bungee.api.plugin.Plugin; +008import net.md_5.bungee.event.EventHandler; +009 +010import java.util.concurrent.TimeUnit; +011 +012public class ACFBungeeListener implements Listener { +013 +014 private final BungeeCommandManager manager; +015 private final Plugin plugin; +016 +017 public ACFBungeeListener(BungeeCommandManager manager, Plugin plugin) { +018 this.manager = manager; +019 this.plugin = plugin; +020 } +021 +022 @EventHandler +023 public void onPlayerJoin(PostLoginEvent loginEvent) { +024 ProxiedPlayer player = loginEvent.getPlayer(); +025 +026 //the client settings are sent after a successful login +027 Runnable task = () -> manager.readLocale(player); +028 plugin.getProxy().getScheduler().schedule(plugin, task, 1, TimeUnit.SECONDS); +029 } +030 +031 @EventHandler +032 public void onDisconnect(PlayerDisconnectEvent disconnectEvent) { +033 //cleanup +034 ProxiedPlayer player = disconnectEvent.getPlayer(); +035 manager.issuersLocale.remove(player.getUniqueId()); +036 } +037} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
- ACFUtil
+- AnnotationProcessor
- ApacheCommonsExceptionUtil
- ApacheCommonsExceptionUtil.Nestable
- ApacheCommonsLangUtil
@@ -40,6 +41,7 @@- ConditionContext
- ConditionFailedException
- Conditions
+- ConditionsProcessor
- ContextResolver
- Default
- Dependency
diff --git a/docs/acf-core/allclasses-noframe.html b/docs/acf-core/allclasses-noframe.html index 0801c73e..0fe5a995 100644 --- a/docs/acf-core/allclasses-noframe.html +++ b/docs/acf-core/allclasses-noframe.html @@ -13,6 +13,7 @@
- ACFUtil
+- AnnotationProcessor
- ApacheCommonsExceptionUtil
- ApacheCommonsExceptionUtil.Nestable
- ApacheCommonsLangUtil
@@ -40,6 +41,7 @@- ConditionContext
- ConditionFailedException
- Conditions
+- ConditionsProcessor
- ContextResolver
- Default
- Dependency
diff --git a/docs/acf-core/co/aikar/commands/ACFUtil.html b/docs/acf-core/co/aikar/commands/ACFUtil.html index 701ffdcb..4eb32bc8 100644 --- a/docs/acf-core/co/aikar/commands/ACFUtil.html +++ b/docs/acf-core/co/aikar/commands/ACFUtil.html @@ -18,7 +18,7 @@ catch(err) { } //--> -var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9,"i12":9,"i13":9,"i14":9,"i15":9,"i16":9,"i17":9,"i18":9,"i19":9,"i20":9,"i21":9,"i22":9,"i23":9,"i24":9,"i25":9,"i26":9,"i27":9,"i28":9,"i29":9,"i30":9,"i31":9,"i32":9,"i33":9,"i34":9,"i35":9,"i36":9,"i37":9,"i38":9,"i39":9,"i40":9,"i41":9,"i42":9,"i43":9,"i44":9,"i45":9,"i46":9,"i47":9,"i48":41,"i49":9,"i50":9,"i51":9,"i52":9,"i53":9,"i54":9,"i55":9,"i56":9,"i57":9,"i58":9,"i59":9,"i60":9,"i61":9,"i62":9,"i63":9,"i64":9,"i65":9}; +var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9,"i12":9,"i13":9,"i14":9,"i15":9,"i16":9,"i17":9,"i18":9,"i19":9,"i20":9,"i21":9,"i22":9,"i23":9,"i24":9,"i25":9,"i26":9,"i27":9,"i28":9,"i29":9,"i30":9,"i31":9,"i32":9,"i33":9,"i34":9,"i35":9,"i36":9,"i37":9,"i38":9,"i39":9,"i40":9,"i41":9,"i42":9,"i43":9,"i44":9,"i45":9,"i46":9,"i47":9,"i48":9,"i49":41,"i50":9,"i51":9,"i52":9,"i53":9,"i54":9,"i55":9,"i56":9,"i57":9,"i58":9,"i59":9,"i60":9,"i61":9,"i62":9,"i63":9,"i64":9,"i65":9,"i66":9}; var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; @@ -49,7 +49,7 @@ var activeTableTab = "activeTableTab";@@ -538,7 +547,7 @@ extends- @@ -547,7 +556,7 @@ extends
replacements
-protected final CommandReplacements replacements+protected final CommandReplacements replacements- @@ -556,7 +565,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 +574,7 @@ extends
defaultExceptionHandler
-protected ExceptionHandler defaultExceptionHandler+protected ExceptionHandler defaultExceptionHandler- @@ -574,7 +583,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 +592,7 @@ extends
usePerIssuerLocale
-protected boolean usePerIssuerLocale+protected boolean usePerIssuerLocale- @@ -592,7 +601,7 @@ extends
localeChangedCallbacks
-protected List<IssuerLocaleChangedCallback<I extends CommandIssuer>> localeChangedCallbacks+protected List<IssuerLocaleChangedCallback<I extends CommandIssuer>> localeChangedCallbacks- @@ -601,7 +610,7 @@ extends
supportedLanguages
-protected Set<Locale> supportedLanguages+protected Set<Locale> supportedLanguages- @@ -610,16 +619,25 @@ extends
formatters
-protected Map<MessageType,MF extends MessageFormatter<FT>> formatters+protected Map<MessageType,MF extends MessageFormatter<FT>> formatters- -
defaultFormatter
-protected MF extends MessageFormatter<FT> defaultFormatter+protected MF extends MessageFormatter<FT> defaultFormatter+
@@ -653,7 +671,7 @@ extends+ + + +
- +
defaultHelpPerPage
-protected int defaultHelpPerPage+protected int defaultHelpPerPage++
@@ -636,7 +654,7 @@ extends- +
issuersLocale
+protected Map<UUID,Locale> issuersLocaleCommandManager
-public CommandManager()+public CommandManager()- @@ -662,7 +680,7 @@ extends
getCurrentCommandOperationContext
-public static CommandOperationContext getCurrentCommandOperationContext()+public static CommandOperationContext getCurrentCommandOperationContext()- @@ -671,7 +689,7 @@ extends
getCurrentCommandIssuer
-public static CommandIssuer getCurrentCommandIssuer()+public static CommandIssuer getCurrentCommandIssuer()- @@ -682,7 +700,7 @@ extends
getCurrentCommandManager
-public static CommandManager getCurrentCommandManager()+public static CommandManager getCurrentCommandManager()- @@ -692,7 +710,7 @@ extends
setFormat
-public MF setFormat(MessageType type, +public MF setFormat(MessageType type, MF formatter)- @@ -703,7 +721,7 @@ extends
getFormat
-public MF getFormat(MessageType type)+public MF getFormat(MessageType type)- @@ -715,7 +733,7 @@ extends
setFormat
-public void setFormat(MessageType type, +public void setFormat(MessageType type, FT... colors)- @@ -726,7 +744,7 @@ extends
setFormat
-public void setFormat(MessageType type, +public void setFormat(MessageType type, int i, FT color)- @@ -737,7 +755,7 @@ extends
getDefaultFormatter
-public MF getDefaultFormatter()+public MF getDefaultFormatter()- @@ -746,7 +764,7 @@ extends
setDefaultFormatter
-public void setDefaultFormatter(MF defaultFormatter)+public void setDefaultFormatter(MF defaultFormatter)- @@ -755,7 +773,7 @@ extends
getCommandConditions
-public CommandConditions<I,CEC,CC> getCommandConditions()+public CommandConditions<I,CEC,CC> getCommandConditions()- @@ -820,7 +838,7 @@ public
getCommandContexts
-public abstract CommandContexts<?> getCommandContexts()+public abstract CommandContexts<?> getCommandContexts()Gets the command contexts manager
- Returns:
@@ -769,7 +787,7 @@ extends- @@ -796,7 +814,7 @@ public
getCommandCompletions
-public abstract CommandCompletions<?> getCommandCompletions()+public abstract CommandCompletions<?> getCommandCompletions()Gets the command completions managergenerateCommandHelp
@Deprecated -public CommandHelp generateCommandHelp(CommandIssuer issuer, +public CommandHelp generateCommandHelp(CommandIssuer issuer, @NotNull @NotNull String command)Deprecated. Unstable API@@ -809,7 +827,7 @@ publicgenerateCommandHelp
@Deprecated -public CommandHelp generateCommandHelp()+public CommandHelp generateCommandHelp()Deprecated. Unstable APIgenerateCommandHelp
@Deprecated -public CommandHelp generateCommandHelp(CommandIssuer issuer, +public CommandHelp generateCommandHelp(CommandIssuer issuer, co.aikar.commands.RootCommand rootCommand)Deprecated. Unstable API@@ -832,7 +850,7 @@ publicgetDefaultHelpPerPage
@Deprecated -public int getDefaultHelpPerPage()+public int getDefaultHelpPerPage()Deprecated. Unstable API@@ -843,7 +861,7 @@ public intsetDefaultHelpPerPage
@Deprecated -public void setDefaultHelpPerPage(int defaultHelpPerPage)+public void setDefaultHelpPerPage(int defaultHelpPerPage)Deprecated. Unstable API@@ -853,7 +871,7 @@ public voidregisterCommand
-public abstract void registerCommand(BaseCommand command)+public abstract void registerCommand(BaseCommand command)Registers a command with ACF
- Parameters:
@@ -867,7 +885,7 @@ public void- @@ -876,7 +894,7 @@ public void
hasRegisteredCommands
-public abstract boolean hasRegisteredCommands()+public abstract boolean hasRegisteredCommands()- @@ -885,7 +903,7 @@ public void
isCommandIssuer
-public abstract boolean isCommandIssuer(Class<?> type)+public abstract boolean isCommandIssuer(Class<?> type)- @@ -894,7 +912,7 @@ public void
getCommandIssuer
-public abstract I getCommandIssuer(Object issuer)+public abstract I getCommandIssuer(Object issuer)- @@ -903,7 +921,7 @@ public void
createRootCommand
-public abstract co.aikar.commands.RootCommand createRootCommand(String cmd)+public abstract co.aikar.commands.RootCommand createRootCommand(String cmd)getLocales
-public abstract Locales getLocales()+public abstract Locales getLocales()Returns a Locales Manager to add and modify language tables for your commands.
- Returns:
@@ -916,7 +934,7 @@ public void- @@ -925,7 +943,7 @@ public void
usingPerIssuerLocale
-public boolean usingPerIssuerLocale()+public boolean usingPerIssuerLocale()- @@ -934,7 +952,7 @@ public void
usePerIssuerLocale
-public boolean usePerIssuerLocale(boolean setting)+public boolean usePerIssuerLocale(boolean setting)- @@ -944,7 +962,7 @@ public void
createConditionContext
-public ConditionContext createConditionContext(CommandIssuer issuer, +public ConditionContext createConditionContext(CommandIssuer issuer, String config)createCommandContext
-public abstract CommandExecutionContext createCommandContext(RegisteredCommand command, +public abstract CommandExecutionContext createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, @@ -958,7 +976,7 @@ public voidcreateCompletionContext
-public abstract CommandCompletionContext createCompletionContext(RegisteredCommand command, +public abstract CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, @@ -971,7 +989,7 @@ public void- @@ -982,7 +1000,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)- @@ -992,7 +1010,7 @@ public void
log
-public void log(co.aikar.commands.LogLevel level, +public void log(co.aikar.commands.LogLevel level, String message)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. @@ -1011,7 +1029,7 @@ public void- @@ -1021,7 +1039,7 @@ public void
hasPermission
-public boolean hasPermission(CommandIssuer issuer, +public boolean hasPermission(CommandIssuer issuer, String permission)- @@ -1031,7 +1049,7 @@ public void
getRootCommand
-public co.aikar.commands.RootCommand getRootCommand(@NotNull +public co.aikar.commands.RootCommand getRootCommand(@NotNull @NotNull String cmd)- @@ -1041,7 +1059,7 @@ public void
obtainRootCommand
-public co.aikar.commands.RootCommand obtainRootCommand(@NotNull +public co.aikar.commands.RootCommand obtainRootCommand(@NotNull @NotNull String cmd)createRegisteredCommand
-public RegisteredCommand createRegisteredCommand(BaseCommand command, +public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand)@@ -1053,7 +1071,7 @@ public voidsetDefaultExceptionHandler
-public void setDefaultExceptionHandler(ExceptionHandler exceptionHandler)+public void setDefaultExceptionHandler(ExceptionHandler exceptionHandler)Sets the defaultExceptionHandlerthat is called when an exception occurs while executing a command, if the command doesn't have it's own exception handler registered.
- Parameters:
@@ -1067,7 +1085,7 @@ public voidgetDefaultExceptionHandler
-public ExceptionHandler getDefaultExceptionHandler()+public ExceptionHandler getDefaultExceptionHandler()Gets the current default exception handler, might be null.
- Returns:
@@ -1081,7 +1099,7 @@ public voidhandleUncaughtException
-protected boolean handleUncaughtException(BaseCommand scope, +protected boolean handleUncaughtException(BaseCommand scope, RegisteredCommand registeredCommand, CommandIssuer sender, List<String> args, @@ -1096,7 +1114,7 @@ public voidsendMessage
-public void sendMessage(IT issuerArg, +public void sendMessage(IT issuerArg, MessageType type, co.aikar.locales.MessageKeyProvider key, String... replacements)@@ -1108,7 +1126,7 @@ public voidsendMessage
-public void sendMessage(CommandIssuer issuer, +public void sendMessage(CommandIssuer issuer, MessageType type, co.aikar.locales.MessageKeyProvider key, String... replacements)@@ -1120,7 +1138,7 @@ public voidformatMessage
-public String formatMessage(CommandIssuer issuer, +public String formatMessage(CommandIssuer issuer, MessageType type, co.aikar.locales.MessageKeyProvider key, String... replacements)@@ -1132,7 +1150,7 @@ public void- @@ -1143,18 +1161,30 @@ public void
onLocaleChange
-public void onLocaleChange(IssuerLocaleChangedCallback<I> onChange)+public void onLocaleChange(IssuerLocaleChangedCallback<I> onChange)- + + + + + +
notifyLocaleChange
-public void notifyLocaleChange(I issuer, +public void notifyLocaleChange(I issuer, Locale oldLocale, Locale newLocale)+
- +
+setIssuerLocale
+public Locale setIssuerLocale(IT issuer, + Locale locale)+@@ -1163,7 +1193,7 @@ public void
getIssuerLocale
-public Locale getIssuerLocale(CommandIssuer issuer)+public Locale getIssuerLocale(CommandIssuer issuer)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@@ -1177,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.@@ -1194,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 @@ -1216,7 +1246,7 @@ public voidregisterDependency
-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.
@@ -1239,7 +1269,7 @@ public voidenableUnstableAPI
@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'sdiff --git a/docs/acf-core/co/aikar/commands/class-use/AnnotationProcessor.html b/docs/acf-core/co/aikar/commands/class-use/AnnotationProcessor.html new file mode 100644 index 00000000..3ceb7aeb --- /dev/null +++ b/docs/acf-core/co/aikar/commands/class-use/AnnotationProcessor.html @@ -0,0 +1,165 @@ + + + + + + +Uses of Interface co.aikar.commands.AnnotationProcessor (ACF (Core) 0.5.0-SNAPSHOT API) + + + + + + + + ++ + + ++ ++ ++ + +++Uses of Interface
+
co.aikar.commands.AnnotationProcessor++ + ++
+- +
++
+Packages that use AnnotationProcessor ++ + +Package +Description ++ + +co.aikar.commands.processors ++ - +
++
+- + + +
+Uses of AnnotationProcessor in co.aikar.commands.processors
++
+Classes in co.aikar.commands.processors that implement AnnotationProcessor ++ + +Modifier and Type +Class and Description ++ + ++ class+ ConditionsProcessor+Deprecated.++ + + ++ ++ ++ + +Copyright © 2018. All rights reserved.
+ + diff --git a/docs/acf-core/co/aikar/commands/class-use/BaseCommand.html b/docs/acf-core/co/aikar/commands/class-use/BaseCommand.html index 77cec406..6a7e2f71 100644 --- a/docs/acf-core/co/aikar/commands/class-use/BaseCommand.html +++ b/docs/acf-core/co/aikar/commands/class-use/BaseCommand.html @@ -159,6 +159,13 @@ Throwable t)+ ++ default voidAnnotationProcessor. +onBaseCommandRegister(BaseCommand command, + T annotation)+Deprecated.++ abstract voidCommandManager. registerCommand(BaseCommand command)Registers a command with ACFdiff --git a/docs/acf-core/co/aikar/commands/class-use/CommandExecutionContext.html b/docs/acf-core/co/aikar/commands/class-use/CommandExecutionContext.html index 4752f0d3..b7134d1d 100644 --- a/docs/acf-core/co/aikar/commands/class-use/CommandExecutionContext.html +++ b/docs/acf-core/co/aikar/commands/class-use/CommandExecutionContext.html @@ -89,6 +89,10 @@co.aikar.commands.contexts + co.aikar.commands.processors ++ +
Methods in co.aikar.commands with parameters of type CommandExecutionContext ++ + +Modifier and Type +Method and Description ++ ++ default voidAnnotationProcessor. +onPostContextResolution(CommandExecutionContext context, + Object resolvedValue)+Deprecated.++ + ++ default voidAnnotationProcessor. +onPreContextResolution(CommandExecutionContext context)+Deprecated.+- @@ -192,6 +218,27 @@
+- + + +
Uses of CommandExecutionContext in co.aikar.commands.processors
++
+Methods in co.aikar.commands.processors with parameters of type CommandExecutionContext ++ + +Modifier and Type +Method and Description ++ + ++ voidConditionsProcessor. +onPostContextResolution(CommandExecutionContext context, + Object resolvedValue)+Deprecated.+co.aikar.commands + + @@ -107,6 +111,47 @@ +co.aikar.commands.processors ++ +
+ +Methods in co.aikar.commands with parameters of type CommandOperationContext ++ + +Modifier and Type +Method and Description ++ ++ default voidAnnotationProcessor. +onPostComand(CommandOperationContext context)+Deprecated.++ + ++ default voidAnnotationProcessor. +onPreComand(CommandOperationContext context)+Deprecated.+- + + +
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 76d34e95..ba83104a 100644 --- a/docs/acf-core/co/aikar/commands/class-use/RegisteredCommand.html +++ b/docs/acf-core/co/aikar/commands/class-use/RegisteredCommand.html @@ -172,6 +172,22 @@ Throwable t)Uses of CommandOperationContext in co.aikar.commands.processors
++
Methods in co.aikar.commands.processors with parameters of type CommandOperationContext ++ + +Modifier and Type +Method and Description ++ + ++ voidConditionsProcessor. +onPreComand(CommandOperationContext context)+Deprecated.++ ++ default voidAnnotationProcessor. +onCommandRegistered(RegisteredCommand command, + T annotation)+Deprecated.++ ++ default voidAnnotationProcessor. +onParameterRegistered(RegisteredCommand command, + int parameterIndex, + Parameter p, + T annotation)+Deprecated.+diff --git a/docs/acf-core/co/aikar/commands/contexts/package-summary.html b/docs/acf-core/co/aikar/commands/contexts/package-summary.html index 03c84158..0d5bf672 100644 --- a/docs/acf-core/co/aikar/commands/contexts/package-summary.html +++ b/docs/acf-core/co/aikar/commands/contexts/package-summary.html @@ -43,7 +43,7 @@ voidCommandOperationContext. setRegisteredCommand(RegisteredCommand registeredCommand)