diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..e570790a --- /dev/null +++ b/docs/README.md @@ -0,0 +1,5 @@ +# Annotation Command Framework Java Docs +- [ACF (Core)](acf-core) +- [ACF (Bukkit)](acf-bungee) +- [ACF (Sponge)](acf-sponge) +- [ACF (Bungee)](acf-bungee) diff --git a/docs/acf-bukkit/allclasses-frame.html b/docs/acf-bukkit/allclasses-frame.html new file mode 100644 index 00000000..86a794be --- /dev/null +++ b/docs/acf-bukkit/allclasses-frame.html @@ -0,0 +1,31 @@ + + + +
+ + +public class ACFBukkitUtil +extends Object+
| Constructor and Description | +
|---|
ACFBukkitUtil() |
+
| Modifier and Type | +Method and Description | +
|---|---|
static String |
+blockLocationToString(org.bukkit.Location loc) |
+
static String |
+color(String message) |
+
static double |
+distance(@NotNull org.bukkit.entity.Entity e1,
+ @NotNull org.bukkit.entity.Entity e2) |
+
static double |
+distance(@NotNull org.bukkit.Location loc1,
+ @NotNull org.bukkit.Location loc2) |
+
static double |
+distance2d(@NotNull org.bukkit.entity.Entity e1,
+ @NotNull org.bukkit.entity.Entity e2) |
+
static double |
+distance2d(@NotNull org.bukkit.Location loc1,
+ @NotNull org.bukkit.Location loc2) |
+
static org.bukkit.entity.Player |
+findPlayerSmart(co.aikar.commands.CommandIssuer issuer,
+ String search) |
+
static org.bukkit.entity.Player |
+findPlayerSmart(org.bukkit.command.CommandSender requester,
+ String search)
+Deprecated.
+ |
+
static String |
+formatLocation(org.bukkit.Location loc) |
+
static String |
+fullBlockLocationToString(org.bukkit.Location loc) |
+
static String |
+fullLocationToString(org.bukkit.Location loc) |
+
static org.bukkit.Location |
+getRandLoc(org.bukkit.Location loc,
+ int radius) |
+
static org.bukkit.Location |
+getRandLoc(org.bukkit.Location loc,
+ int xzRadius,
+ int yRadius) |
+
static @NotNull org.bukkit.Location |
+getRandLoc(org.bukkit.Location loc,
+ int xRadius,
+ int yRadius,
+ int zRadius) |
+
static org.bukkit.Location |
+getTargetLoc(org.bukkit.entity.Player player) |
+
static org.bukkit.Location |
+getTargetLoc(org.bukkit.entity.Player player,
+ int maxDist) |
+
static org.bukkit.Location |
+getTargetLoc(org.bukkit.entity.Player player,
+ int maxDist,
+ double addY) |
+
static boolean |
+isValidName(String name) |
+
static boolean |
+isWithinDistance(@NotNull org.bukkit.Location loc1,
+ @NotNull org.bukkit.Location loc2,
+ int dist) |
+
static boolean |
+isWithinDistance(@NotNull org.bukkit.entity.Player p1,
+ @NotNull org.bukkit.entity.Player p2,
+ int dist) |
+
static String |
+removeColors(String msg) |
+
static String |
+replaceChatString(String message,
+ Pattern replace,
+ String with) |
+
static String |
+replaceChatString(String message,
+ String replace,
+ String with) |
+
static void |
+sendMsg(org.bukkit.command.CommandSender player,
+ String message)
+Deprecated.
+ |
+
static org.bukkit.Location |
+stringToLocation(String storedLoc) |
+
static org.bukkit.Location |
+stringToLocation(String storedLoc,
+ org.bukkit.World forcedWorld) |
+
public ACFBukkitUtil()+
public static String formatLocation(org.bukkit.Location loc)+
@Deprecated +public static void sendMsg(org.bukkit.command.CommandSender player, + String message)+
public static org.bukkit.Location stringToLocation(String storedLoc)+
public static org.bukkit.Location stringToLocation(String storedLoc, + org.bukkit.World forcedWorld)+
public static String fullLocationToString(org.bukkit.Location loc)+
public static String fullBlockLocationToString(org.bukkit.Location loc)+
public static String blockLocationToString(org.bukkit.Location loc)+
public static double distance(@NotNull + @NotNull org.bukkit.entity.Entity e1, + @NotNull + @NotNull org.bukkit.entity.Entity e2)+
public static double distance2d(@NotNull + @NotNull org.bukkit.entity.Entity e1, + @NotNull + @NotNull org.bukkit.entity.Entity e2)+
public static double distance2d(@NotNull + @NotNull org.bukkit.Location loc1, + @NotNull + @NotNull org.bukkit.Location loc2)+
public static double distance(@NotNull + @NotNull org.bukkit.Location loc1, + @NotNull + @NotNull org.bukkit.Location loc2)+
public static org.bukkit.Location getTargetLoc(org.bukkit.entity.Player player)+
public static org.bukkit.Location getTargetLoc(org.bukkit.entity.Player player, + int maxDist)+
public static org.bukkit.Location getTargetLoc(org.bukkit.entity.Player player, + int maxDist, + double addY)+
public static org.bukkit.Location getRandLoc(org.bukkit.Location loc, + int radius)+
public static org.bukkit.Location getRandLoc(org.bukkit.Location loc, + int xzRadius, + int yRadius)+
@NotNull +public static @NotNull org.bukkit.Location getRandLoc(org.bukkit.Location loc, + int xRadius, + int yRadius, + int zRadius)+
public static String removeColors(String msg)+
public static String replaceChatString(String message, + String replace, + String with)+
public static String replaceChatString(String message, + Pattern replace, + String with)+
public static boolean isWithinDistance(@NotNull + @NotNull org.bukkit.entity.Player p1, + @NotNull + @NotNull org.bukkit.entity.Player p2, + int dist)+
public static boolean isWithinDistance(@NotNull + @NotNull org.bukkit.Location loc1, + @NotNull + @NotNull org.bukkit.Location loc2, + int dist)+
public static org.bukkit.entity.Player findPlayerSmart(org.bukkit.command.CommandSender requester, + String search)+
public static org.bukkit.entity.Player findPlayerSmart(co.aikar.commands.CommandIssuer issuer, + String search)+
public static boolean isValidName(String name)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/BukkitCommandCompletionContext.html b/docs/acf-bukkit/co/aikar/commands/BukkitCommandCompletionContext.html new file mode 100644 index 00000000..e017336a --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/BukkitCommandCompletionContext.html @@ -0,0 +1,265 @@ + + + + + + +public class BukkitCommandCompletionContext +extends co.aikar.commands.CommandCompletionContext+
issuer| Modifier and Type | +Method and Description | +
|---|---|
org.bukkit.command.CommandSender |
+getSender() |
+
getConfig, getConfig, getConfig, getConfigs, getContextValue, getContextValue, getInput, getIssuer, hasConfigCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/BukkitCommandCompletions.html b/docs/acf-bukkit/co/aikar/commands/BukkitCommandCompletions.html new file mode 100644 index 00000000..d2b901de --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/BukkitCommandCompletions.html @@ -0,0 +1,265 @@ + + + + + + +public class BukkitCommandCompletions +extends co.aikar.commands.CommandCompletions<BukkitCommandCompletionContext>+
co.aikar.commands.CommandCompletions.CommandCompletionHandler<C extends co.aikar.commands.CommandCompletionContext>| Constructor and Description | +
|---|
BukkitCommandCompletions(BukkitCommandManager manager) |
+
public BukkitCommandCompletions(BukkitCommandManager manager)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/BukkitCommandContexts.html b/docs/acf-bukkit/co/aikar/commands/BukkitCommandContexts.html new file mode 100644 index 00000000..db55281d --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/BukkitCommandContexts.html @@ -0,0 +1,265 @@ + + + + + + +public class BukkitCommandContexts +extends co.aikar.commands.CommandContexts<BukkitCommandExecutionContext>+
contextMap, manager| Constructor and Description | +
|---|
BukkitCommandContexts(BukkitCommandManager manager) |
+
public BukkitCommandContexts(BukkitCommandManager manager)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/BukkitCommandExecutionContext.html b/docs/acf-bukkit/co/aikar/commands/BukkitCommandExecutionContext.html new file mode 100644 index 00000000..3e21e9d7 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/BukkitCommandExecutionContext.html @@ -0,0 +1,265 @@ + + + + + + +public class BukkitCommandExecutionContext +extends co.aikar.commands.CommandExecutionContext<BukkitCommandExecutionContext,BukkitCommandIssuer>+
issuer| Modifier and Type | +Method and Description | +
|---|---|
org.bukkit.command.CommandSender |
+getSender() |
+
canOverridePlayerContext, getAnnotation, getArgs, getCmd, getFirstArg, getFlags, getFlagValue, getFlagValue, getIndex, getIssuer, getLastArg, getNumParams, getParam, getPassedArgs, getResolvedArg, getResolvedArg, getResolvedArg, hasAnnotation, hasFlag, isLastArg, isOptional, joinArgs, joinArgs, popFirstArg, popLastArgCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/BukkitCommandIssuer.html b/docs/acf-bukkit/co/aikar/commands/BukkitCommandIssuer.html new file mode 100644 index 00000000..310d1305 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/BukkitCommandIssuer.html @@ -0,0 +1,356 @@ + + + + + + +public class BukkitCommandIssuer +extends Object +implements co.aikar.commands.CommandIssuer+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+equals(Object o) |
+
<T> T |
+getIssuer() |
+
co.aikar.commands.CommandManager |
+getManager() |
+
int |
+hashCode() |
+
boolean |
+hasPermission(String name) |
+
boolean |
+isPlayer() |
+
void |
+sendMessageInternal(String message) |
+
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitsendError, sendError, sendInfo, sendInfo, sendMessage, sendMessage, sendMessage, sendSyntax, sendSyntaxpublic boolean isPlayer()+
isPlayer in interface co.aikar.commands.CommandIssuerpublic <T> T getIssuer()+
getIssuer in interface co.aikar.commands.CommandIssuerpublic co.aikar.commands.CommandManager getManager()+
getManager in interface co.aikar.commands.CommandIssuerpublic void sendMessageInternal(String message)+
sendMessageInternal in interface co.aikar.commands.CommandIssuerpublic boolean hasPermission(String name)+
hasPermission in interface co.aikar.commands.CommandIssuerCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/BukkitCommandManager.html b/docs/acf-bukkit/co/aikar/commands/BukkitCommandManager.html new file mode 100644 index 00000000..701e2fb3 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/BukkitCommandManager.html @@ -0,0 +1,701 @@ + + + + + + +public class BukkitCommandManager +extends co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,org.bukkit.ChatColor,BukkitMessageFormatter>+
| Modifier and Type | +Field and Description | +
|---|---|
protected BukkitCommandCompletions |
+completions |
+
protected BukkitCommandContexts |
+contexts |
+
protected Map<String,org.bukkit.command.Command> |
+knownCommands |
+
protected BukkitLocales |
+locales |
+
protected org.bukkit.plugin.Plugin |
+plugin |
+
protected Map<String,BukkitRootCommand> |
+registeredCommands |
+
defaultExceptionHandler, defaultFormatter, formatters, replacements, rootCommands, supportedLanguages| Constructor and Description | +
|---|
BukkitCommandManager(org.bukkit.plugin.Plugin plugin) |
+
| Modifier and Type | +Method and Description | +
|---|---|
<R extends co.aikar.commands.CommandExecutionContext> |
+createCommandContext(co.aikar.commands.RegisteredCommand command,
+ Parameter parameter,
+ co.aikar.commands.CommandIssuer sender,
+ List<String> args,
+ int i,
+ Map<String,Object> passedArgs) |
+
co.aikar.commands.CommandCompletionContext |
+createCompletionContext(co.aikar.commands.RegisteredCommand command,
+ co.aikar.commands.CommandIssuer sender,
+ String input,
+ String config,
+ String[] args) |
+
co.aikar.commands.RegisteredCommand |
+createRegisteredCommand(co.aikar.commands.BaseCommand command,
+ String cmdName,
+ Method method,
+ String prefSubCommand) |
+
co.aikar.commands.RootCommand |
+createRootCommand(String cmd) |
+
co.aikar.commands.CommandCompletions<BukkitCommandCompletionContext> |
+getCommandCompletions() |
+
co.aikar.commands.CommandContexts<BukkitCommandExecutionContext> |
+getCommandContexts() |
+
co.aikar.commands.CommandIssuer |
+getCommandIssuer(Object issuer) |
+
BukkitLocales |
+getLocales() |
+
org.bukkit.plugin.Plugin |
+getPlugin() |
+
co.aikar.timings.lib.TimingManager |
+getTimings() |
+
boolean |
+hasRegisteredCommands() |
+
boolean |
+isCommandIssuer(Class<?> type) |
+
void |
+log(co.aikar.commands.LogLevel level,
+ String message,
+ Throwable throwable) |
+
void |
+registerCommand(co.aikar.commands.BaseCommand command) |
+
void |
+registerCommand(co.aikar.commands.BaseCommand command,
+ boolean force) |
+
void |
+unregisterCommand(co.aikar.commands.BaseCommand command) |
+
void |
+unregisterCommand(BukkitRootCommand command)
+Deprecated.
+
+Use unregisterCommand(BaseCommand) - this will be visibility reduced later.
+ |
+
void |
+unregisterCommands() |
+
addSupportedLanguage, createCommandOperationContext, enableUnstableAPI, formatMessage, generateCommandHelp, generateCommandHelp, generateCommandHelp, generateCommandHelp, getCommandReplacements, getCurrentCommandIssuer, getCurrentCommandManager, getCurrentCommandOperationContext, getDefaultExceptionHandler, getDefaultFormatter, getFormat, getIssuerLocale, getSupportedLanguages, handleUncaughtException, hasPermission, log, obtainRootCommand, sendMessage, sendMessage, setDefaultExceptionHandler, setDefaultFormatter, setFormat, setFormat, setFormatprotected final org.bukkit.plugin.Plugin plugin+
protected Map<String,org.bukkit.command.Command> knownCommands+
protected Map<String,BukkitRootCommand> registeredCommands+
protected BukkitCommandContexts contexts+
protected BukkitCommandCompletions completions+
protected BukkitLocales locales+
public BukkitCommandManager(org.bukkit.plugin.Plugin plugin)+
public org.bukkit.plugin.Plugin getPlugin()+
public boolean isCommandIssuer(Class<?> type)+
isCommandIssuer in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,org.bukkit.ChatColor,BukkitMessageFormatter>public co.aikar.commands.CommandContexts<BukkitCommandExecutionContext> getCommandContexts()+
getCommandContexts in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,org.bukkit.ChatColor,BukkitMessageFormatter>public co.aikar.commands.CommandCompletions<BukkitCommandCompletionContext> getCommandCompletions()+
getCommandCompletions in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,org.bukkit.ChatColor,BukkitMessageFormatter>public BukkitLocales getLocales()+
getLocales in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,org.bukkit.ChatColor,BukkitMessageFormatter>public boolean hasRegisteredCommands()+
hasRegisteredCommands in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,org.bukkit.ChatColor,BukkitMessageFormatter>public void registerCommand(co.aikar.commands.BaseCommand command, + boolean force)+
public void registerCommand(co.aikar.commands.BaseCommand command)+
registerCommand in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,org.bukkit.ChatColor,BukkitMessageFormatter>public void unregisterCommand(co.aikar.commands.BaseCommand command)+
@Deprecated +public void unregisterCommand(BukkitRootCommand command)+
command - public void unregisterCommands()+
public co.aikar.timings.lib.TimingManager getTimings()+
public co.aikar.commands.RootCommand createRootCommand(String cmd)+
createRootCommand in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,org.bukkit.ChatColor,BukkitMessageFormatter>public co.aikar.commands.CommandIssuer getCommandIssuer(Object issuer)+
getCommandIssuer in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,org.bukkit.ChatColor,BukkitMessageFormatter>public <R extends co.aikar.commands.CommandExecutionContext> R createCommandContext(co.aikar.commands.RegisteredCommand command, + Parameter parameter, + co.aikar.commands.CommandIssuer sender, + List<String> args, + int i, + Map<String,Object> passedArgs)+
createCommandContext in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,org.bukkit.ChatColor,BukkitMessageFormatter>public co.aikar.commands.CommandCompletionContext createCompletionContext(co.aikar.commands.RegisteredCommand command, + co.aikar.commands.CommandIssuer sender, + String input, + String config, + String[] args)+
createCompletionContext in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,org.bukkit.ChatColor,BukkitMessageFormatter>public co.aikar.commands.RegisteredCommand createRegisteredCommand(co.aikar.commands.BaseCommand command, + String cmdName, + Method method, + String prefSubCommand)+
createRegisteredCommand in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,org.bukkit.ChatColor,BukkitMessageFormatter>public void log(co.aikar.commands.LogLevel level, + String message, + Throwable throwable)+
log in class co.aikar.commands.CommandManager<org.bukkit.command.CommandSender,org.bukkit.ChatColor,BukkitMessageFormatter>Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/BukkitLocales.html b/docs/acf-bukkit/co/aikar/commands/BukkitLocales.html new file mode 100644 index 00000000..ddeff5cc --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/BukkitLocales.html @@ -0,0 +1,389 @@ + + + + + + +public class BukkitLocales +extends co.aikar.commands.Locales+
AFRIKAANS, ARABIC, BULGARIAN, CHINESE, CZECH, DANISH, DUTCH, ENGLISH, FINNISH, FRENCH, GERMAN, GREEK, HEBREW, HINDI, ITALIAN, JAPANESE, KOREAN, LATIN, POLISH, PORTUGUESE, ROMANIAN, RUSSIAN, SIMPLIFIED_CHINESE, SPANISH, SWEDISH, THAI, TRADITIONAL_CHINESE, TURKISH, UKRANIAN, VIETNAMESE, WELSH| Constructor and Description | +
|---|
BukkitLocales(BukkitCommandManager manager) |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+loadLanguage(org.bukkit.configuration.file.FileConfiguration config,
+ Locale locale)
+Loads every message from the Configuration object.
+ |
+
void |
+loadLanguages() |
+
boolean |
+loadYamlLanguageFile(File file,
+ Locale locale)
+Loads the given file
+ |
+
boolean |
+loadYamlLanguageFile(String file,
+ Locale locale)
+Loads a file out of the plugins data folder by the given name
+ |
+
addMessage, addMessageBundle, addMessageBundles, addMessages, addMessageStrings, getDefaultLocale, getMessage, loadMissingBundles, replaceI18NStrings, setDefaultLocalepublic BukkitLocales(BukkitCommandManager manager)+
public void loadLanguages()+
loadLanguages in class co.aikar.commands.Localespublic boolean loadYamlLanguageFile(File file, + Locale locale) + throws IOException, + org.bukkit.configuration.InvalidConfigurationException+
file - locale - IOExceptionorg.bukkit.configuration.InvalidConfigurationExceptionpublic boolean loadYamlLanguageFile(String file, + Locale locale) + throws IOException, + org.bukkit.configuration.InvalidConfigurationException+
file - locale - IOExceptionorg.bukkit.configuration.InvalidConfigurationExceptionpublic boolean loadLanguage(org.bukkit.configuration.file.FileConfiguration config, + Locale locale)+
config - locale - Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/BukkitMessageFormatter.html b/docs/acf-bukkit/co/aikar/commands/BukkitMessageFormatter.html new file mode 100644 index 00000000..41634db1 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/BukkitMessageFormatter.html @@ -0,0 +1,250 @@ + + + + + + +public class BukkitMessageFormatter +extends co.aikar.commands.MessageFormatter<org.bukkit.ChatColor>+
| Constructor and Description | +
|---|
BukkitMessageFormatter(org.bukkit.ChatColor... colors) |
+
public BukkitMessageFormatter(org.bukkit.ChatColor... colors)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/BukkitRegisteredCommand.html b/docs/acf-bukkit/co/aikar/commands/BukkitRegisteredCommand.html new file mode 100644 index 00000000..13b8ef67 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/BukkitRegisteredCommand.html @@ -0,0 +1,271 @@ + + + + + + +public class BukkitRegisteredCommand +extends co.aikar.commands.RegisteredCommand<BukkitCommandExecutionContext>+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+postCommand() |
+
void |
+preCommand() |
+
addSubcommand, addSubcommands, getCommand, getPermission, getPrefSubCommand, getSyntaxTextpublic void preCommand()+
preCommand in class co.aikar.commands.RegisteredCommand<BukkitCommandExecutionContext>public void postCommand()+
postCommand in class co.aikar.commands.RegisteredCommand<BukkitCommandExecutionContext>Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/BukkitRootCommand.html b/docs/acf-bukkit/co/aikar/commands/BukkitRootCommand.html new file mode 100644 index 00000000..285fc2dc --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/BukkitRootCommand.html @@ -0,0 +1,396 @@ + + + + + + +public class BukkitRootCommand +extends org.bukkit.command.Command+
description, usageMessage| Modifier and Type | +Method and Description | +
|---|---|
void |
+addChild(co.aikar.commands.BaseCommand command) |
+
default void |
+addChildShared(List<co.aikar.commands.BaseCommand> arg0,
+ com.google.common.collect.SetMultimap<String,co.aikar.commands.RegisteredCommand> arg1,
+ co.aikar.commands.BaseCommand arg2) |
+
default co.aikar.commands.BaseCommand |
+execute(co.aikar.commands.CommandIssuer arg0,
+ String arg1,
+ String[] arg2) |
+
boolean |
+execute(org.bukkit.command.CommandSender sender,
+ String commandLabel,
+ String[] args) |
+
String |
+getCommandName() |
+
co.aikar.commands.BaseCommand |
+getDefCommand() |
+
co.aikar.commands.CommandManager |
+getManager() |
+
com.google.common.collect.SetMultimap<String,co.aikar.commands.RegisteredCommand> |
+getSubCommands() |
+
List<String> |
+tabComplete(org.bukkit.command.CommandSender sender,
+ String alias,
+ String[] args) |
+
broadcastCommandMessage, broadcastCommandMessage, getAliases, getDescription, getLabel, getName, getPermission, getPermissionMessage, getUsage, isRegistered, register, setAliases, setDescription, setLabel, setName, setPermission, setPermissionMessage, setUsage, tabComplete, testPermission, testPermissionSilent, toString, unregisterpublic String getCommandName()+
public List<String> tabComplete(org.bukkit.command.CommandSender sender, + String alias, + String[] args) + throws IllegalArgumentException+
tabComplete in class org.bukkit.command.CommandIllegalArgumentExceptionpublic boolean execute(org.bukkit.command.CommandSender sender, + String commandLabel, + String[] args)+
execute in class org.bukkit.command.Commandpublic void addChild(co.aikar.commands.BaseCommand command)+
public co.aikar.commands.CommandManager getManager()+
public com.google.common.collect.SetMultimap<String,co.aikar.commands.RegisteredCommand> getSubCommands()+
public co.aikar.commands.BaseCommand getDefCommand()+
public void addChildShared(List<co.aikar.commands.BaseCommand> arg0, + com.google.common.collect.SetMultimap<String,co.aikar.commands.RegisteredCommand> arg1, + co.aikar.commands.BaseCommand arg2)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/MinecraftMessageKeys.html b/docs/acf-bukkit/co/aikar/commands/MinecraftMessageKeys.html new file mode 100644 index 00000000..0019cfa0 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/MinecraftMessageKeys.html @@ -0,0 +1,468 @@ + + + + + + +public enum MinecraftMessageKeys +extends Enum<MinecraftMessageKeys> +implements co.aikar.locales.MessageKeyProvider+
| Enum Constant and Description | +
|---|
INVALID_WORLD |
+
IS_NOT_A_VALID_NAME |
+
LOCATION_CONSOLE_NOT_RELATIVE |
+
LOCATION_PLEASE_SPECIFY_WORLD |
+
LOCATION_PLEASE_SPECIFY_XYZ |
+
MULTIPLE_PLAYERS_MATCH |
+
NO_PLAYER_FOUND |
+
NO_PLAYER_FOUND_SERVER |
+
PLAYER_IS_VANISHED_CONFIRM |
+
USERNAME_TOO_SHORT |
+
YOU_MUST_BE_HOLDING_ITEM |
+
| Modifier and Type | +Method and Description | +
|---|---|
co.aikar.locales.MessageKey |
+getMessageKey() |
+
static MinecraftMessageKeys |
+valueOf(String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static MinecraftMessageKeys[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
public static final MinecraftMessageKeys INVALID_WORLD+
public static final MinecraftMessageKeys YOU_MUST_BE_HOLDING_ITEM+
public static final MinecraftMessageKeys PLAYER_IS_VANISHED_CONFIRM+
public static final MinecraftMessageKeys USERNAME_TOO_SHORT+
public static final MinecraftMessageKeys IS_NOT_A_VALID_NAME+
public static final MinecraftMessageKeys MULTIPLE_PLAYERS_MATCH+
public static final MinecraftMessageKeys NO_PLAYER_FOUND_SERVER+
public static final MinecraftMessageKeys NO_PLAYER_FOUND+
public static final MinecraftMessageKeys LOCATION_PLEASE_SPECIFY_WORLD+
public static final MinecraftMessageKeys LOCATION_PLEASE_SPECIFY_XYZ+
public static final MinecraftMessageKeys LOCATION_CONSOLE_NOT_RELATIVE+
public static MinecraftMessageKeys[] values()+
+for (MinecraftMessageKeys c : MinecraftMessageKeys.values()) + System.out.println(c); +
public static MinecraftMessageKeys valueOf(String name)+
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic co.aikar.locales.MessageKey getMessageKey()+
getMessageKey in interface co.aikar.locales.MessageKeyProviderCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/class-use/ACFBukkitUtil.html b/docs/acf-bukkit/co/aikar/commands/class-use/ACFBukkitUtil.html new file mode 100644 index 00000000..c75002dc --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/class-use/ACFBukkitUtil.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandCompletionContext.html b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandCompletionContext.html new file mode 100644 index 00000000..b98efb0b --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandCompletionContext.html @@ -0,0 +1,165 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
co.aikar.commands.CommandCompletions<BukkitCommandCompletionContext> |
+BukkitCommandManager.getCommandCompletions() |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandCompletions.html b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandCompletions.html new file mode 100644 index 00000000..6756fa4c --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandCompletions.html @@ -0,0 +1,165 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
protected BukkitCommandCompletions |
+BukkitCommandManager.completions |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandContexts.html b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandContexts.html new file mode 100644 index 00000000..4cbe65df --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandContexts.html @@ -0,0 +1,165 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
protected BukkitCommandContexts |
+BukkitCommandManager.contexts |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandExecutionContext.html b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandExecutionContext.html new file mode 100644 index 00000000..f2bc1e2b --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandExecutionContext.html @@ -0,0 +1,165 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
co.aikar.commands.CommandContexts<BukkitCommandExecutionContext> |
+BukkitCommandManager.getCommandContexts() |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandIssuer.html b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandIssuer.html new file mode 100644 index 00000000..eea82483 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandIssuer.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandManager.html b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandManager.html new file mode 100644 index 00000000..9e5c8aa5 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitCommandManager.html @@ -0,0 +1,169 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Constructor and Description | +
|---|
BukkitCommandCompletions(BukkitCommandManager manager) |
+
BukkitCommandContexts(BukkitCommandManager manager) |
+
BukkitLocales(BukkitCommandManager manager) |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/class-use/BukkitLocales.html b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitLocales.html new file mode 100644 index 00000000..cf7db500 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitLocales.html @@ -0,0 +1,178 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
protected BukkitLocales |
+BukkitCommandManager.locales |
+
| Modifier and Type | +Method and Description | +
|---|---|
BukkitLocales |
+BukkitCommandManager.getLocales() |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/class-use/BukkitMessageFormatter.html b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitMessageFormatter.html new file mode 100644 index 00000000..73bddc59 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitMessageFormatter.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/class-use/BukkitRegisteredCommand.html b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitRegisteredCommand.html new file mode 100644 index 00000000..1c61aa75 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitRegisteredCommand.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/class-use/BukkitRootCommand.html b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitRootCommand.html new file mode 100644 index 00000000..7487a413 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/class-use/BukkitRootCommand.html @@ -0,0 +1,182 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
protected Map<String,BukkitRootCommand> |
+BukkitCommandManager.registeredCommands |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+BukkitCommandManager.unregisterCommand(BukkitRootCommand command)
+Deprecated.
+
+Use unregisterCommand(BaseCommand) - this will be visibility reduced later.
+ |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/class-use/MinecraftMessageKeys.html b/docs/acf-bukkit/co/aikar/commands/class-use/MinecraftMessageKeys.html new file mode 100644 index 00000000..d42543f7 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/class-use/MinecraftMessageKeys.html @@ -0,0 +1,174 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
static MinecraftMessageKeys |
+MinecraftMessageKeys.valueOf(String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static MinecraftMessageKeys[] |
+MinecraftMessageKeys.values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/contexts/OnlinePlayer.html b/docs/acf-bukkit/co/aikar/commands/contexts/OnlinePlayer.html new file mode 100644 index 00000000..45707d9b --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/contexts/OnlinePlayer.html @@ -0,0 +1,359 @@ + + + + + + +public class OnlinePlayer +extends Object+
| Modifier and Type | +Field and Description | +
|---|---|
org.bukkit.entity.Player |
+player |
+
| Constructor and Description | +
|---|
OnlinePlayer(org.bukkit.entity.Player player) |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+equals(Object o) |
+
org.bukkit.entity.Player |
+getPlayer() |
+
int |
+hashCode() |
+
String |
+toString() |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/contexts/class-use/OnlinePlayer.html b/docs/acf-bukkit/co/aikar/commands/contexts/class-use/OnlinePlayer.html new file mode 100644 index 00000000..76f8215b --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/contexts/class-use/OnlinePlayer.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/contexts/package-frame.html b/docs/acf-bukkit/co/aikar/commands/contexts/package-frame.html new file mode 100644 index 00000000..2f070b52 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/contexts/package-frame.html @@ -0,0 +1,20 @@ + + + + + + +| Class | +Description | +
|---|---|
| OnlinePlayer | ++ |
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/contexts/package-tree.html b/docs/acf-bukkit/co/aikar/commands/contexts/package-tree.html new file mode 100644 index 00000000..7f98e462 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/contexts/package-tree.html @@ -0,0 +1,138 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/contexts/package-use.html b/docs/acf-bukkit/co/aikar/commands/contexts/package-use.html new file mode 100644 index 00000000..a0d902e6 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/contexts/package-use.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/package-frame.html b/docs/acf-bukkit/co/aikar/commands/package-frame.html new file mode 100644 index 00000000..b2c61f51 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/package-frame.html @@ -0,0 +1,34 @@ + + + + + + +| Class | +Description | +
|---|---|
| ACFBukkitUtil | ++ |
| BukkitCommandCompletionContext | ++ |
| BukkitCommandCompletions | ++ |
| BukkitCommandContexts | ++ |
| BukkitCommandExecutionContext | ++ |
| BukkitCommandIssuer | ++ |
| BukkitCommandManager | ++ |
| BukkitLocales | ++ |
| BukkitMessageFormatter | ++ |
| BukkitRegisteredCommand | ++ |
| BukkitRootCommand | ++ |
| Enum | +Description | +
|---|---|
| MinecraftMessageKeys | ++ |
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/package-tree.html b/docs/acf-bukkit/co/aikar/commands/package-tree.html new file mode 100644 index 00000000..2d1fd9ff --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/package-tree.html @@ -0,0 +1,196 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/co/aikar/commands/package-use.html b/docs/acf-bukkit/co/aikar/commands/package-use.html new file mode 100644 index 00000000..b51cf5d0 --- /dev/null +++ b/docs/acf-bukkit/co/aikar/commands/package-use.html @@ -0,0 +1,179 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Class and Description | +
|---|
| BukkitCommandCompletionContext | +
| BukkitCommandCompletions | +
| BukkitCommandContexts | +
| BukkitCommandExecutionContext | +
| BukkitCommandManager | +
| BukkitLocales | +
| BukkitRootCommand | +
| MinecraftMessageKeys | +
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/constant-values.html b/docs/acf-bukkit/constant-values.html new file mode 100644 index 00000000..f4be5544 --- /dev/null +++ b/docs/acf-bukkit/constant-values.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/deprecated-list.html b/docs/acf-bukkit/deprecated-list.html new file mode 100644 index 00000000..dd6b8c96 --- /dev/null +++ b/docs/acf-bukkit/deprecated-list.html @@ -0,0 +1,155 @@ + + + + + + +| Method and Description | +
|---|
| co.aikar.commands.ACFBukkitUtil.findPlayerSmart(CommandSender, String) | +
| co.aikar.commands.ACFBukkitUtil.sendMsg(CommandSender, String) | +
| co.aikar.commands.BukkitCommandManager.unregisterCommand(BukkitRootCommand)
+ Use unregisterCommand(BaseCommand) - this will be visibility reduced later.
+ |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/help-doc.html b/docs/acf-bukkit/help-doc.html new file mode 100644 index 00000000..22eea100 --- /dev/null +++ b/docs/acf-bukkit/help-doc.html @@ -0,0 +1,230 @@ + + + + + + +The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+Each annotation type has its own separate page with the following sections:
+Each enum has its own separate page with the following sections:
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+These links take you to the next or previous class, interface, package, or related page.
+These links show and hide the HTML frames. All pages are available with or without frames.
+The All Classes link shows all classes and interfaces except non-static nested types.
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+The Constant Field Values page lists the static final fields and their values.
+Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/index-all.html b/docs/acf-bukkit/index-all.html new file mode 100644 index 00000000..940edd03 --- /dev/null +++ b/docs/acf-bukkit/index-all.html @@ -0,0 +1,459 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/index.html b/docs/acf-bukkit/index.html new file mode 100644 index 00000000..aeec2bdc --- /dev/null +++ b/docs/acf-bukkit/index.html @@ -0,0 +1,76 @@ + + + + + + ++ + diff --git a/docs/acf-bukkit/overview-summary.html b/docs/acf-bukkit/overview-summary.html new file mode 100644 index 00000000..e4616eff --- /dev/null +++ b/docs/acf-bukkit/overview-summary.html @@ -0,0 +1,143 @@ + + + + + + +
| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| co.aikar.commands.contexts | ++ |
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/overview-tree.html b/docs/acf-bukkit/overview-tree.html new file mode 100644 index 00000000..ca7b5c4e --- /dev/null +++ b/docs/acf-bukkit/overview-tree.html @@ -0,0 +1,198 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bukkit/package-list b/docs/acf-bukkit/package-list new file mode 100644 index 00000000..105851a3 --- /dev/null +++ b/docs/acf-bukkit/package-list @@ -0,0 +1,2 @@ +co.aikar.commands +co.aikar.commands.contexts diff --git a/docs/script.js b/docs/acf-bukkit/script.js similarity index 100% rename from docs/script.js rename to docs/acf-bukkit/script.js diff --git a/docs/acf-bukkit/src-html/co/aikar/commands/ACFBukkitUtil.html b/docs/acf-bukkit/src-html/co/aikar/commands/ACFBukkitUtil.html new file mode 100644 index 00000000..79899202 --- /dev/null +++ b/docs/acf-bukkit/src-html/co/aikar/commands/ACFBukkitUtil.html @@ -0,0 +1,395 @@ + + + +001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import com.google.common.collect.Iterables; +027import org.bukkit.Bukkit; +028import org.bukkit.ChatColor; +029import org.bukkit.Location; +030import org.bukkit.Material; +031import org.bukkit.World; +032import org.bukkit.command.CommandSender; +033import org.bukkit.entity.Entity; +034import org.bukkit.entity.Player; +035import org.bukkit.inventory.ItemStack; +036import org.jetbrains.annotations.NotNull; +037 +038import java.util.ArrayList; +039import java.util.Iterator; +040import java.util.List; +041import java.util.Set; +042import java.util.regex.Pattern; +043import java.util.stream.Collectors; +044 +045public class ACFBukkitUtil { +046 +047 public static String formatLocation(Location loc) { +048 if (loc == null) { +049 return null; +050 } +051 return loc.getWorld().getName() + +052 ":" + +053 loc.getBlockX() + +054 "," + +055 loc.getBlockY() + +056 "," + +057 loc.getBlockZ(); +058 } +059 +060 public static String color(String message) { +061 return ChatColor.translateAlternateColorCodes('&', message); +062 } +063 +064 /** +065 * Move to Message Keys on the CommandIssuer +066 * @deprecated +067 */ +068 @Deprecated +069 public static void sendMsg(CommandSender player, String message) { +070 message = color(message); +071 for (String msg : ACFPatterns.NEWLINE.split(message)) { +072 player.sendMessage(msg); +073 } +074 } +075 +076 public static Location stringToLocation(String storedLoc) { +077 return stringToLocation(storedLoc, null); +078 } +079 public static Location stringToLocation(String storedLoc, World forcedWorld) { +080 if (storedLoc == null) { +081 return null; +082 } +083 String[] args = ACFPatterns.COLON.split(storedLoc); +084 if (args.length >= 4 || (args.length == 3 && forcedWorld != null)) { +085 String world = forcedWorld != null ? forcedWorld.getName() : args[0]; +086 int i = args.length == 3 ? 0 : 1; +087 double x = Double.parseDouble(args[i]); +088 double y = Double.parseDouble(args[i + 1]); +089 double z = Double.parseDouble(args[i + 2]); +090 Location loc = new Location(Bukkit.getWorld(world), x, y, z); +091 if (args.length >= 6) { +092 loc.setPitch(Float.parseFloat(args[4])); +093 loc.setYaw(Float.parseFloat(args[5])); +094 } +095 return loc; +096 } else if (args.length == 2) { +097 String[] args2 = ACFPatterns.COMMA.split(args[1]); +098 if (args2.length == 3) { +099 String world = forcedWorld != null ? forcedWorld.getName() : args[0]; +100 double x = Double.parseDouble(args2[0]); +101 double y = Double.parseDouble(args2[1]); +102 double z = Double.parseDouble(args2[2]); +103 return new Location(Bukkit.getWorld(world), x, y, z); +104 } +105 } +106 return null; +107 } +108 +109 public static String fullLocationToString(Location loc) { +110 if (loc == null) { +111 return null; +112 } +113 return (new StringBuilder(64)) +114 .append(loc.getWorld().getName()) +115 .append(':') +116 .append(ACFUtil.precision(loc.getX(), 4)) +117 .append(':') +118 .append(ACFUtil.precision(loc.getY(), 4)) +119 .append(':') +120 .append(ACFUtil.precision(loc.getZ(), 4)) +121 .append(':') +122 .append(ACFUtil.precision(loc.getPitch(), 4)) +123 .append(':') +124 .append(ACFUtil.precision(loc.getYaw(), 4)) +125 .toString(); +126 } +127 +128 public static String fullBlockLocationToString(Location loc) { +129 if (loc == null) { +130 return null; +131 } +132 return (new StringBuilder(64)) +133 .append(loc.getWorld().getName()) +134 .append(':') +135 .append(loc.getBlockX()) +136 .append(':') +137 .append(loc.getBlockY()) +138 .append(':') +139 .append(loc.getBlockZ()) +140 .append(':') +141 .append(ACFUtil.precision(loc.getPitch(), 4)) +142 .append(':') +143 .append(ACFUtil.precision(loc.getYaw(), 4)) +144 .toString(); +145 } +146 +147 public static String blockLocationToString(Location loc) { +148 if (loc == null) { +149 return null; +150 } +151 +152 return (new StringBuilder(32)) +153 .append(loc.getWorld().getName()) +154 .append(':') +155 .append(loc.getBlockX()) +156 .append(':') +157 .append(loc.getBlockY()) +158 .append(':') +159 .append(loc.getBlockZ()) +160 .toString(); +161 } +162 +163 public static double distance(@NotNull Entity e1, @NotNull Entity e2) { +164 return distance(e1.getLocation(), e2.getLocation()); +165 } +166 public static double distance2d(@NotNull Entity e1, @NotNull Entity e2) { +167 return distance2d(e1.getLocation(), e2.getLocation()); +168 } +169 public static double distance2d(@NotNull Location loc1, @NotNull Location loc2) { +170 loc1 = loc1.clone(); +171 loc1.setY(loc2.getY()); +172 return distance(loc1, loc2); +173 } +174 public static double distance(@NotNull Location loc1, @NotNull Location loc2) { +175 if (loc1.getWorld() != loc2.getWorld()) { +176 return 0; +177 } +178 return loc1.distance(loc2); +179 } +180 +181 public static Location getTargetLoc(Player player) { +182 return getTargetLoc(player, 128); +183 } +184 public static Location getTargetLoc(Player player, int maxDist) { +185 return getTargetLoc(player, maxDist, 1.5); +186 } +187 public static Location getTargetLoc(Player player, int maxDist, double addY) { +188 try { +189 Location target = player.getTargetBlock((Set<Material>) null, maxDist).getLocation(); +190 target.setY(target.getY() + addY); +191 return target; +192 } catch (Exception ignored) { +193 return null; +194 } +195 } +196 +197 public static Location getRandLoc(Location loc, int radius) { +198 return getRandLoc(loc, radius, radius, radius); +199 } +200 public static Location getRandLoc(Location loc, int xzRadius, int yRadius) { +201 return getRandLoc(loc, xzRadius, yRadius, xzRadius); +202 } +203 @NotNull public static Location getRandLoc(Location loc, int xRadius, int yRadius, int zRadius) { +204 Location newLoc = loc.clone(); +205 newLoc.setX(ACFUtil.rand(loc.getX()-xRadius, loc.getX()+xRadius)); +206 newLoc.setY(ACFUtil.rand(loc.getY()-yRadius, loc.getY()+yRadius)); +207 newLoc.setZ(ACFUtil.rand(loc.getZ()-zRadius, loc.getZ()+zRadius)); +208 return newLoc; +209 } +210 +211 +212 public static String removeColors(String msg) { +213 return ChatColor.stripColor(color(msg)); +214 } +215 +216 public static String replaceChatString(String message, String replace, String with) { +217 return replaceChatString(message, Pattern.compile(Pattern.quote(replace), Pattern.CASE_INSENSITIVE), with); +218 } +219 public static String replaceChatString(String message, Pattern replace, String with) { +220 final String[] split = replace.split(message + "1"); +221 +222 if (split.length < 2) { +223 return replace.matcher(message).replaceAll(with); +224 } +225 message = split[0]; +226 +227 for (int i = 1; i < split.length; i++) { +228 final String prev = ChatColor.getLastColors(message); +229 message += with + prev + split[i]; +230 } +231 return message.substring(0, message.length() - 1); +232 } +233 +234 public static boolean isWithinDistance(@NotNull Player p1, @NotNull Player p2, int dist) { +235 return isWithinDistance(p1.getLocation(), p2.getLocation(), dist); +236 } +237 public static boolean isWithinDistance(@NotNull Location loc1, @NotNull Location loc2, int dist) { +238 return loc1.getWorld() == loc2.getWorld() && loc1.distance(loc2) <= dist; +239 } +240 +241 /** +242 * Please move to the CommandIssuer version +243 * @deprecated +244 */ +245 public static Player findPlayerSmart(CommandSender requester, String search) { +246 CommandManager manager = CommandManager.getCurrentCommandManager(); +247 if (manager != null) { +248 return findPlayerSmart(manager.getCommandIssuer(requester), search); +249 } +250 throw new IllegalStateException("You may not use the ACFBukkitUtil#findPlayerSmart(CommandSender) async to the command execution."); +251 } +252 +253 public static Player findPlayerSmart(CommandIssuer issuer, String search) { +254 CommandSender requester = issuer.getIssuer(); +255 if (search == null) { +256 return null; +257 } +258 String name = ACFUtil.replace(search, ":confirm", ""); +259 if (name.length() < 3) { +260 issuer.sendError(MinecraftMessageKeys.USERNAME_TOO_SHORT); +261 return null; +262 } +263 if (!isValidName(name)) { +264 issuer.sendError(MinecraftMessageKeys.IS_NOT_A_VALID_NAME, "{name}", name); +265 return null; +266 } +267 +268 List<Player> matches = Bukkit.getServer().matchPlayer(name); +269 List<Player> confirmList = new ArrayList<>(); +270 findMatches(search, requester, matches, confirmList); +271 +272 +273 if (matches.size() > 1 || confirmList.size() > 1) { +274 String allMatches = matches.stream().map(Player::getName).collect(Collectors.joining(", ")); +275 issuer.sendError(MinecraftMessageKeys.MULTIPLE_PLAYERS_MATCH, +276 "{search}", name, "{all}", allMatches); +277 return null; +278 } +279 +280 //noinspection Duplicates +281 if (matches.isEmpty()) { +282 if (confirmList.isEmpty()) { +283 issuer.sendError(MinecraftMessageKeys.NO_PLAYER_FOUND_SERVER, +284 "{search}", name); +285 return null; +286 } else { +287 Player player = Iterables.getOnlyElement(confirmList); +288 issuer.sendInfo(MinecraftMessageKeys.PLAYER_IS_VANISHED_CONFIRM, "{vanished}", player.getName()); +289 return null; +290 } +291 } +292 +293 return matches.get(0); +294 } +295 +296 private static void findMatches(String search, CommandSender requester, List<Player> matches, List<Player> confirmList) { +297 // Remove vanished players from smart matching. +298 Iterator<Player> iter = matches.iterator(); +299 //noinspection Duplicates +300 while (iter.hasNext()) { +301 Player player = iter.next(); +302 if (requester instanceof Player && !((Player) requester).canSee(player)) { +303 if (requester.hasPermission("acf.seevanish")) { +304 if (!search.endsWith(":confirm")) { +305 confirmList.add(player); +306 iter.remove(); +307 } +308 } else { +309 iter.remove(); +310 } +311 } +312 } +313 } +314 +315 +316 public static boolean isValidName(String name) { +317 return name != null && !name.isEmpty() && ACFPatterns.VALID_NAME_PATTERN.matcher(name).matches(); +318 } +319 +320 static boolean isValidItem(ItemStack item) { +321 return item != null && item.getType() != Material.AIR && item.getAmount() > 0; +322 } +323} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import org.bukkit.command.CommandSender; +027 +028public class BukkitCommandCompletionContext extends CommandCompletionContext { +029 BukkitCommandCompletionContext(RegisteredCommand command, CommandIssuer issuer, String input, String config, String[] args) { +030 super(command, issuer, input, config, args); +031 } +032 +033 public CommandSender getSender() { +034 return this.getIssuer().getIssuer(); +035 } +036} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import org.apache.commons.lang.Validate; +027import org.bukkit.Bukkit; +028import org.bukkit.ChatColor; +029import org.bukkit.DyeColor; +030import org.bukkit.World; +031import org.bukkit.command.CommandSender; +032import org.bukkit.entity.EntityType; +033import org.bukkit.entity.Player; +034import org.bukkit.util.StringUtil; +035 +036import java.util.ArrayList; +037import java.util.Arrays; +038import java.util.Set; +039import java.util.stream.Collectors; +040import java.util.stream.Stream; +041 +042@SuppressWarnings("WeakerAccess") +043public class BukkitCommandCompletions extends CommandCompletions<BukkitCommandCompletionContext> { +044 public BukkitCommandCompletions(BukkitCommandManager manager) { +045 super(manager); +046 registerCompletion("mobs", c -> { +047 final Stream<String> normal = Stream.of(EntityType.values()) +048 .map(entityType -> ACFUtil.simplifyString(entityType.getName())); +049 return normal.collect(Collectors.toList()); +050 }); +051 registerCompletion("chatcolors", c -> { +052 Stream<ChatColor> colors = Stream.of(ChatColor.values()); +053 if (c.hasConfig("colorsonly")) { +054 colors = colors.filter(color -> color.ordinal() <= 0xF); +055 } +056 String filter = c.getConfig("filter"); +057 if (filter != null) { +058 Set<String> filters = Arrays.stream(ACFPatterns.COLON.split(filter)) +059 .map(ACFUtil::simplifyString).collect(Collectors.toSet()); +060 +061 colors = colors.filter(color -> filters.contains(ACFUtil.simplifyString(color.name()))); +062 } +063 +064 return colors.map(color -> ACFUtil.simplifyString(color.name())).collect(Collectors.toList()); +065 }); +066 registerCompletion("dyecolors", c -> ACFUtil.enumNames(DyeColor.values())); +067 registerCompletion("worlds", c -> ( +068 Bukkit.getWorlds().stream().map(World::getName).collect(Collectors.toList()) +069 )); +070 +071 registerCompletion("players", c -> { +072 CommandSender sender = c.getSender(); +073 Validate.notNull(sender, "Sender cannot be null"); +074 +075 Player senderPlayer = sender instanceof Player ? (Player) sender : null; +076 +077 ArrayList<String> matchedPlayers = new ArrayList<String>(); +078 for (Player player : Bukkit.getOnlinePlayers()) { +079 String name = player.getName(); +080 if ((senderPlayer == null || senderPlayer.canSee(player)) && StringUtil.startsWithIgnoreCase(name, c.getInput())) { +081 matchedPlayers.add(name); +082 } +083 } +084 +085 +086 matchedPlayers.sort(String.CASE_INSENSITIVE_ORDER); +087 return matchedPlayers; +088 }); +089 } +090 +091} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import co.aikar.commands.annotation.Optional; +027import co.aikar.commands.contexts.OnlinePlayer; +028import org.bukkit.Bukkit; +029import org.bukkit.ChatColor; +030import org.bukkit.Location; +031import org.bukkit.World; +032import org.bukkit.command.BlockCommandSender; +033import org.bukkit.command.CommandSender; +034import org.bukkit.entity.Entity; +035import org.bukkit.entity.Player; +036import org.bukkit.inventory.PlayerInventory; +037import org.jetbrains.annotations.Nullable; +038 +039import java.util.HashSet; +040import java.util.Set; +041import java.util.regex.Matcher; +042import java.util.regex.Pattern; +043import java.util.stream.Collectors; +044import java.util.stream.Stream; +045 +046@SuppressWarnings("WeakerAccess") +047public class BukkitCommandContexts extends CommandContexts<BukkitCommandExecutionContext> { +048 +049 public BukkitCommandContexts(BukkitCommandManager manager) { +050 super(manager); +051 +052 registerContext(OnlinePlayer.class, c -> getOnlinePlayer(c.getIssuer(), c.popFirstArg(), c.hasAnnotation(Optional.class))); +053 registerContext(OnlinePlayer[].class, (c) -> { +054 BukkitCommandIssuer issuer = c.getIssuer(); +055 final String search = c.popFirstArg(); +056 boolean allowMissing = c.hasFlag("allowmissing"); +057 Set<OnlinePlayer> players = new HashSet<>(); +058 Pattern split = ACFPatterns.COMMA; +059 String splitter = c.getFlagValue("splitter", (String) null); +060 if (splitter != null) { +061 split = Pattern.compile(Pattern.quote(splitter)); +062 } +063 for (String lookup : split.split(search)) { +064 OnlinePlayer player = getOnlinePlayer(issuer, lookup, allowMissing); +065 if (player != null) { +066 players.add(player); +067 } +068 } +069 if (players.isEmpty() && !c.hasFlag("allowempty")) { +070 issuer.sendError(MinecraftMessageKeys.NO_PLAYER_FOUND_SERVER, +071 "{search}", search); +072 +073 throw new InvalidCommandArgument(false); +074 } +075 return players.toArray(new OnlinePlayer[players.size()]); +076 }); +077 registerIssuerAwareContext(World.class, (c) -> { +078 String firstArg = c.getFirstArg(); +079 World world = firstArg != null ? Bukkit.getWorld(firstArg) : null; +080 if (world != null) { +081 c.popFirstArg(); +082 } +083 if (world == null && c.getSender() instanceof Player) { +084 world = ((Entity) c.getSender()).getWorld(); +085 } +086 if (world == null) { +087 throw new InvalidCommandArgument(MinecraftMessageKeys.INVALID_WORLD); +088 } +089 return world; +090 }); +091 registerIssuerAwareContext(CommandSender.class, BukkitCommandExecutionContext::getSender); +092 registerIssuerAwareContext(Player.class, (c) -> { +093 Player player = c.getSender() instanceof Player ? (Player) c.getSender() : null; +094 if (player == null && !c.hasAnnotation(Optional.class)) { +095 throw new InvalidCommandArgument(MessageKeys.NOT_ALLOWED_ON_CONSOLE, false); +096 } +097 PlayerInventory inventory = player != null ? player.getInventory() : null; +098 if (inventory != null && c.hasFlag("itemheld") && !ACFBukkitUtil.isValidItem(inventory.getItem(inventory.getHeldItemSlot()))) { +099 throw new InvalidCommandArgument(MinecraftMessageKeys.YOU_MUST_BE_HOLDING_ITEM, false); +100 } +101 return player; +102 }); +103 registerContext(ChatColor.class, c -> { +104 String first = c.popFirstArg(); +105 Stream<ChatColor> colors = Stream.of(ChatColor.values()); +106 if (c.hasFlag("colorsonly")) { +107 colors = colors.filter(color -> color.ordinal() <= 0xF); +108 } +109 String filter = c.getFlagValue("filter", (String) null); +110 if (filter != null) { +111 filter = ACFUtil.simplifyString(filter); +112 String finalFilter = filter; +113 colors = colors.filter(color -> finalFilter.equals(ACFUtil.simplifyString(color.name()))); +114 } +115 +116 ChatColor match = ACFUtil.simpleMatch(ChatColor.class, first); +117 if (match == null) { +118 String valid = colors +119 .map(color -> "<c2>" + ACFUtil.simplifyString(color.name()) + "</c2>") +120 .collect(Collectors.joining("<c1>,</c1> ")); +121 +122 throw new InvalidCommandArgument(MessageKeys.PLEASE_SPECIFY_ONE_OF, "{valid}", valid); +123 } +124 return match; +125 }); +126 registerContext(Location.class, c -> { +127 String input = c.popFirstArg(); +128 CommandSender sender = c.getSender(); +129 String[] split = ACFPatterns.COLON.split(input, 2); +130 if (split.length == 0) { +131 throw new InvalidCommandArgument(true); +132 } +133 if (split.length < 2 && !(sender instanceof Player) && !(sender instanceof BlockCommandSender)) { +134 throw new InvalidCommandArgument(MinecraftMessageKeys.LOCATION_PLEASE_SPECIFY_WORLD); +135 } +136 final String world; +137 final String rest; +138 Location sourceLoc = null; +139 if (split.length == 2) { +140 world = split[0]; +141 rest = split[1]; +142 } else if (sender instanceof Player) { +143 sourceLoc = ((Player) sender).getLocation(); +144 world = sourceLoc.getWorld().getName(); +145 rest = split[0]; +146 } else if (sender instanceof BlockCommandSender) { +147 sourceLoc = ((BlockCommandSender) sender).getBlock().getLocation(); +148 world = sourceLoc.getWorld().getName(); +149 rest = split[0]; +150 } else { +151 throw new InvalidCommandArgument(true); +152 } +153 +154 boolean rel = rest.startsWith("~"); +155 split = ACFPatterns.COMMA.split(rel ? rest.substring(1) : rest); +156 if (split.length < 3) { +157 throw new InvalidCommandArgument(MinecraftMessageKeys.LOCATION_PLEASE_SPECIFY_XYZ); +158 } +159 +160 Double x = ACFUtil.parseDouble(split[0]); +161 Double y = ACFUtil.parseDouble(split[1]); +162 Double z = ACFUtil.parseDouble(split[2]); +163 +164 if (sourceLoc != null && rel) { +165 x += sourceLoc.getX(); +166 y += sourceLoc.getY(); +167 z += sourceLoc.getZ(); +168 } else if (rel) { +169 throw new InvalidCommandArgument(MinecraftMessageKeys.LOCATION_CONSOLE_NOT_RELATIVE); +170 } +171 +172 if (x == null || y == null || z == null) { +173 throw new InvalidCommandArgument(MinecraftMessageKeys.LOCATION_PLEASE_SPECIFY_XYZ); +174 } +175 +176 World worldObj = Bukkit.getWorld(world); +177 if (worldObj == null) { +178 throw new InvalidCommandArgument(MinecraftMessageKeys.INVALID_WORLD); +179 } +180 +181 if (split.length >= 5) { +182 Float yaw = ACFUtil.parseFloat(split[3]); +183 Float pitch = ACFUtil.parseFloat(split[4]); +184 +185 if (pitch == null || yaw == null) { +186 throw new InvalidCommandArgument(MinecraftMessageKeys.LOCATION_PLEASE_SPECIFY_XYZ); +187 } +188 return new Location(worldObj, x, y, z, yaw, pitch); +189 } else { +190 return new Location(worldObj, x, y, z); +191 } +192 }); +193 Pattern versionPattern = Pattern.compile("\\(MC: (\\d)\\.(\\d+)\\.?.*?\\)"); +194 Matcher matcher = versionPattern.matcher(Bukkit.getVersion()); +195 if (matcher.find()) { +196 int mcMajorVersion = ACFUtil.parseInt(matcher.toMatchResult().group(1), 0); +197 int mcMinorVersion = ACFUtil.parseInt(matcher.toMatchResult().group(2), 0); +198 manager.log(LogLevel.INFO, "Minecraft Version: " + mcMajorVersion + "." + mcMinorVersion); +199 if (mcMajorVersion >= 1 && mcMinorVersion >= 12) { +200 BukkitCommandContexts_1_12.register(this); +201 } +202 } +203 } +204 +205 @Nullable +206 OnlinePlayer getOnlinePlayer(BukkitCommandIssuer issuer, String lookup, boolean allowMissing) throws InvalidCommandArgument { +207 Player player = ACFBukkitUtil.findPlayerSmart(issuer, lookup); +208 //noinspection Duplicates +209 if (player == null) { +210 if (allowMissing) { +211 return null; +212 } +213 throw new InvalidCommandArgument(false); +214 } +215 return new OnlinePlayer(player); +216 } +217} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import org.bukkit.command.CommandSender; +027 +028import java.lang.reflect.Parameter; +029import java.util.List; +030import java.util.Map; +031 +032public class BukkitCommandExecutionContext extends CommandExecutionContext<BukkitCommandExecutionContext, BukkitCommandIssuer> { +033 BukkitCommandExecutionContext(RegisteredCommand cmd, Parameter param, BukkitCommandIssuer sender, List<String> args, +034 int index, Map<String, Object> passedArgs) { +035 super(cmd, param, sender, args, index, passedArgs); +036 } +037 +038 public CommandSender getSender() { +039 return this.issuer.getIssuer(); +040 } +041} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import org.bukkit.ChatColor; +027import org.bukkit.command.CommandSender; +028import org.bukkit.entity.Player; +029 +030import java.util.Objects; +031 +032public class BukkitCommandIssuer implements CommandIssuer { +033 private final BukkitCommandManager manager; +034 private final CommandSender sender; +035 +036 BukkitCommandIssuer(BukkitCommandManager manager, CommandSender sender) { +037 this.manager = manager; +038 this.sender = sender; +039 } +040 +041 @Override +042 public boolean isPlayer() { +043 return sender instanceof Player; +044 } +045 +046 @Override +047 public <T> T getIssuer() { +048 //noinspection unchecked +049 return (T) sender; +050 } +051 +052 @Override +053 public CommandManager getManager() { +054 return manager; +055 } +056 +057 @Override +058 public void sendMessageInternal(String message) { +059 sender.sendMessage(ACFBukkitUtil.color(message)); +060 } +061 +062 @Override +063 public boolean hasPermission(String name) { +064 return sender.hasPermission(name); +065 } +066 +067 @Override +068 public boolean equals(Object o) { +069 if (this == o) return true; +070 if (o == null || getClass() != o.getClass()) return false; +071 BukkitCommandIssuer that = (BukkitCommandIssuer) o; +072 return Objects.equals(sender, that.sender); +073 } +074 +075 @Override +076 public int hashCode() { +077 return Objects.hash(sender); +078 } +079} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import co.aikar.commands.apachecommonslang.ApacheCommonsExceptionUtil; +027import co.aikar.timings.lib.MCTiming; +028import co.aikar.timings.lib.TimingManager; +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.event.EventHandler; +037import org.bukkit.event.Listener; +038import org.bukkit.event.server.PluginDisableEvent; +039import org.bukkit.plugin.Plugin; +040import org.jetbrains.annotations.NotNull; +041 +042import java.lang.reflect.Field; +043import java.lang.reflect.Method; +044import java.lang.reflect.Parameter; +045import java.util.HashMap; +046import java.util.List; +047import java.util.Map; +048import java.util.logging.Level; +049import java.util.logging.Logger; +050 +051@SuppressWarnings("WeakerAccess") +052public class BukkitCommandManager extends CommandManager<CommandSender, ChatColor, BukkitMessageFormatter> { +053 +054 @SuppressWarnings("WeakerAccess") +055 protected final Plugin plugin; +056 private final CommandMap commandMap; +057 private final TimingManager timingManager; +058 protected Map<String, Command> knownCommands = new HashMap<>(); +059 protected Map<String, BukkitRootCommand> registeredCommands = new HashMap<>(); +060 protected BukkitCommandContexts contexts; +061 protected BukkitCommandCompletions completions; +062 MCTiming commandTiming; +063 protected BukkitLocales locales; +064 +065 @SuppressWarnings("JavaReflectionMemberAccess") +066 public BukkitCommandManager(Plugin plugin) { +067 this.plugin = plugin; +068 this.timingManager = TimingManager.of(plugin); +069 this.commandTiming = this.timingManager.of("Commands"); +070 this.commandMap = hookCommandMap(); +071 this.formatters.put(MessageType.ERROR, defaultFormatter = new BukkitMessageFormatter(ChatColor.RED, ChatColor.YELLOW, ChatColor.RED)); +072 this.formatters.put(MessageType.SYNTAX, new BukkitMessageFormatter(ChatColor.YELLOW, ChatColor.GREEN, ChatColor.WHITE)); +073 this.formatters.put(MessageType.INFO, new BukkitMessageFormatter(ChatColor.BLUE, ChatColor.DARK_GREEN, ChatColor.GREEN)); +074 this.formatters.put(MessageType.HELP, new BukkitMessageFormatter(ChatColor.AQUA, ChatColor.GREEN, ChatColor.YELLOW)); +075 Bukkit.getPluginManager().registerEvents(new ACFBukkitListener(plugin), plugin); +076 getLocales(); // auto load locales +077 } +078 +079 @NotNull private CommandMap hookCommandMap() { +080 CommandMap commandMap = null; +081 try { +082 Server server = Bukkit.getServer(); +083 Method getCommandMap = server.getClass().getDeclaredMethod("getCommandMap"); +084 getCommandMap.setAccessible(true); +085 commandMap = (CommandMap) getCommandMap.invoke(server); +086 if (!SimpleCommandMap.class.isAssignableFrom(commandMap.getClass())) { +087 this.log(LogLevel.ERROR, "ERROR: CommandMap has been hijacked! Offending command map is located at: " + commandMap.getClass().getName()); +088 this.log(LogLevel.ERROR, "We are going to try to hijack it back and resolve this, but you are now in dangerous territory."); +089 this.log(LogLevel.ERROR, "We can not guarantee things are going to work."); +090 Field cmField = server.getClass().getDeclaredField("commandMap"); +091 commandMap = new ProxyCommandMap(this, commandMap); +092 cmField.set(server, commandMap); +093 this.log(LogLevel.INFO, "Injected Proxy Command Map... good luck..."); +094 } +095 Field knownCommands = SimpleCommandMap.class.getDeclaredField("knownCommands"); +096 knownCommands.setAccessible(true); +097 //noinspection unchecked +098 this.knownCommands = (Map<String, Command>) knownCommands.get(commandMap); +099 } catch (Exception e) { +100 this.log(LogLevel.ERROR, "Failed to get Command Map. ACF will not function."); +101 ACFUtil.sneaky(e); +102 } +103 return commandMap; +104 } +105 +106 public Plugin getPlugin() { +107 return this.plugin; +108 } +109 +110 @Override +111 public boolean isCommandIssuer(Class<?> type) { +112 return CommandSender.class.isAssignableFrom(type); +113 } +114 +115 @Override +116 public synchronized CommandContexts<BukkitCommandExecutionContext> getCommandContexts() { +117 if (this.contexts == null) { +118 this.contexts = new BukkitCommandContexts(this); +119 } +120 return contexts; +121 } +122 +123 @Override +124 public synchronized CommandCompletions<BukkitCommandCompletionContext> getCommandCompletions() { +125 if (this.completions == null) { +126 this.completions = new BukkitCommandCompletions(this); +127 } +128 return completions; +129 } +130 +131 +132 @Override +133 public BukkitLocales getLocales() { +134 if (this.locales == null) { +135 this.locales = new BukkitLocales(this); +136 this.locales.loadLanguages(); +137 } +138 return locales; +139 } +140 +141 +142 @Override +143 public boolean hasRegisteredCommands() { +144 return !registeredCommands.isEmpty(); +145 } +146 +147 public void registerCommand(BaseCommand command, boolean force) { +148 final String plugin = this.plugin.getName().toLowerCase(); +149 command.onRegister(this); +150 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) { +151 String commandName = entry.getKey().toLowerCase(); +152 BukkitRootCommand bukkitCommand = (BukkitRootCommand) entry.getValue(); +153 if (!bukkitCommand.isRegistered) { +154 if (force && knownCommands.containsKey(commandName)) { +155 Command oldCommand = commandMap.getCommand(commandName); +156 knownCommands.remove(commandName); +157 for (Map.Entry<String, Command> ce : knownCommands.entrySet()) { +158 String key = ce.getKey(); +159 Command value = ce.getValue(); +160 if (key.contains(":") && oldCommand.equals(value)) { +161 String[] split = ACFPatterns.COLON.split(key, 2); +162 if (split.length > 1) { +163 oldCommand.unregister(commandMap); +164 oldCommand.setLabel(split[0] + ":" + command.getName()); +165 oldCommand.register(commandMap); +166 } +167 } +168 } +169 } +170 commandMap.register(commandName, plugin, bukkitCommand); +171 } +172 bukkitCommand.isRegistered = true; +173 registeredCommands.put(commandName, bukkitCommand); +174 } +175 } +176 +177 @Override +178 public void registerCommand(BaseCommand command) { +179 registerCommand(command, false); +180 } +181 +182 public void unregisterCommand(BaseCommand command) { +183 for (RootCommand rootcommand : command.registeredCommands.values()) { +184 BukkitRootCommand bukkitCommand = (BukkitRootCommand) rootcommand; +185 bukkitCommand.getSubCommands().values().removeAll(command.subCommands.values()); +186 if (bukkitCommand.isRegistered && bukkitCommand.getSubCommands().isEmpty()) { +187 unregisterCommand(bukkitCommand); +188 bukkitCommand.isRegistered = false; +189 } +190 } +191 } +192 +193 /** +194 * @deprecated Use unregisterCommand(BaseCommand) - this will be visibility reduced later. +195 * @param command +196 */ +197 @Deprecated +198 public void unregisterCommand(BukkitRootCommand command) { +199 final String plugin = this.plugin.getName().toLowerCase(); +200 command.unregister(commandMap); +201 String key = command.getName(); +202 Command registered = knownCommands.get(key); +203 if (command.equals(registered)) { +204 knownCommands.remove(key); +205 } +206 knownCommands.remove(plugin + ":" + key); +207 } +208 +209 public void unregisterCommands() { +210 for (Map.Entry<String, BukkitRootCommand> entry : registeredCommands.entrySet()) { +211 unregisterCommand(entry.getValue()); +212 } +213 this.registeredCommands.clear(); +214 } +215 +216 private class ACFBukkitListener implements Listener { +217 private final Plugin plugin; +218 +219 public ACFBukkitListener(Plugin plugin) { +220 this.plugin = plugin; +221 } +222 +223 @EventHandler +224 public void onPluginDisable(PluginDisableEvent event) { +225 if (!(plugin.getName().equalsIgnoreCase(event.getPlugin().getName()))) { +226 return; +227 } +228 unregisterCommands(); +229 } +230 } +231 +232 public TimingManager getTimings() { +233 return timingManager; +234 } +235 +236 @Override +237 public RootCommand createRootCommand(String cmd) { +238 return new BukkitRootCommand(this, cmd); +239 } +240 +241 @Override +242 public CommandIssuer getCommandIssuer(Object issuer) { +243 if (!(issuer instanceof CommandSender)) { +244 throw new IllegalArgumentException(issuer.getClass().getName() + " is not a Command Issuer."); +245 } +246 return new BukkitCommandIssuer(this, (CommandSender) issuer); +247 } +248 +249 @Override +250 public <R extends CommandExecutionContext> R createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs) { +251 //noinspection unchecked +252 return (R) new BukkitCommandExecutionContext(command, parameter, (BukkitCommandIssuer) sender, args, i, passedArgs); +253 } +254 +255 @Override +256 public CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args) { +257 return new BukkitCommandCompletionContext(command, sender, input, config, args); +258 } +259 +260 @Override +261 public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) { +262 return new BukkitRegisteredCommand(command, cmdName, method, prefSubCommand); +263 } +264 +265 @Override +266 public void log(LogLevel level, String message, Throwable throwable) { +267 Logger logger = this.plugin.getLogger(); +268 Level logLevel = level == LogLevel.INFO ? Level.INFO : Level.SEVERE; +269 logger.log(logLevel, LogLevel.LOG_PREFIX + message); +270 if (throwable != null) { +271 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) { +272 logger.log(logLevel, LogLevel.LOG_PREFIX + line); +273 } +274 } +275 } +276} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import co.aikar.locales.MessageKey; +027import org.bukkit.configuration.ConfigurationSection; +028import org.bukkit.configuration.InvalidConfigurationException; +029import org.bukkit.configuration.file.FileConfiguration; +030import org.bukkit.configuration.file.YamlConfiguration; +031 +032import java.io.File; +033import java.io.IOException; +034import java.util.Locale; +035 +036public class BukkitLocales extends Locales { +037 private final BukkitCommandManager manager; +038 +039 public BukkitLocales(BukkitCommandManager manager) { +040 super(manager); +041 this.manager = manager; +042 } +043 +044 @Override +045 public void loadLanguages() { +046 super.loadLanguages(); +047 String pluginName = "acf-" + manager.plugin.getDescription().getName(); +048 addMessageBundles("acf-minecraft", pluginName, pluginName.toLowerCase()); +049 } +050 +051 /** +052 * Loads the given file +053 * @param file +054 * @param locale +055 * @return If any language keys were added +056 * @throws IOException +057 * @throws InvalidConfigurationException +058 */ +059 public boolean loadYamlLanguageFile(File file, Locale locale) throws IOException, InvalidConfigurationException { +060 YamlConfiguration yamlConfiguration = new YamlConfiguration(); +061 yamlConfiguration.load(file); +062 return loadLanguage(yamlConfiguration, locale); +063 } +064 +065 /** +066 * Loads a file out of the plugins data folder by the given name +067 * @param file +068 * @param locale +069 * @return If any language keys were added +070 * @throws IOException +071 * @throws InvalidConfigurationException +072 */ +073 public boolean loadYamlLanguageFile(String file, Locale locale) throws IOException, InvalidConfigurationException { +074 YamlConfiguration yamlConfiguration = new YamlConfiguration(); +075 yamlConfiguration.load(new File(this.manager.plugin.getDataFolder(), file)); +076 return loadLanguage(yamlConfiguration, locale); +077 } +078 +079 /** +080 * Loads every message from the Configuration object. Any nested values will be treated as namespace +081 * so acf-core:\n\tfoo: bar will be acf-core.foo = bar +082 * @param config +083 * @param locale +084 * @return If any language keys were added +085 */ +086 public boolean loadLanguage(FileConfiguration config, Locale locale) { +087 boolean loaded = false; +088 for (String parentKey : config.getKeys(false)) { +089 ConfigurationSection inner = config.getConfigurationSection(parentKey); +090 if (inner == null) { +091 continue; +092 } +093 for (String key : inner.getKeys(false)) { +094 String value = inner.getString(key); +095 if (value != null && !value.isEmpty()) { +096 addMessage(locale, MessageKey.of(parentKey + "." + key), value); +097 loaded = true; +098 } +099 } +100 } +101 +102 return loaded; +103 } +104} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import org.bukkit.ChatColor; +027 +028public class BukkitMessageFormatter extends MessageFormatter<ChatColor> { +029 +030 public BukkitMessageFormatter(ChatColor... colors) { +031 super(colors); +032 } +033 +034 @Override +035 String format(ChatColor color, String message) { +036 return color + message; +037 } +038} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import co.aikar.timings.lib.MCTiming; +027import co.aikar.timings.lib.TimingManager; +028 +029import java.lang.reflect.Method; +030 +031public class BukkitRegisteredCommand extends RegisteredCommand<BukkitCommandExecutionContext> { +032 private final MCTiming timing; +033 BukkitRegisteredCommand(BaseCommand scope, String command, Method method, String prefSubCommand) { +034 super(scope, command, method, prefSubCommand); +035 BukkitCommandManager manager = (BukkitCommandManager) scope.manager; +036 this.timing = manager.getTimings().of("Command: " + this.command, manager.commandTiming); +037 } +038 +039 +040 @Override +041 public void preCommand() { +042 timing.startTiming(); +043 super.preCommand(); +044 } +045 +046 @Override +047 public void postCommand() { +048 super.postCommand(); +049 timing.stopTiming(); +050 } +051} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import com.google.common.collect.HashMultimap; +027import com.google.common.collect.SetMultimap; +028import org.bukkit.command.Command; +029import org.bukkit.command.CommandSender; +030 +031import java.util.ArrayList; +032import java.util.HashSet; +033import java.util.List; +034import java.util.Set; +035 +036public class BukkitRootCommand extends Command implements RootCommand { +037 +038 private final BukkitCommandManager manager; +039 private final String name; +040 private BaseCommand defCommand; +041 private SetMultimap<String, RegisteredCommand> subCommands = HashMultimap.create(); +042 private List<BaseCommand> children = new ArrayList<>(); +043 boolean isRegistered = false; +044 +045 BukkitRootCommand(BukkitCommandManager manager, String name) { +046 super(name); +047 this.manager = manager; +048 this.name = name; +049 } +050 +051 @Override +052 public String getCommandName() { +053 return name; +054 } +055 +056 @Override +057 public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { +058 return tabComplete(manager.getCommandIssuer(sender), alias, args); +059 } +060 +061 @Override +062 public boolean execute(CommandSender sender, String commandLabel, String[] args) { +063 execute(manager.getCommandIssuer(sender), commandLabel, args); +064 return true; +065 } +066 +067 private List<String> tabComplete(CommandIssuer sender, String alias, String[] args) throws IllegalArgumentException { +068 Set<String> completions = new HashSet<>(); +069 this.children.forEach(child -> completions.addAll(child.tabComplete(sender, alias, args))); +070 return new ArrayList<>(completions); +071 } +072 +073 +074 +075 public void addChild(BaseCommand command) { +076 if (this.defCommand == null || !command.subCommands.get("__default").isEmpty()) { +077 this.defCommand = command; +078 this.setPermission(command.permission); +079 //this.setDescription(command.getDescription()); +080 //this.setUsage(command.getUsage()); +081 } +082 addChildShared(this.children, this.subCommands, command); +083 } +084 +085 @Override +086 public CommandManager getManager() { +087 return manager; +088 } +089 +090 @Override +091 public SetMultimap<String, RegisteredCommand> getSubCommands() { +092 return this.subCommands; +093 } +094 +095 @Override +096 public BaseCommand getDefCommand(){ +097 return defCommand; +098 } +099} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import co.aikar.locales.MessageKey; +027import co.aikar.locales.MessageKeyProvider; +028 +029public enum MinecraftMessageKeys implements MessageKeyProvider { +030 INVALID_WORLD, +031 YOU_MUST_BE_HOLDING_ITEM, +032 PLAYER_IS_VANISHED_CONFIRM, +033 USERNAME_TOO_SHORT, +034 IS_NOT_A_VALID_NAME, +035 MULTIPLE_PLAYERS_MATCH, +036 NO_PLAYER_FOUND_SERVER, +037 NO_PLAYER_FOUND, +038 LOCATION_PLEASE_SPECIFY_WORLD, +039 LOCATION_PLEASE_SPECIFY_XYZ, +040 LOCATION_CONSOLE_NOT_RELATIVE; +041 +042 private final MessageKey key = MessageKey.of("acf-minecraft." + this.name().toLowerCase()); +043 public MessageKey getMessageKey() { +044 return key; +045 } +046} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands.contexts; +025 +026import org.bukkit.entity.Player; +027 +028import java.util.Objects; +029 +030public class OnlinePlayer { +031 public final Player player; +032 +033 public OnlinePlayer(Player player) { +034 this.player = player; +035 } +036 +037 public Player getPlayer() { +038 return this.player; +039 } +040 +041 @Override +042 public boolean equals(Object o) { +043 if (this == o) return true; +044 if (o == null || getClass() != o.getClass()) return false; +045 OnlinePlayer that = (OnlinePlayer) o; +046 return Objects.equals(player, that.player); +047 } +048 +049 @Override +050 public int hashCode() { +051 return Objects.hash(player); +052 } +053 +054 @Override +055 public String toString() { +056 return "OnlinePlayer{" + +057 "player=" + player + +058 '}'; +059 } +060} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
public class ACFBungeeUtil +extends Object+
| Modifier and Type | +Field and Description | +
|---|---|
static char |
+COLOR_CHAR |
+
| Constructor and Description | +
|---|
ACFBungeeUtil() |
+
| Modifier and Type | +Method and Description | +
|---|---|
static String |
+color(String message) |
+
static net.md_5.bungee.api.connection.ProxiedPlayer |
+findPlayerSmart(co.aikar.commands.CommandIssuer issuer,
+ String search) |
+
static net.md_5.bungee.api.connection.ProxiedPlayer |
+findPlayerSmart(net.md_5.bungee.api.CommandSender requester,
+ String search)
+Deprecated.
+ |
+
static String |
+getLastColors(String input) |
+
static boolean |
+isChatColorAColor(net.md_5.bungee.api.ChatColor chatColor) |
+
static boolean |
+isValidName(String name) |
+
static String |
+removeColors(String msg) |
+
static String |
+replaceChatString(String message,
+ Pattern replace,
+ String with) |
+
static String |
+replaceChatString(String message,
+ String replace,
+ String with) |
+
static void |
+sendMsg(net.md_5.bungee.api.CommandSender player,
+ String message)
+Deprecated.
+ |
+
static <T> T |
+validate(T object,
+ String message,
+ Object... values) |
+
public static final char COLOR_CHAR+
public ACFBungeeUtil()+
@Deprecated +public static void sendMsg(net.md_5.bungee.api.CommandSender player, + String message)+
public static String removeColors(String msg)+
public static String replaceChatString(String message, + String replace, + String with)+
public static String replaceChatString(String message, + Pattern replace, + String with)+
public static String getLastColors(String input)+
public static boolean isChatColorAColor(net.md_5.bungee.api.ChatColor chatColor)+
public static net.md_5.bungee.api.connection.ProxiedPlayer findPlayerSmart(co.aikar.commands.CommandIssuer issuer, + String search)+
public static net.md_5.bungee.api.connection.ProxiedPlayer findPlayerSmart(net.md_5.bungee.api.CommandSender requester, + String search)+
public static boolean isValidName(String name)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/BungeeCommandCompletionContext.html b/docs/acf-bungee/co/aikar/commands/BungeeCommandCompletionContext.html new file mode 100644 index 00000000..2e6f42d8 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/BungeeCommandCompletionContext.html @@ -0,0 +1,265 @@ + + + + + + +public class BungeeCommandCompletionContext +extends co.aikar.commands.CommandCompletionContext+
issuer| Modifier and Type | +Method and Description | +
|---|---|
net.md_5.bungee.api.CommandSender |
+getSender() |
+
getConfig, getConfig, getConfig, getConfigs, getContextValue, getContextValue, getInput, getIssuer, hasConfigCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/BungeeCommandCompletions.html b/docs/acf-bungee/co/aikar/commands/BungeeCommandCompletions.html new file mode 100644 index 00000000..aa071753 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/BungeeCommandCompletions.html @@ -0,0 +1,265 @@ + + + + + + +public class BungeeCommandCompletions +extends co.aikar.commands.CommandCompletions<BungeeCommandCompletionContext>+
co.aikar.commands.CommandCompletions.CommandCompletionHandler<C extends co.aikar.commands.CommandCompletionContext>| Constructor and Description | +
|---|
BungeeCommandCompletions(co.aikar.commands.CommandManager manager) |
+
public BungeeCommandCompletions(co.aikar.commands.CommandManager manager)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/BungeeCommandContexts.html b/docs/acf-bungee/co/aikar/commands/BungeeCommandContexts.html new file mode 100644 index 00000000..d9d9e737 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/BungeeCommandContexts.html @@ -0,0 +1,225 @@ + + + + + + +public class BungeeCommandContexts +extends co.aikar.commands.CommandContexts<BungeeCommandExecutionContext>+
contextMap, managerCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/BungeeCommandExecutionContext.html b/docs/acf-bungee/co/aikar/commands/BungeeCommandExecutionContext.html new file mode 100644 index 00000000..7f5788d1 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/BungeeCommandExecutionContext.html @@ -0,0 +1,265 @@ + + + + + + +public class BungeeCommandExecutionContext +extends co.aikar.commands.CommandExecutionContext<BungeeCommandExecutionContext,BungeeCommandIssuer>+
issuer| Modifier and Type | +Method and Description | +
|---|---|
net.md_5.bungee.api.CommandSender |
+getSender() |
+
canOverridePlayerContext, getAnnotation, getArgs, getCmd, getFirstArg, getFlags, getFlagValue, getFlagValue, getIndex, getIssuer, getLastArg, getNumParams, getParam, getPassedArgs, getResolvedArg, getResolvedArg, getResolvedArg, hasAnnotation, hasFlag, isLastArg, isOptional, joinArgs, joinArgs, popFirstArg, popLastArgCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/BungeeCommandIssuer.html b/docs/acf-bungee/co/aikar/commands/BungeeCommandIssuer.html new file mode 100644 index 00000000..6416fd79 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/BungeeCommandIssuer.html @@ -0,0 +1,356 @@ + + + + + + +public class BungeeCommandIssuer +extends Object +implements co.aikar.commands.CommandIssuer+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+equals(Object o) |
+
<T> T |
+getIssuer() |
+
co.aikar.commands.CommandManager |
+getManager() |
+
int |
+hashCode() |
+
boolean |
+hasPermission(String name) |
+
boolean |
+isPlayer() |
+
void |
+sendMessageInternal(String message) |
+
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitsendError, sendError, sendInfo, sendInfo, sendMessage, sendMessage, sendMessage, sendSyntax, sendSyntaxpublic <T> T getIssuer()+
getIssuer in interface co.aikar.commands.CommandIssuerpublic co.aikar.commands.CommandManager getManager()+
getManager in interface co.aikar.commands.CommandIssuerpublic boolean isPlayer()+
isPlayer in interface co.aikar.commands.CommandIssuerpublic void sendMessageInternal(String message)+
sendMessageInternal in interface co.aikar.commands.CommandIssuerpublic boolean hasPermission(String name)+
hasPermission in interface co.aikar.commands.CommandIssuerCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/BungeeCommandManager.html b/docs/acf-bungee/co/aikar/commands/BungeeCommandManager.html new file mode 100644 index 00000000..c30c66e4 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/BungeeCommandManager.html @@ -0,0 +1,650 @@ + + + + + + +public class BungeeCommandManager +extends co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter>+
| Modifier and Type | +Field and Description | +
|---|---|
protected BungeeCommandCompletions |
+completions |
+
protected BungeeCommandContexts |
+contexts |
+
protected BungeeLocales |
+locales |
+
protected net.md_5.bungee.api.plugin.Plugin |
+plugin |
+
protected Map<String,BungeeRootCommand> |
+registeredCommands |
+
defaultExceptionHandler, defaultFormatter, formatters, replacements, rootCommands, supportedLanguages| Constructor and Description | +
|---|
BungeeCommandManager(net.md_5.bungee.api.plugin.Plugin plugin) |
+
| Modifier and Type | +Method and Description | +
|---|---|
<R extends co.aikar.commands.CommandExecutionContext> |
+createCommandContext(co.aikar.commands.RegisteredCommand command,
+ Parameter parameter,
+ co.aikar.commands.CommandIssuer sender,
+ List<String> args,
+ int i,
+ Map<String,Object> passedArgs) |
+
co.aikar.commands.CommandCompletionContext |
+createCompletionContext(co.aikar.commands.RegisteredCommand command,
+ co.aikar.commands.CommandIssuer sender,
+ String input,
+ String config,
+ String[] args) |
+
co.aikar.commands.RegisteredCommand |
+createRegisteredCommand(co.aikar.commands.BaseCommand command,
+ String cmdName,
+ Method method,
+ String prefSubCommand) |
+
co.aikar.commands.RootCommand |
+createRootCommand(String cmd) |
+
co.aikar.commands.CommandCompletions<BungeeCommandCompletionContext> |
+getCommandCompletions() |
+
co.aikar.commands.CommandContexts<BungeeCommandExecutionContext> |
+getCommandContexts() |
+
co.aikar.commands.CommandIssuer |
+getCommandIssuer(Object issuer) |
+
BungeeLocales |
+getLocales() |
+
net.md_5.bungee.api.plugin.Plugin |
+getPlugin() |
+
boolean |
+hasRegisteredCommands() |
+
boolean |
+isCommandIssuer(Class<?> aClass) |
+
void |
+log(co.aikar.commands.LogLevel level,
+ String message,
+ Throwable throwable) |
+
void |
+registerCommand(co.aikar.commands.BaseCommand command) |
+
void |
+unregisterCommand(co.aikar.commands.BaseCommand command) |
+
void |
+unregisterCommand(BungeeRootCommand command) |
+
void |
+unregisterCommands() |
+
addSupportedLanguage, createCommandOperationContext, enableUnstableAPI, formatMessage, generateCommandHelp, generateCommandHelp, generateCommandHelp, generateCommandHelp, getCommandReplacements, getCurrentCommandIssuer, getCurrentCommandManager, getCurrentCommandOperationContext, getDefaultExceptionHandler, getDefaultFormatter, getFormat, getIssuerLocale, getSupportedLanguages, handleUncaughtException, hasPermission, log, obtainRootCommand, sendMessage, sendMessage, setDefaultExceptionHandler, setDefaultFormatter, setFormat, setFormat, setFormatprotected final net.md_5.bungee.api.plugin.Plugin plugin+
protected Map<String,BungeeRootCommand> registeredCommands+
protected BungeeCommandContexts contexts+
protected BungeeCommandCompletions completions+
protected BungeeLocales locales+
public BungeeCommandManager(net.md_5.bungee.api.plugin.Plugin plugin)+
public net.md_5.bungee.api.plugin.Plugin getPlugin()+
public co.aikar.commands.CommandContexts<BungeeCommandExecutionContext> getCommandContexts()+
getCommandContexts in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter>public co.aikar.commands.CommandCompletions<BungeeCommandCompletionContext> getCommandCompletions()+
getCommandCompletions in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter>public BungeeLocales getLocales()+
getLocales in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter>public void registerCommand(co.aikar.commands.BaseCommand command)+
registerCommand in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter>public void unregisterCommand(co.aikar.commands.BaseCommand command)+
public void unregisterCommand(BungeeRootCommand command)+
public void unregisterCommands()+
public boolean hasRegisteredCommands()+
hasRegisteredCommands in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter>public boolean isCommandIssuer(Class<?> aClass)+
isCommandIssuer in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter>public co.aikar.commands.CommandIssuer getCommandIssuer(Object issuer)+
getCommandIssuer in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter>public co.aikar.commands.RootCommand createRootCommand(String cmd)+
createRootCommand in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter>public <R extends co.aikar.commands.CommandExecutionContext> R createCommandContext(co.aikar.commands.RegisteredCommand command, + Parameter parameter, + co.aikar.commands.CommandIssuer sender, + List<String> args, + int i, + Map<String,Object> passedArgs)+
createCommandContext in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter>public co.aikar.commands.CommandCompletionContext createCompletionContext(co.aikar.commands.RegisteredCommand command, + co.aikar.commands.CommandIssuer sender, + String input, + String config, + String[] args)+
createCompletionContext in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter>public co.aikar.commands.RegisteredCommand createRegisteredCommand(co.aikar.commands.BaseCommand command, + String cmdName, + Method method, + String prefSubCommand)+
createRegisteredCommand in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter>public void log(co.aikar.commands.LogLevel level, + String message, + Throwable throwable)+
log in class co.aikar.commands.CommandManager<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.ChatColor,BungeeMessageFormatter>Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/BungeeLocales.html b/docs/acf-bungee/co/aikar/commands/BungeeLocales.html new file mode 100644 index 00000000..01bd4898 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/BungeeLocales.html @@ -0,0 +1,303 @@ + + + + + + +public class BungeeLocales +extends co.aikar.commands.Locales+
AFRIKAANS, ARABIC, BULGARIAN, CHINESE, CZECH, DANISH, DUTCH, ENGLISH, FINNISH, FRENCH, GERMAN, GREEK, HEBREW, HINDI, ITALIAN, JAPANESE, KOREAN, LATIN, POLISH, PORTUGUESE, ROMANIAN, RUSSIAN, SIMPLIFIED_CHINESE, SPANISH, SWEDISH, THAI, TRADITIONAL_CHINESE, TURKISH, UKRANIAN, VIETNAMESE, WELSH| Constructor and Description | +
|---|
BungeeLocales(BungeeCommandManager manager) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+loadLanguages() |
+
addMessage, addMessageBundle, addMessageBundles, addMessages, addMessageStrings, getDefaultLocale, getMessage, loadMissingBundles, replaceI18NStrings, setDefaultLocalepublic BungeeLocales(BungeeCommandManager manager)+
public void loadLanguages()+
loadLanguages in class co.aikar.commands.LocalesCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/BungeeMessageFormatter.html b/docs/acf-bungee/co/aikar/commands/BungeeMessageFormatter.html new file mode 100644 index 00000000..6b3e57d9 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/BungeeMessageFormatter.html @@ -0,0 +1,250 @@ + + + + + + +public class BungeeMessageFormatter +extends co.aikar.commands.MessageFormatter<net.md_5.bungee.api.ChatColor>+
| Constructor and Description | +
|---|
BungeeMessageFormatter(net.md_5.bungee.api.ChatColor... colors) |
+
public BungeeMessageFormatter(net.md_5.bungee.api.ChatColor... colors)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/BungeeRegisteredCommand.html b/docs/acf-bungee/co/aikar/commands/BungeeRegisteredCommand.html new file mode 100644 index 00000000..13455c30 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/BungeeRegisteredCommand.html @@ -0,0 +1,271 @@ + + + + + + +public class BungeeRegisteredCommand +extends co.aikar.commands.RegisteredCommand<BungeeCommandExecutionContext>+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+postCommand() |
+
void |
+preCommand() |
+
addSubcommand, addSubcommands, getCommand, getPermission, getPrefSubCommand, getSyntaxTextpublic void preCommand()+
preCommand in class co.aikar.commands.RegisteredCommand<BungeeCommandExecutionContext>public void postCommand()+
postCommand in class co.aikar.commands.RegisteredCommand<BungeeCommandExecutionContext>Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/BungeeRootCommand.html b/docs/acf-bungee/co/aikar/commands/BungeeRootCommand.html new file mode 100644 index 00000000..f9b48c8d --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/BungeeRootCommand.html @@ -0,0 +1,379 @@ + + + + + + +public class BungeeRootCommand +extends net.md_5.bungee.api.plugin.Command +implements net.md_5.bungee.api.plugin.TabExecutor+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+addChild(co.aikar.commands.BaseCommand command) |
+
default void |
+addChildShared(List<co.aikar.commands.BaseCommand> arg0,
+ com.google.common.collect.SetMultimap<String,co.aikar.commands.RegisteredCommand> arg1,
+ co.aikar.commands.BaseCommand arg2) |
+
default co.aikar.commands.BaseCommand |
+execute(co.aikar.commands.CommandIssuer arg0,
+ String arg1,
+ String[] arg2) |
+
void |
+execute(net.md_5.bungee.api.CommandSender sender,
+ String[] args) |
+
String |
+getCommandName() |
+
co.aikar.commands.BaseCommand |
+getDefCommand() |
+
co.aikar.commands.CommandManager |
+getManager() |
+
com.google.common.collect.SetMultimap<String,co.aikar.commands.RegisteredCommand> |
+getSubCommands() |
+
Iterable<String> |
+onTabComplete(net.md_5.bungee.api.CommandSender commandSender,
+ String[] strings) |
+
canEqual, equals, getAliases, getName, getPermission, hashCode, toStringpublic String getCommandName()+
public void addChild(co.aikar.commands.BaseCommand command)+
public co.aikar.commands.CommandManager getManager()+
public com.google.common.collect.SetMultimap<String,co.aikar.commands.RegisteredCommand> getSubCommands()+
public void execute(net.md_5.bungee.api.CommandSender sender, + String[] args)+
execute in class net.md_5.bungee.api.plugin.Commandpublic Iterable<String> onTabComplete(net.md_5.bungee.api.CommandSender commandSender, + String[] strings)+
onTabComplete in interface net.md_5.bungee.api.plugin.TabExecutorpublic co.aikar.commands.BaseCommand getDefCommand()+
public void addChildShared(List<co.aikar.commands.BaseCommand> arg0, + com.google.common.collect.SetMultimap<String,co.aikar.commands.RegisteredCommand> arg1, + co.aikar.commands.BaseCommand arg2)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/MinecraftMessageKeys.html b/docs/acf-bungee/co/aikar/commands/MinecraftMessageKeys.html new file mode 100644 index 00000000..83113358 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/MinecraftMessageKeys.html @@ -0,0 +1,396 @@ + + + + + + +public enum MinecraftMessageKeys +extends Enum<MinecraftMessageKeys> +implements co.aikar.locales.MessageKeyProvider+
| Enum Constant and Description | +
|---|
IS_NOT_A_VALID_NAME |
+
MULTIPLE_PLAYERS_MATCH |
+
NO_PLAYER_FOUND |
+
NO_PLAYER_FOUND_SERVER |
+
USERNAME_TOO_SHORT |
+
| Modifier and Type | +Method and Description | +
|---|---|
co.aikar.locales.MessageKey |
+getMessageKey() |
+
static MinecraftMessageKeys |
+valueOf(String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static MinecraftMessageKeys[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
public static final MinecraftMessageKeys USERNAME_TOO_SHORT+
public static final MinecraftMessageKeys IS_NOT_A_VALID_NAME+
public static final MinecraftMessageKeys MULTIPLE_PLAYERS_MATCH+
public static final MinecraftMessageKeys NO_PLAYER_FOUND_SERVER+
public static final MinecraftMessageKeys NO_PLAYER_FOUND+
public static MinecraftMessageKeys[] values()+
+for (MinecraftMessageKeys c : MinecraftMessageKeys.values()) + System.out.println(c); +
public static MinecraftMessageKeys valueOf(String name)+
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic co.aikar.locales.MessageKey getMessageKey()+
getMessageKey in interface co.aikar.locales.MessageKeyProviderCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/class-use/ACFBungeeUtil.html b/docs/acf-bungee/co/aikar/commands/class-use/ACFBungeeUtil.html new file mode 100644 index 00000000..e5996f16 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/class-use/ACFBungeeUtil.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandCompletionContext.html b/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandCompletionContext.html new file mode 100644 index 00000000..d6021f20 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandCompletionContext.html @@ -0,0 +1,165 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
co.aikar.commands.CommandCompletions<BungeeCommandCompletionContext> |
+BungeeCommandManager.getCommandCompletions() |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandCompletions.html b/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandCompletions.html new file mode 100644 index 00000000..37d94955 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandCompletions.html @@ -0,0 +1,165 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
protected BungeeCommandCompletions |
+BungeeCommandManager.completions |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandContexts.html b/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandContexts.html new file mode 100644 index 00000000..5f2adb92 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandContexts.html @@ -0,0 +1,165 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
protected BungeeCommandContexts |
+BungeeCommandManager.contexts |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandExecutionContext.html b/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandExecutionContext.html new file mode 100644 index 00000000..d3b12023 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandExecutionContext.html @@ -0,0 +1,165 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
co.aikar.commands.CommandContexts<BungeeCommandExecutionContext> |
+BungeeCommandManager.getCommandContexts() |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandIssuer.html b/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandIssuer.html new file mode 100644 index 00000000..47557c6e --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandIssuer.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. 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 new file mode 100644 index 00000000..0a2b2a9f --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/class-use/BungeeCommandManager.html @@ -0,0 +1,163 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Constructor and Description | +
|---|
BungeeLocales(BungeeCommandManager manager) |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/class-use/BungeeLocales.html b/docs/acf-bungee/co/aikar/commands/class-use/BungeeLocales.html new file mode 100644 index 00000000..40bfe393 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/class-use/BungeeLocales.html @@ -0,0 +1,178 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
protected BungeeLocales |
+BungeeCommandManager.locales |
+
| Modifier and Type | +Method and Description | +
|---|---|
BungeeLocales |
+BungeeCommandManager.getLocales() |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/class-use/BungeeMessageFormatter.html b/docs/acf-bungee/co/aikar/commands/class-use/BungeeMessageFormatter.html new file mode 100644 index 00000000..0a558cd9 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/class-use/BungeeMessageFormatter.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/class-use/BungeeRegisteredCommand.html b/docs/acf-bungee/co/aikar/commands/class-use/BungeeRegisteredCommand.html new file mode 100644 index 00000000..1a20a3b6 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/class-use/BungeeRegisteredCommand.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/class-use/BungeeRootCommand.html b/docs/acf-bungee/co/aikar/commands/class-use/BungeeRootCommand.html new file mode 100644 index 00000000..0ec99a34 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/class-use/BungeeRootCommand.html @@ -0,0 +1,178 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
protected Map<String,BungeeRootCommand> |
+BungeeCommandManager.registeredCommands |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+BungeeCommandManager.unregisterCommand(BungeeRootCommand command) |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/class-use/MinecraftMessageKeys.html b/docs/acf-bungee/co/aikar/commands/class-use/MinecraftMessageKeys.html new file mode 100644 index 00000000..bd0e98a6 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/class-use/MinecraftMessageKeys.html @@ -0,0 +1,174 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
static MinecraftMessageKeys |
+MinecraftMessageKeys.valueOf(String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static MinecraftMessageKeys[] |
+MinecraftMessageKeys.values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/contexts/OnlineProxiedPlayer.html b/docs/acf-bungee/co/aikar/commands/contexts/OnlineProxiedPlayer.html new file mode 100644 index 00000000..d9a92d14 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/contexts/OnlineProxiedPlayer.html @@ -0,0 +1,359 @@ + + + + + + +public class OnlineProxiedPlayer +extends Object+
| Modifier and Type | +Field and Description | +
|---|---|
net.md_5.bungee.api.connection.ProxiedPlayer |
+player |
+
| Constructor and Description | +
|---|
OnlineProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer player) |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+equals(Object o) |
+
net.md_5.bungee.api.connection.ProxiedPlayer |
+getPlayer() |
+
int |
+hashCode() |
+
String |
+toString() |
+
public final net.md_5.bungee.api.connection.ProxiedPlayer player+
public OnlineProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer player)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/contexts/class-use/OnlineProxiedPlayer.html b/docs/acf-bungee/co/aikar/commands/contexts/class-use/OnlineProxiedPlayer.html new file mode 100644 index 00000000..7e0d63c4 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/contexts/class-use/OnlineProxiedPlayer.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/contexts/package-frame.html b/docs/acf-bungee/co/aikar/commands/contexts/package-frame.html new file mode 100644 index 00000000..4ff16c7b --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/contexts/package-frame.html @@ -0,0 +1,20 @@ + + + + + + +| Class | +Description | +
|---|---|
| OnlineProxiedPlayer | ++ |
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/contexts/package-tree.html b/docs/acf-bungee/co/aikar/commands/contexts/package-tree.html new file mode 100644 index 00000000..2a39c08c --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/contexts/package-tree.html @@ -0,0 +1,138 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/contexts/package-use.html b/docs/acf-bungee/co/aikar/commands/contexts/package-use.html new file mode 100644 index 00000000..c9e61a2f --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/contexts/package-use.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/package-frame.html b/docs/acf-bungee/co/aikar/commands/package-frame.html new file mode 100644 index 00000000..7324df54 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/package-frame.html @@ -0,0 +1,34 @@ + + + + + + +| Class | +Description | +
|---|---|
| ACFBungeeUtil | ++ |
| BungeeCommandCompletionContext | ++ |
| BungeeCommandCompletions | ++ |
| BungeeCommandContexts | ++ |
| BungeeCommandExecutionContext | ++ |
| BungeeCommandIssuer | ++ |
| BungeeCommandManager | ++ |
| BungeeLocales | ++ |
| BungeeMessageFormatter | ++ |
| BungeeRegisteredCommand | ++ |
| BungeeRootCommand | ++ |
| Enum | +Description | +
|---|---|
| MinecraftMessageKeys | ++ |
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/package-tree.html b/docs/acf-bungee/co/aikar/commands/package-tree.html new file mode 100644 index 00000000..c32ccc95 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/package-tree.html @@ -0,0 +1,196 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/co/aikar/commands/package-use.html b/docs/acf-bungee/co/aikar/commands/package-use.html new file mode 100644 index 00000000..aa2ecd73 --- /dev/null +++ b/docs/acf-bungee/co/aikar/commands/package-use.html @@ -0,0 +1,179 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Class and Description | +
|---|
| BungeeCommandCompletionContext | +
| BungeeCommandCompletions | +
| BungeeCommandContexts | +
| BungeeCommandExecutionContext | +
| BungeeCommandManager | +
| BungeeLocales | +
| BungeeRootCommand | +
| MinecraftMessageKeys | +
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/constant-values.html b/docs/acf-bungee/constant-values.html new file mode 100644 index 00000000..aa289860 --- /dev/null +++ b/docs/acf-bungee/constant-values.html @@ -0,0 +1,154 @@ + + + + + + +| Modifier and Type | +Constant Field | +Value | +
|---|---|---|
+
+public static final char |
+COLOR_CHAR |
+167 |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/deprecated-list.html b/docs/acf-bungee/deprecated-list.html new file mode 100644 index 00000000..14873e3c --- /dev/null +++ b/docs/acf-bungee/deprecated-list.html @@ -0,0 +1,150 @@ + + + + + + +| Method and Description | +
|---|
| co.aikar.commands.ACFBungeeUtil.findPlayerSmart(CommandSender, String) | +
| co.aikar.commands.ACFBungeeUtil.sendMsg(CommandSender, String) | +
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/help-doc.html b/docs/acf-bungee/help-doc.html new file mode 100644 index 00000000..6c3b0c6d --- /dev/null +++ b/docs/acf-bungee/help-doc.html @@ -0,0 +1,230 @@ + + + + + + +The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+Each annotation type has its own separate page with the following sections:
+Each enum has its own separate page with the following sections:
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+These links take you to the next or previous class, interface, package, or related page.
+These links show and hide the HTML frames. All pages are available with or without frames.
+The All Classes link shows all classes and interfaces except non-static nested types.
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+The Constant Field Values page lists the static final fields and their values.
+Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/index-all.html b/docs/acf-bungee/index-all.html new file mode 100644 index 00000000..c717dbae --- /dev/null +++ b/docs/acf-bungee/index-all.html @@ -0,0 +1,395 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/index.html b/docs/acf-bungee/index.html new file mode 100644 index 00000000..a41c21f8 --- /dev/null +++ b/docs/acf-bungee/index.html @@ -0,0 +1,76 @@ + + + + + + +This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to Non-frame version.
++ + diff --git a/docs/acf-bungee/overview-summary.html b/docs/acf-bungee/overview-summary.html new file mode 100644 index 00000000..70f7750d --- /dev/null +++ b/docs/acf-bungee/overview-summary.html @@ -0,0 +1,143 @@ + + + + + + +
| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| co.aikar.commands.contexts | ++ |
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/overview-tree.html b/docs/acf-bungee/overview-tree.html new file mode 100644 index 00000000..7394e535 --- /dev/null +++ b/docs/acf-bungee/overview-tree.html @@ -0,0 +1,198 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-bungee/package-list b/docs/acf-bungee/package-list new file mode 100644 index 00000000..105851a3 --- /dev/null +++ b/docs/acf-bungee/package-list @@ -0,0 +1,2 @@ +co.aikar.commands +co.aikar.commands.contexts diff --git a/docs/acf-bungee/script.js b/docs/acf-bungee/script.js new file mode 100644 index 00000000..b3463569 --- /dev/null +++ b/docs/acf-bungee/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/docs/acf-bungee/src-html/co/aikar/commands/ACFBungeeUtil.html b/docs/acf-bungee/src-html/co/aikar/commands/ACFBungeeUtil.html new file mode 100644 index 00000000..79b7ec4b --- /dev/null +++ b/docs/acf-bungee/src-html/co/aikar/commands/ACFBungeeUtil.html @@ -0,0 +1,238 @@ + + + +001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import net.md_5.bungee.api.ChatColor; +027import net.md_5.bungee.api.CommandSender; +028import net.md_5.bungee.api.ProxyServer; +029import net.md_5.bungee.api.connection.ProxiedPlayer; +030 +031import java.util.ArrayList; +032import java.util.List; +033import java.util.regex.Pattern; +034import java.util.stream.Collectors; +035 +036public class ACFBungeeUtil { +037 +038 public static String color(String message) { +039 return ChatColor.translateAlternateColorCodes('&', message); +040 } +041 +042 /** +043 * Move to Message Keys on the CommandIssuer +044 * @deprecated +045 */ +046 @Deprecated +047 public static void sendMsg(CommandSender player, String message) { +048 message = color(message); +049 for (String msg : ACFPatterns.NEWLINE.split(message)) { +050 player.sendMessage(msg); +051 } +052 } +053 +054 public static String removeColors(String msg) { +055 return ChatColor.stripColor(color(msg)); +056 } +057 +058 public static String replaceChatString(String message, String replace, String with) { +059 return replaceChatString(message, Pattern.compile(Pattern.quote(replace), Pattern.CASE_INSENSITIVE), with); +060 } +061 +062 public static String replaceChatString(String message, Pattern replace, String with) { +063 final String[] split = replace.split(message + "1"); +064 +065 if (split.length < 2) { +066 return replace.matcher(message).replaceAll(with); +067 } +068 message = split[0]; +069 +070 for (int i = 1; i < split.length; i++) { +071 final String prev = getLastColors(message); +072 message += with + prev + split[i]; +073 } +074 return message.substring(0, message.length() - 1); +075 } +076 +077 //Imported from org.bukkit.ChatColor +078 +079 public static final char COLOR_CHAR = '\u00A7'; +080 +081 public static String getLastColors(String input) { +082 String result = ""; +083 int length = input.length(); +084 +085 // Search backwards from the end as it is faster +086 for (int index = length - 1; index > -1; index--) { +087 char section = input.charAt(index); +088 if (section == COLOR_CHAR && index < length - 1) { +089 char c = input.charAt(index + 1); +090 ChatColor color = ChatColor.getByChar(c); +091 +092 if (color != null) { +093 result = color.toString() + result; +094 +095 // Once we find a color or reset we can stop searching +096 if (isChatColorAColor(color) || color.equals(ChatColor.RESET)) { +097 break; +098 } +099 } +100 } +101 } +102 return result; +103 } +104 +105 public static boolean isChatColorAColor(ChatColor chatColor) { +106 return chatColor != ChatColor.MAGIC && chatColor != ChatColor.BOLD +107 && chatColor != ChatColor.STRIKETHROUGH && chatColor != ChatColor.UNDERLINE +108 && chatColor != ChatColor.ITALIC; +109 } +110 +111 +112 public static ProxiedPlayer findPlayerSmart(CommandIssuer issuer, String search) { +113 CommandSender requester = issuer.getIssuer(); +114 String name = ACFUtil.replace(search, ":confirm", ""); +115 if (name.length() < 3) { +116 issuer.sendError(MinecraftMessageKeys.USERNAME_TOO_SHORT); +117 return null; +118 } +119 if (!isValidName(name)) { +120 issuer.sendError(MinecraftMessageKeys.IS_NOT_A_VALID_NAME, "{name}", name); +121 return null; +122 } +123 +124 List<ProxiedPlayer> matches = new ArrayList<>(ProxyServer.getInstance().matchPlayer(name)); +125 +126 if (matches.size() > 1) { +127 String allMatches = matches.stream().map(ProxiedPlayer::getName).collect(Collectors.joining(", ")); +128 issuer.sendError(MinecraftMessageKeys.MULTIPLE_PLAYERS_MATCH, +129 "{search}", name, "{all}", allMatches); +130 return null; +131 } +132 +133 if (matches.isEmpty()) { +134 issuer.sendError(MinecraftMessageKeys.NO_PLAYER_FOUND_SERVER, +135 "{search}", name); +136 return null; +137 } +138 +139 return matches.get(0); +140 } +141 +142 /** +143 * Please move to the CommandIssuer version +144 * @deprecated +145 */ +146 public static ProxiedPlayer findPlayerSmart(CommandSender requester, String search) { +147 CommandManager manager = CommandManager.getCurrentCommandManager(); +148 if (manager != null) { +149 return findPlayerSmart(manager.getCommandIssuer(requester), search); +150 } +151 throw new IllegalStateException("You may not use the ACFBungeeUtil#findPlayerSmart(CommandSender) async to the command execution."); +152 } +153 +154 public static boolean isValidName(String name) { +155 return name != null && !name.isEmpty() && ACFPatterns.VALID_NAME_PATTERN.matcher(name).matches(); +156 } +157 +158 public static <T> T validate(T object, String message, Object... values) { +159 if (object == null) { +160 throw new NullPointerException(String.format(message, values)); +161 } +162 return object; +163 } +164 +165 +166} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import net.md_5.bungee.api.CommandSender; +027 +028public class BungeeCommandCompletionContext extends CommandCompletionContext { +029 +030 BungeeCommandCompletionContext(RegisteredCommand command, CommandIssuer issuer, String input, String config, String[] args) { +031 super(command, issuer, input, config, args); +032 } +033 +034 public CommandSender getSender() { +035 return this.getIssuer().getIssuer(); +036 } +037} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import co.aikar.commands.apachecommonslang.ApacheCommonsLangUtil; +027import net.md_5.bungee.api.ChatColor; +028import net.md_5.bungee.api.CommandSender; +029import net.md_5.bungee.api.ProxyServer; +030import net.md_5.bungee.api.connection.ProxiedPlayer; +031 +032import java.util.ArrayList; +033import java.util.Arrays; +034import java.util.Set; +035import java.util.stream.Collectors; +036import java.util.stream.Stream; +037 +038public class BungeeCommandCompletions extends CommandCompletions<BungeeCommandCompletionContext> { +039 +040 public BungeeCommandCompletions(CommandManager manager) { +041 super(manager); +042 registerCompletion("chatcolors", c -> { +043 Stream<ChatColor> colors = Stream.of(ChatColor.values()); +044 if (c.hasConfig("colorsonly")) { +045 colors = colors.filter(color -> color.ordinal() <= 0xF); +046 } +047 String filter = c.getConfig("filter"); +048 if (filter != null) { +049 Set<String> filters = Arrays.stream(ACFPatterns.COLON.split(filter)) +050 .map(ACFUtil::simplifyString).collect(Collectors.toSet()); +051 +052 colors = colors.filter(color -> filters.contains(ACFUtil.simplifyString(color.name()))); +053 } +054 +055 return colors.map(color -> ACFUtil.simplifyString(color.name())).collect(Collectors.toList()); +056 }); +057 registerCompletion("players", c -> { +058 CommandSender sender = c.getSender(); +059 ACFBungeeUtil.validate(sender, "Sender cannot be null"); +060 String input = c.getInput(); +061 +062 ArrayList<String> matchedPlayers = new ArrayList<>(); +063 for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) { +064 String name = player.getName(); +065 if (ApacheCommonsLangUtil.startsWithIgnoreCase(name, input)) { +066 matchedPlayers.add(name); +067 } +068 } +069 +070 matchedPlayers.sort(String.CASE_INSENSITIVE_ORDER); +071 return matchedPlayers; +072 }); +073 } +074} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026 +027import co.aikar.commands.annotation.Optional; +028import co.aikar.commands.contexts.OnlineProxiedPlayer; +029import net.md_5.bungee.api.ChatColor; +030import net.md_5.bungee.api.CommandSender; +031import net.md_5.bungee.api.connection.ProxiedPlayer; +032 +033import java.util.stream.Collectors; +034import java.util.stream.Stream; +035 +036public class BungeeCommandContexts extends CommandContexts<BungeeCommandExecutionContext> { +037 +038 BungeeCommandContexts(CommandManager manager) { +039 super(manager); +040 registerContext(OnlineProxiedPlayer.class, (c) -> { +041 ProxiedPlayer proxiedPlayer = ACFBungeeUtil.findPlayerSmart(c.getIssuer(), c.popFirstArg()); +042 if (proxiedPlayer == null) { +043 if (c.hasAnnotation(Optional.class)) { +044 return null; +045 } +046 throw new InvalidCommandArgument(false); +047 } +048 return new OnlineProxiedPlayer(proxiedPlayer); +049 }); +050 registerIssuerAwareContext(CommandSender.class, BungeeCommandExecutionContext::getSender); +051 registerIssuerAwareContext(ProxiedPlayer.class, (c) -> { +052 ProxiedPlayer proxiedPlayer = c.getSender() instanceof ProxiedPlayer ? (ProxiedPlayer) c.getSender() : null; +053 if (proxiedPlayer == null && !c.hasAnnotation(Optional.class)) { +054 throw new InvalidCommandArgument(MessageKeys.NOT_ALLOWED_ON_CONSOLE, false); +055 } +056 return proxiedPlayer; +057 }); +058 +059 registerContext(ChatColor.class, c -> { +060 String first = c.popFirstArg(); +061 Stream<ChatColor> colors = Stream.of(ChatColor.values()); +062 if (c.hasFlag("colorsonly")) { +063 colors = colors.filter(color -> color.ordinal() <= 0xF); +064 } +065 String filter = c.getFlagValue("filter", (String) null); +066 if (filter != null) { +067 filter = ACFUtil.simplifyString(filter); +068 String finalFilter = filter; +069 colors = colors.filter(color -> finalFilter.equals(ACFUtil.simplifyString(color.name()))); +070 } +071 +072 ChatColor match = ACFUtil.simpleMatch(ChatColor.class, first); +073 if (match == null) { +074 String valid = colors +075 .map(color -> "<c2>" + ACFUtil.simplifyString(color.name()) + "</c2>") +076 .collect(Collectors.joining("<c1>,</c1> ")); +077 +078 throw new InvalidCommandArgument(MessageKeys.PLEASE_SPECIFY_ONE_OF, "{valid}", valid); +079 } +080 return match; +081 }); +082 } +083} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import net.md_5.bungee.api.CommandSender; +027 +028import java.lang.reflect.Parameter; +029import java.util.List; +030import java.util.Map; +031 +032public class BungeeCommandExecutionContext extends CommandExecutionContext<BungeeCommandExecutionContext, BungeeCommandIssuer> { +033 +034 BungeeCommandExecutionContext(RegisteredCommand cmd, Parameter param, BungeeCommandIssuer sender, List<String> args, int index, Map<String, Object> passedArgs) { +035 super(cmd, param, sender, args, index, passedArgs); +036 } +037 +038 public CommandSender getSender() { +039 return this.issuer.getIssuer(); +040 } +041} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import net.md_5.bungee.api.CommandSender; +027import net.md_5.bungee.api.chat.TextComponent; +028import net.md_5.bungee.api.connection.ProxiedPlayer; +029 +030import java.util.Objects; +031 +032public class BungeeCommandIssuer implements CommandIssuer{ +033 private final BungeeCommandManager manager; +034 private final CommandSender sender; +035 +036 BungeeCommandIssuer(BungeeCommandManager manager, CommandSender sender) { +037 this.manager = manager; +038 this.sender = sender; +039 } +040 +041 +042 @Override +043 public <T> T getIssuer() { +044 //noinspection unchecked +045 return (T) sender; +046 } +047 +048 @Override +049 public CommandManager getManager() { +050 return manager; +051 } +052 +053 @Override +054 public boolean isPlayer() { +055 return sender instanceof ProxiedPlayer; +056 } +057 +058 @Override +059 public void sendMessageInternal(String message) { +060 sender.sendMessage(ACFBungeeUtil.color(message)); +061 } +062 +063 @Override +064 public boolean hasPermission(String name) { +065 return sender.hasPermission(name); +066 } +067 +068 +069 @Override +070 public boolean equals(Object o) { +071 if (this == o) return true; +072 if (o == null || getClass() != o.getClass()) return false; +073 BungeeCommandIssuer that = (BungeeCommandIssuer) o; +074 return Objects.equals(sender, that.sender); +075 } +076 +077 @Override +078 public int hashCode() { +079 return Objects.hash(sender); +080 } +081} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import co.aikar.commands.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.List; +034import java.util.Map; +035import java.util.HashMap; +036import java.util.logging.Level; +037import java.util.logging.Logger; +038 +039public class BungeeCommandManager extends CommandManager<CommandSender, ChatColor, BungeeMessageFormatter> { +040 +041 protected final Plugin plugin; +042 protected Map<String, BungeeRootCommand> registeredCommands = new HashMap<>(); +043 protected BungeeCommandContexts contexts; +044 protected BungeeCommandCompletions completions; +045 protected BungeeLocales locales; +046 +047 public BungeeCommandManager(Plugin plugin) { +048 this.plugin = plugin; +049 this.formatters.put(MessageType.ERROR, defaultFormatter = new BungeeMessageFormatter(ChatColor.RED, ChatColor.YELLOW, ChatColor.RED)); +050 this.formatters.put(MessageType.SYNTAX, new BungeeMessageFormatter(ChatColor.YELLOW, ChatColor.GREEN, ChatColor.WHITE)); +051 this.formatters.put(MessageType.INFO, new BungeeMessageFormatter(ChatColor.BLUE, ChatColor.DARK_GREEN, ChatColor.GREEN)); +052 this.formatters.put(MessageType.HELP, new BungeeMessageFormatter(ChatColor.AQUA, ChatColor.GREEN, ChatColor.YELLOW)); +053 getLocales(); // auto load locales +054 } +055 +056 public Plugin getPlugin() { +057 return this.plugin; +058 } +059 +060 @Override +061 public synchronized CommandContexts<BungeeCommandExecutionContext> getCommandContexts() { +062 if (this.contexts == null) { +063 this.contexts = new BungeeCommandContexts(this); +064 } +065 return contexts; +066 } +067 +068 @Override +069 public synchronized CommandCompletions<BungeeCommandCompletionContext> getCommandCompletions() { +070 if (this.completions == null) { +071 this.completions = new BungeeCommandCompletions(this); +072 } +073 return completions; +074 } +075 +076 @Override +077 public BungeeLocales getLocales() { +078 if (this.locales == null) { +079 this.locales = new BungeeLocales(this); +080 this.locales.loadLanguages(); +081 } +082 return locales; +083 } +084 +085 +086 @Override +087 public void registerCommand(BaseCommand command) { +088 command.onRegister(this); +089 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) { +090 String commandName = entry.getKey().toLowerCase(); +091 BungeeRootCommand bungeeCommand = (BungeeRootCommand) entry.getValue(); +092 if (!bungeeCommand.isRegistered) { +093 this.plugin.getProxy().getPluginManager().registerCommand(this.plugin, bungeeCommand); +094 } +095 bungeeCommand.isRegistered = true; +096 registeredCommands.put(commandName, bungeeCommand); +097 } +098 } +099 +100 public void unregisterCommand(BaseCommand command) { +101 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) { +102 String commandName = entry.getKey().toLowerCase(); +103 BungeeRootCommand bungeeCommand = (BungeeRootCommand) entry.getValue(); +104 bungeeCommand.getSubCommands().values().removeAll(command.subCommands.values()); +105 if (bungeeCommand.getSubCommands().isEmpty() && bungeeCommand.isRegistered) { +106 unregisterCommand(bungeeCommand); +107 bungeeCommand.isRegistered = false; +108 registeredCommands.remove(commandName); +109 } +110 } +111 } +112 +113 public void unregisterCommand(BungeeRootCommand command) { +114 this.plugin.getProxy().getPluginManager().unregisterCommand(command); +115 } +116 +117 public void unregisterCommands() { +118 for (Map.Entry<String, BungeeRootCommand> entry : registeredCommands.entrySet()) { +119 unregisterCommand(entry.getValue()); +120 } +121 } +122 +123 @Override +124 public boolean hasRegisteredCommands() { +125 return !registeredCommands.isEmpty(); +126 } +127 +128 @Override +129 public boolean isCommandIssuer(Class<?> aClass) { +130 return CommandSender.class.isAssignableFrom(aClass); +131 } +132 +133 @Override +134 public CommandIssuer getCommandIssuer(Object issuer) { +135 if (!(issuer instanceof CommandSender)) { +136 throw new IllegalArgumentException(issuer.getClass().getName() + " is not a Command Issuer."); +137 } +138 return new BungeeCommandIssuer(this, (CommandSender) issuer); +139 } +140 +141 @Override +142 public RootCommand createRootCommand(String cmd) { +143 return new BungeeRootCommand(this, cmd); +144 } +145 +146 @Override +147 public <R extends CommandExecutionContext> R createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs) { +148 //noinspection unchecked +149 return (R) new BungeeCommandExecutionContext(command, parameter, (BungeeCommandIssuer) sender, args, i, passedArgs); +150 } +151 +152 @Override +153 public CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args) { +154 return new BungeeCommandCompletionContext(command, sender, input, config, args); +155 } +156 +157 @Override +158 public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) { +159 return new RegisteredCommand(command, cmdName, method, prefSubCommand); +160 } +161 +162 @Override +163 public void log(LogLevel level, String message, Throwable throwable) { +164 Logger logger = this.plugin.getLogger(); +165 Level logLevel = level == LogLevel.INFO ? Level.INFO : Level.SEVERE; +166 logger.log(logLevel, LogLevel.LOG_PREFIX + message); +167 if (throwable != null) { +168 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) { +169 logger.log(logLevel, LogLevel.LOG_PREFIX + line); +170 } +171 } +172 } +173} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001package co.aikar.commands; +002 +003public class BungeeLocales extends Locales { +004 private final BungeeCommandManager manager; +005 +006 public BungeeLocales(BungeeCommandManager manager) { +007 super(manager); +008 +009 this.manager = manager; +010 } +011 +012 @Override +013 public void loadLanguages() { +014 super.loadLanguages(); +015 String pluginName = "acf-" + manager.plugin.getDescription().getName(); +016 addMessageBundles("acf-minecraft", pluginName, pluginName.toLowerCase()); +017 } +018} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001package co.aikar.commands; +002 +003import net.md_5.bungee.api.ChatColor; +004 +005public class BungeeMessageFormatter extends MessageFormatter<ChatColor> { +006 +007 public BungeeMessageFormatter(ChatColor... colors) { +008 super(colors); +009 } +010 +011 @Override +012 String format(ChatColor color, String message) { +013 return color + message; +014 } +015} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import java.lang.reflect.Method; +027 +028public class BungeeRegisteredCommand extends RegisteredCommand<BungeeCommandExecutionContext> { +029 +030 BungeeRegisteredCommand(BaseCommand scope, String command, Method method, String prefSubCommand) { +031 super(scope, command, method, prefSubCommand); +032 } +033 +034 @Override +035 public void preCommand() { +036 super.preCommand(); +037 } +038 +039 @Override +040 public void postCommand() { +041 super.postCommand(); +042 } +043} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import com.google.common.collect.HashMultimap; +027import com.google.common.collect.SetMultimap; +028import net.md_5.bungee.api.CommandSender; +029import net.md_5.bungee.api.plugin.Command; +030import net.md_5.bungee.api.plugin.TabExecutor; +031 +032import java.util.List; +033import java.util.ArrayList; +034import java.util.Set; +035import java.util.HashSet; +036 +037public class BungeeRootCommand extends Command implements RootCommand, TabExecutor { +038 +039 private final BungeeCommandManager manager; +040 private final String name; +041 private BaseCommand defCommand; +042 private SetMultimap<String, RegisteredCommand> subCommands = HashMultimap.create(); +043 private List<BaseCommand> children = new ArrayList<>(); +044 boolean isRegistered = false; +045 +046 BungeeRootCommand(BungeeCommandManager manager, String name) { +047 super(name); +048 this.manager = manager; +049 this.name = name; +050 } +051 +052 @Override +053 public String getCommandName() { +054 return name; +055 } +056 +057 @Override +058 public void addChild(BaseCommand command) { +059 if (this.defCommand == null || !command.subCommands.get("__default").isEmpty()) { +060 this.defCommand = command; +061 +062 } +063 this.addChildShared(this.children, this.subCommands, command); +064 } +065 +066 @Override +067 public CommandManager getManager() { +068 return manager; +069 } +070 +071 @Override +072 public SetMultimap<String, RegisteredCommand> getSubCommands() { +073 return subCommands; +074 } +075 +076 @Override +077 public void execute(CommandSender sender, String[] args) { +078 execute(manager.getCommandIssuer(sender), getName(), args); +079 } +080 +081 @Override +082 public Iterable<String> onTabComplete(CommandSender commandSender, String[] strings) { +083 return onTabComplete(manager.getCommandIssuer(commandSender), getName(), strings); +084 } +085 +086 private List<String> onTabComplete(CommandIssuer sender, String alias, String[] args) throws IllegalArgumentException { +087 Set<String> completions = new HashSet<>(); +088 this.children.forEach(child -> completions.addAll(child.tabComplete(sender, alias, args))); +089 return new ArrayList<>(completions); +090 } +091 +092 @Override +093 public BaseCommand getDefCommand() { +094 return defCommand; +095 } +096} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001package co.aikar.commands; +002 +003import co.aikar.locales.MessageKey; +004import co.aikar.locales.MessageKeyProvider; +005 +006public enum MinecraftMessageKeys implements MessageKeyProvider { +007 USERNAME_TOO_SHORT, +008 IS_NOT_A_VALID_NAME, +009 MULTIPLE_PLAYERS_MATCH, +010 NO_PLAYER_FOUND_SERVER, +011 NO_PLAYER_FOUND +012 ; +013 +014 private final MessageKey key = MessageKey.of("acf-minecraft." + this.name().toLowerCase()); +015 public MessageKey getMessageKey() { +016 return key; +017 } +018} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands.contexts; +025 +026import net.md_5.bungee.api.connection.ProxiedPlayer; +027 +028import java.util.Objects; +029 +030public class OnlineProxiedPlayer { +031 +032 public final ProxiedPlayer player; +033 +034 public OnlineProxiedPlayer(ProxiedPlayer player) { +035 this.player = player; +036 } +037 +038 public ProxiedPlayer getPlayer(){ +039 return player; +040 } +041 +042 @Override +043 public boolean equals(Object o) { +044 if (this == o) return true; +045 if (o == null || getClass() != o.getClass()) return false; +046 OnlineProxiedPlayer that = (OnlineProxiedPlayer) o; +047 return Objects.equals(player, that.player); +048 } +049 +050 @Override +051 public int hashCode() { +052 return Objects.hash(player); +053 } +054 +055 @Override +056 public String toString() { +057 return "OnlineProxiedPlayer{" + +058 "proxiedPlayer=" + player + +059 '}'; +060 } +061} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
getCommandIssuer(Object issuer) static CommandIssuergetCurrentCommandIssuer() CommandIssuergetCurrentCommandIssuer() static CommandIssuergetCurrentCommandIssuer() CommandIssuergetIssuer() voidexecute(CommandIssuer issuer,
+BaseCommand.execute(CommandIssuer issuer,
String commandLabel,
String[] args)
voidexecute(CommandIssuer issuer,
+ForwardingCommand.execute(CommandIssuer issuer,
String commandLabel,
String[] args)
booleanhasPermission(CommandIssuer sender) hasPermission(CommandIssuer issuer) booleanhasPermission(CommandIssuer issuer) hasPermission(CommandIssuer sender) booleanList<String>tabComplete(CommandIssuer issuer,
- String alias,
+BaseCommand.tabComplete(CommandIssuer issuer,
+ String commandLabel,
String[] args)
List<String>tabComplete(CommandIssuer issuer,
- String commandLabel,
+ForwardingCommand.tabComplete(CommandIssuer issuer,
+ String alias,
String[] args)
getCommandManager() static CommandManagergetCurrentCommandManager() CommandManagergetCurrentCommandManager() static CommandManagergetCurrentCommandManager() CommandManagergetManager() getManager() CommandManagergetManager() getManager() public class PaperCommandCompletions +extends co.aikar.commands.BukkitCommandCompletions+
co.aikar.commands.CommandCompletions.CommandCompletionHandler<C extends co.aikar.commands.CommandCompletionContext>| Constructor and Description | +
|---|
PaperCommandCompletions(PaperCommandManager manager) |
+
public PaperCommandCompletions(PaperCommandManager manager)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-paper/co/aikar/commands/PaperCommandContexts.html b/docs/acf-paper/co/aikar/commands/PaperCommandContexts.html new file mode 100644 index 00000000..87d978f8 --- /dev/null +++ b/docs/acf-paper/co/aikar/commands/PaperCommandContexts.html @@ -0,0 +1,268 @@ + + + + + + +public class PaperCommandContexts +extends co.aikar.commands.BukkitCommandContexts+
contextMap, manager| Constructor and Description | +
|---|
PaperCommandContexts(PaperCommandManager manager) |
+
public PaperCommandContexts(PaperCommandManager manager)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-paper/co/aikar/commands/PaperCommandManager.html b/docs/acf-paper/co/aikar/commands/PaperCommandManager.html new file mode 100644 index 00000000..c08b9b11 --- /dev/null +++ b/docs/acf-paper/co/aikar/commands/PaperCommandManager.html @@ -0,0 +1,337 @@ + + + + + + +public class PaperCommandManager +extends co.aikar.commands.BukkitCommandManager+
completions, contexts, knownCommands, locales, plugin, registeredCommandsdefaultExceptionHandler, defaultFormatter, formatters, replacements, rootCommands, supportedLanguages| Constructor and Description | +
|---|
PaperCommandManager(org.bukkit.plugin.Plugin plugin) |
+
| Modifier and Type | +Method and Description | +
|---|---|
co.aikar.commands.CommandCompletions<co.aikar.commands.BukkitCommandCompletionContext> |
+getCommandCompletions() |
+
co.aikar.commands.CommandContexts<co.aikar.commands.BukkitCommandExecutionContext> |
+getCommandContexts() |
+
createCommandContext, createCompletionContext, createRegisteredCommand, createRootCommand, getCommandIssuer, getLocales, getPlugin, getTimings, hasRegisteredCommands, isCommandIssuer, log, registerCommand, registerCommand, unregisterCommand, unregisterCommand, unregisterCommandsaddSupportedLanguage, createCommandOperationContext, enableUnstableAPI, formatMessage, generateCommandHelp, generateCommandHelp, generateCommandHelp, generateCommandHelp, getCommandReplacements, getCurrentCommandIssuer, getCurrentCommandManager, getCurrentCommandOperationContext, getDefaultExceptionHandler, getDefaultFormatter, getFormat, getIssuerLocale, getSupportedLanguages, handleUncaughtException, hasPermission, log, obtainRootCommand, sendMessage, sendMessage, setDefaultExceptionHandler, setDefaultFormatter, setFormat, setFormat, setFormatpublic PaperCommandManager(org.bukkit.plugin.Plugin plugin)+
public co.aikar.commands.CommandContexts<co.aikar.commands.BukkitCommandExecutionContext> getCommandContexts()+
getCommandContexts in class co.aikar.commands.BukkitCommandManagerpublic co.aikar.commands.CommandCompletions<co.aikar.commands.BukkitCommandCompletionContext> getCommandCompletions()+
getCommandCompletions in class co.aikar.commands.BukkitCommandManagerCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-paper/co/aikar/commands/class-use/PaperCommandCompletions.html b/docs/acf-paper/co/aikar/commands/class-use/PaperCommandCompletions.html new file mode 100644 index 00000000..e96f1427 --- /dev/null +++ b/docs/acf-paper/co/aikar/commands/class-use/PaperCommandCompletions.html @@ -0,0 +1,123 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-paper/co/aikar/commands/class-use/PaperCommandContexts.html b/docs/acf-paper/co/aikar/commands/class-use/PaperCommandContexts.html new file mode 100644 index 00000000..9312d580 --- /dev/null +++ b/docs/acf-paper/co/aikar/commands/class-use/PaperCommandContexts.html @@ -0,0 +1,123 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-paper/co/aikar/commands/class-use/PaperCommandManager.html b/docs/acf-paper/co/aikar/commands/class-use/PaperCommandManager.html new file mode 100644 index 00000000..6f9a44d6 --- /dev/null +++ b/docs/acf-paper/co/aikar/commands/class-use/PaperCommandManager.html @@ -0,0 +1,149 @@ + + + + + + +| Constructor and Description | +
|---|
PaperCommandCompletions(PaperCommandManager manager) |
+
PaperCommandContexts(PaperCommandManager manager) |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-paper/co/aikar/commands/package-frame.html b/docs/acf-paper/co/aikar/commands/package-frame.html new file mode 100644 index 00000000..a8bbc69e --- /dev/null +++ b/docs/acf-paper/co/aikar/commands/package-frame.html @@ -0,0 +1,22 @@ + + + + + + +| Class | +Description | +
|---|---|
| PaperCommandCompletions | ++ |
| PaperCommandContexts | ++ |
| PaperCommandManager | ++ |
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-paper/co/aikar/commands/package-tree.html b/docs/acf-paper/co/aikar/commands/package-tree.html new file mode 100644 index 00000000..5b257a28 --- /dev/null +++ b/docs/acf-paper/co/aikar/commands/package-tree.html @@ -0,0 +1,158 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-paper/co/aikar/commands/package-use.html b/docs/acf-paper/co/aikar/commands/package-use.html new file mode 100644 index 00000000..07fc8a00 --- /dev/null +++ b/docs/acf-paper/co/aikar/commands/package-use.html @@ -0,0 +1,141 @@ + + + + + + +| Class and Description | +
|---|
| PaperCommandManager | +
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-paper/constant-values.html b/docs/acf-paper/constant-values.html new file mode 100644 index 00000000..ee2d91b3 --- /dev/null +++ b/docs/acf-paper/constant-values.html @@ -0,0 +1,123 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-paper/deprecated-list.html b/docs/acf-paper/deprecated-list.html new file mode 100644 index 00000000..174d8602 --- /dev/null +++ b/docs/acf-paper/deprecated-list.html @@ -0,0 +1,123 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-paper/help-doc.html b/docs/acf-paper/help-doc.html new file mode 100644 index 00000000..02ac71ea --- /dev/null +++ b/docs/acf-paper/help-doc.html @@ -0,0 +1,224 @@ + + + + + + +Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+Each annotation type has its own separate page with the following sections:
+Each enum has its own separate page with the following sections:
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+These links take you to the next or previous class, interface, package, or related page.
+These links show and hide the HTML frames. All pages are available with or without frames.
+The All Classes link shows all classes and interfaces except non-static nested types.
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+The Constant Field Values page lists the static final fields and their values.
+Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-paper/index-all.html b/docs/acf-paper/index-all.html new file mode 100644 index 00000000..29a38bb9 --- /dev/null +++ b/docs/acf-paper/index-all.html @@ -0,0 +1,156 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-paper/index.html b/docs/acf-paper/index.html new file mode 100644 index 00000000..9401b7e6 --- /dev/null +++ b/docs/acf-paper/index.html @@ -0,0 +1,73 @@ + + + + + + +This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to Non-frame version.
+Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-paper/package-list b/docs/acf-paper/package-list new file mode 100644 index 00000000..0886d25c --- /dev/null +++ b/docs/acf-paper/package-list @@ -0,0 +1 @@ +co.aikar.commands diff --git a/docs/acf-paper/script.js b/docs/acf-paper/script.js new file mode 100644 index 00000000..b3463569 --- /dev/null +++ b/docs/acf-paper/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/docs/acf-paper/src-html/co/aikar/commands/PaperCommandCompletions.html b/docs/acf-paper/src-html/co/aikar/commands/PaperCommandCompletions.html new file mode 100644 index 00000000..402701e8 --- /dev/null +++ b/docs/acf-paper/src-html/co/aikar/commands/PaperCommandCompletions.html @@ -0,0 +1,103 @@ + + + +001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026@SuppressWarnings("WeakerAccess") +027public class PaperCommandCompletions extends BukkitCommandCompletions { +028 public PaperCommandCompletions(PaperCommandManager manager) { +029 super(manager); +030 } +031} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026@SuppressWarnings("WeakerAccess") +027public class PaperCommandContexts extends BukkitCommandContexts { +028 public PaperCommandContexts(PaperCommandManager manager) { +029 super(manager); +030 } +031} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import org.bukkit.command.CommandSender; +027import org.bukkit.plugin.Plugin; +028 +029@SuppressWarnings("WeakerAccess") +030public class PaperCommandManager extends BukkitCommandManager { +031 +032 // If we get anything Paper specific +033 public PaperCommandManager(Plugin plugin) { +034 super(plugin); +035 } +036 +037 @Override +038 public synchronized CommandContexts<BukkitCommandExecutionContext> getCommandContexts() { +039 if (this.contexts == null) { +040 this.contexts = new PaperCommandContexts(this); +041 } +042 return this.contexts; +043 } +044 +045 @Override +046 public synchronized CommandCompletions<BukkitCommandCompletionContext> getCommandCompletions() { +047 if (this.completions == null) { +048 this.completions = new PaperCommandCompletions(this); +049 } +050 return this.completions; +051 } +052} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
public class ACFSpongeUtil +extends Object+
| Constructor and Description | +
|---|
ACFSpongeUtil() |
+
| Modifier and Type | +Method and Description | +
|---|---|
static org.spongepowered.api.entity.living.player.Player |
+findPlayerSmart(co.aikar.commands.CommandIssuer issuer,
+ String search) |
+
static boolean |
+isValidName(String name) |
+
static List<org.spongepowered.api.entity.living.player.Player> |
+matchPlayer(String partialName) |
+
public ACFSpongeUtil()+
public static org.spongepowered.api.entity.living.player.Player findPlayerSmart(co.aikar.commands.CommandIssuer issuer, + String search)+
public static List<org.spongepowered.api.entity.living.player.Player> matchPlayer(String partialName)+
public static boolean isValidName(String name)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/MinecraftMessageKeys.html b/docs/acf-sponge/co/aikar/commands/MinecraftMessageKeys.html new file mode 100644 index 00000000..d2d306fa --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/MinecraftMessageKeys.html @@ -0,0 +1,432 @@ + + + + + + +public enum MinecraftMessageKeys +extends Enum<MinecraftMessageKeys> +implements co.aikar.locales.MessageKeyProvider+
| Enum Constant and Description | +
|---|
INVALID_WORLD |
+
IS_NOT_A_VALID_NAME |
+
MULTIPLE_PLAYERS_MATCH |
+
NO_PLAYER_FOUND |
+
NO_PLAYER_FOUND_SERVER |
+
PLAYER_IS_VANISHED_CONFIRM |
+
USERNAME_TOO_SHORT |
+
YOU_MUST_BE_HOLDING_ITEM |
+
| Modifier and Type | +Method and Description | +
|---|---|
co.aikar.locales.MessageKey |
+getMessageKey() |
+
static MinecraftMessageKeys |
+valueOf(String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static MinecraftMessageKeys[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
public static final MinecraftMessageKeys INVALID_WORLD+
public static final MinecraftMessageKeys YOU_MUST_BE_HOLDING_ITEM+
public static final MinecraftMessageKeys PLAYER_IS_VANISHED_CONFIRM+
public static final MinecraftMessageKeys USERNAME_TOO_SHORT+
public static final MinecraftMessageKeys IS_NOT_A_VALID_NAME+
public static final MinecraftMessageKeys MULTIPLE_PLAYERS_MATCH+
public static final MinecraftMessageKeys NO_PLAYER_FOUND_SERVER+
public static final MinecraftMessageKeys NO_PLAYER_FOUND+
public static MinecraftMessageKeys[] values()+
+for (MinecraftMessageKeys c : MinecraftMessageKeys.values()) + System.out.println(c); +
public static MinecraftMessageKeys valueOf(String name)+
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic co.aikar.locales.MessageKey getMessageKey()+
getMessageKey in interface co.aikar.locales.MessageKeyProviderCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/SpongeCommandCompletionContext.html b/docs/acf-sponge/co/aikar/commands/SpongeCommandCompletionContext.html new file mode 100644 index 00000000..657f9f6d --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/SpongeCommandCompletionContext.html @@ -0,0 +1,265 @@ + + + + + + +public class SpongeCommandCompletionContext +extends co.aikar.commands.CommandCompletionContext+
issuer| Modifier and Type | +Method and Description | +
|---|---|
org.spongepowered.api.command.CommandSource |
+getSource() |
+
getConfig, getConfig, getConfig, getConfigs, getContextValue, getContextValue, getInput, getIssuer, hasConfigCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/SpongeCommandCompletions.html b/docs/acf-sponge/co/aikar/commands/SpongeCommandCompletions.html new file mode 100644 index 00000000..4b84894b --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/SpongeCommandCompletions.html @@ -0,0 +1,265 @@ + + + + + + +public class SpongeCommandCompletions +extends co.aikar.commands.CommandCompletions<SpongeCommandCompletionContext>+
co.aikar.commands.CommandCompletions.CommandCompletionHandler<C extends co.aikar.commands.CommandCompletionContext>| Constructor and Description | +
|---|
SpongeCommandCompletions(SpongeCommandManager manager) |
+
public SpongeCommandCompletions(SpongeCommandManager manager)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/SpongeCommandContexts.html b/docs/acf-sponge/co/aikar/commands/SpongeCommandContexts.html new file mode 100644 index 00000000..7f4439e8 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/SpongeCommandContexts.html @@ -0,0 +1,265 @@ + + + + + + +public class SpongeCommandContexts +extends co.aikar.commands.CommandContexts<SpongeCommandExecutionContext>+
contextMap, manager| Constructor and Description | +
|---|
SpongeCommandContexts(SpongeCommandManager manager) |
+
public SpongeCommandContexts(SpongeCommandManager manager)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/SpongeCommandExecutionContext.html b/docs/acf-sponge/co/aikar/commands/SpongeCommandExecutionContext.html new file mode 100644 index 00000000..6d270101 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/SpongeCommandExecutionContext.html @@ -0,0 +1,265 @@ + + + + + + +public class SpongeCommandExecutionContext +extends co.aikar.commands.CommandExecutionContext<SpongeCommandExecutionContext,SpongeCommandIssuer>+
issuer| Modifier and Type | +Method and Description | +
|---|---|
org.spongepowered.api.command.CommandSource |
+getSource() |
+
canOverridePlayerContext, getAnnotation, getArgs, getCmd, getFirstArg, getFlags, getFlagValue, getFlagValue, getIndex, getIssuer, getLastArg, getNumParams, getParam, getPassedArgs, getResolvedArg, getResolvedArg, getResolvedArg, hasAnnotation, hasFlag, isLastArg, isOptional, joinArgs, joinArgs, popFirstArg, popLastArgCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/SpongeCommandIssuer.html b/docs/acf-sponge/co/aikar/commands/SpongeCommandIssuer.html new file mode 100644 index 00000000..89a50c48 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/SpongeCommandIssuer.html @@ -0,0 +1,356 @@ + + + + + + +public class SpongeCommandIssuer +extends Object +implements co.aikar.commands.CommandIssuer+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+equals(Object o) |
+
<T> T |
+getIssuer() |
+
co.aikar.commands.CommandManager |
+getManager() |
+
int |
+hashCode() |
+
boolean |
+hasPermission(String permission) |
+
boolean |
+isPlayer() |
+
void |
+sendMessageInternal(String message) |
+
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitsendError, sendError, sendInfo, sendInfo, sendMessage, sendMessage, sendMessage, sendSyntax, sendSyntaxpublic boolean isPlayer()+
isPlayer in interface co.aikar.commands.CommandIssuerpublic <T> T getIssuer()+
getIssuer in interface co.aikar.commands.CommandIssuerpublic co.aikar.commands.CommandManager getManager()+
getManager in interface co.aikar.commands.CommandIssuerpublic void sendMessageInternal(String message)+
sendMessageInternal in interface co.aikar.commands.CommandIssuerpublic boolean hasPermission(String permission)+
hasPermission in interface co.aikar.commands.CommandIssuerCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/SpongeCommandManager.html b/docs/acf-sponge/co/aikar/commands/SpongeCommandManager.html new file mode 100644 index 00000000..51ffee70 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/SpongeCommandManager.html @@ -0,0 +1,647 @@ + + + + + + +public class SpongeCommandManager +extends co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter>+
| Modifier and Type | +Field and Description | +
|---|---|
protected SpongeCommandCompletions |
+completions |
+
protected SpongeCommandContexts |
+contexts |
+
protected SpongeLocales |
+locales |
+
protected org.spongepowered.api.plugin.PluginContainer |
+plugin |
+
protected Map<String,SpongeRootCommand> |
+registeredCommands |
+
defaultExceptionHandler, defaultFormatter, formatters, replacements, rootCommands, supportedLanguages| Constructor and Description | +
|---|
SpongeCommandManager(org.spongepowered.api.plugin.PluginContainer plugin) |
+
| Modifier and Type | +Method and Description | +
|---|---|
<R extends co.aikar.commands.CommandExecutionContext> |
+createCommandContext(co.aikar.commands.RegisteredCommand command,
+ Parameter parameter,
+ co.aikar.commands.CommandIssuer sender,
+ List<String> args,
+ int i,
+ Map<String,Object> passedArgs) |
+
co.aikar.commands.CommandOperationContext |
+createCommandOperationContext(co.aikar.commands.BaseCommand command,
+ co.aikar.commands.CommandIssuer issuer,
+ String commandLabel,
+ String[] args) |
+
co.aikar.commands.CommandCompletionContext |
+createCompletionContext(co.aikar.commands.RegisteredCommand command,
+ co.aikar.commands.CommandIssuer sender,
+ String input,
+ String config,
+ String[] args) |
+
co.aikar.commands.RegisteredCommand |
+createRegisteredCommand(co.aikar.commands.BaseCommand command,
+ String cmdName,
+ Method method,
+ String prefSubCommand) |
+
co.aikar.commands.RootCommand |
+createRootCommand(String cmd) |
+
co.aikar.timings.Timing |
+createTiming(String name) |
+
co.aikar.commands.CommandCompletions<SpongeCommandCompletionContext> |
+getCommandCompletions() |
+
co.aikar.commands.CommandContexts<SpongeCommandExecutionContext> |
+getCommandContexts() |
+
co.aikar.commands.CommandIssuer |
+getCommandIssuer(Object issuer) |
+
SpongeLocales |
+getLocales() |
+
org.spongepowered.api.plugin.PluginContainer |
+getPlugin() |
+
boolean |
+hasRegisteredCommands() |
+
boolean |
+isCommandIssuer(Class<?> type) |
+
void |
+log(co.aikar.commands.LogLevel level,
+ String message,
+ Throwable throwable) |
+
void |
+registerCommand(co.aikar.commands.BaseCommand command) |
+
addSupportedLanguage, enableUnstableAPI, formatMessage, generateCommandHelp, generateCommandHelp, generateCommandHelp, generateCommandHelp, getCommandReplacements, getCurrentCommandIssuer, getCurrentCommandManager, getCurrentCommandOperationContext, getDefaultExceptionHandler, getDefaultFormatter, getFormat, getIssuerLocale, getSupportedLanguages, handleUncaughtException, hasPermission, log, obtainRootCommand, sendMessage, sendMessage, setDefaultExceptionHandler, setDefaultFormatter, setFormat, setFormat, setFormatprotected final org.spongepowered.api.plugin.PluginContainer plugin+
protected Map<String,SpongeRootCommand> registeredCommands+
protected SpongeCommandContexts contexts+
protected SpongeCommandCompletions completions+
protected SpongeLocales locales+
public SpongeCommandManager(org.spongepowered.api.plugin.PluginContainer plugin)+
public org.spongepowered.api.plugin.PluginContainer getPlugin()+
public boolean isCommandIssuer(Class<?> type)+
isCommandIssuer in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter>public co.aikar.commands.CommandContexts<SpongeCommandExecutionContext> getCommandContexts()+
getCommandContexts in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter>public co.aikar.commands.CommandCompletions<SpongeCommandCompletionContext> getCommandCompletions()+
getCommandCompletions in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter>public SpongeLocales getLocales()+
getLocales in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter>public boolean hasRegisteredCommands()+
hasRegisteredCommands in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter>public void registerCommand(co.aikar.commands.BaseCommand command)+
registerCommand in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter>public co.aikar.timings.Timing createTiming(String name)+
public co.aikar.commands.RootCommand createRootCommand(String cmd)+
createRootCommand in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter>public co.aikar.commands.CommandIssuer getCommandIssuer(Object issuer)+
getCommandIssuer in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter>public <R extends co.aikar.commands.CommandExecutionContext> R createCommandContext(co.aikar.commands.RegisteredCommand command, + Parameter parameter, + co.aikar.commands.CommandIssuer sender, + List<String> args, + int i, + Map<String,Object> passedArgs)+
createCommandContext in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter>public co.aikar.commands.CommandCompletionContext createCompletionContext(co.aikar.commands.RegisteredCommand command, + co.aikar.commands.CommandIssuer sender, + String input, + String config, + String[] args)+
createCompletionContext in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter>public co.aikar.commands.RegisteredCommand createRegisteredCommand(co.aikar.commands.BaseCommand command, + String cmdName, + Method method, + String prefSubCommand)+
createRegisteredCommand in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter>public void log(co.aikar.commands.LogLevel level, + String message, + Throwable throwable)+
log in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter>public co.aikar.commands.CommandOperationContext createCommandOperationContext(co.aikar.commands.BaseCommand command, + co.aikar.commands.CommandIssuer issuer, + String commandLabel, + String[] args)+
createCommandOperationContext in class co.aikar.commands.CommandManager<org.spongepowered.api.command.CommandSource,org.spongepowered.api.text.format.TextColor,SpongeMessageFormatter>Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/SpongeCommandOperationContext.html b/docs/acf-sponge/co/aikar/commands/SpongeCommandOperationContext.html new file mode 100644 index 00000000..696c52af --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/SpongeCommandOperationContext.html @@ -0,0 +1,263 @@ + + + + + + +public class SpongeCommandOperationContext +extends co.aikar.commands.CommandOperationContext+
| Modifier and Type | +Method and Description | +
|---|---|
org.spongepowered.api.command.CommandResult |
+getResult() |
+
void |
+setResult(org.spongepowered.api.command.CommandResult result) |
+
getAnnotation, getArgs, getCommand, getCommandIssuer, getCommandLabel, getCommandManager, getRegisteredCommand, hasAnnotation, setRegisteredCommandCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/SpongeLocales.html b/docs/acf-sponge/co/aikar/commands/SpongeLocales.html new file mode 100644 index 00000000..bf64a528 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/SpongeLocales.html @@ -0,0 +1,303 @@ + + + + + + +public class SpongeLocales +extends co.aikar.commands.Locales+
AFRIKAANS, ARABIC, BULGARIAN, CHINESE, CZECH, DANISH, DUTCH, ENGLISH, FINNISH, FRENCH, GERMAN, GREEK, HEBREW, HINDI, ITALIAN, JAPANESE, KOREAN, LATIN, POLISH, PORTUGUESE, ROMANIAN, RUSSIAN, SIMPLIFIED_CHINESE, SPANISH, SWEDISH, THAI, TRADITIONAL_CHINESE, TURKISH, UKRANIAN, VIETNAMESE, WELSH| Constructor and Description | +
|---|
SpongeLocales(SpongeCommandManager manager) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+loadLanguages() |
+
addMessage, addMessageBundle, addMessageBundles, addMessages, addMessageStrings, getDefaultLocale, getMessage, loadMissingBundles, replaceI18NStrings, setDefaultLocalepublic SpongeLocales(SpongeCommandManager manager)+
public void loadLanguages()+
loadLanguages in class co.aikar.commands.LocalesCopyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/SpongeMessageFormatter.html b/docs/acf-sponge/co/aikar/commands/SpongeMessageFormatter.html new file mode 100644 index 00000000..1785a9e9 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/SpongeMessageFormatter.html @@ -0,0 +1,290 @@ + + + + + + +public class SpongeMessageFormatter +extends co.aikar.commands.MessageFormatter<org.spongepowered.api.text.format.TextColor>+
| Constructor and Description | +
|---|
SpongeMessageFormatter(org.spongepowered.api.text.format.TextColor... colors) |
+
| Modifier and Type | +Method and Description | +
|---|---|
String |
+format(org.spongepowered.api.text.format.TextColor color,
+ String message) |
+
format, format, getColor, getDefaultColor, setColorpublic SpongeMessageFormatter(org.spongepowered.api.text.format.TextColor... colors)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/SpongeRegisteredCommand.html b/docs/acf-sponge/co/aikar/commands/SpongeRegisteredCommand.html new file mode 100644 index 00000000..d2b0af05 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/SpongeRegisteredCommand.html @@ -0,0 +1,271 @@ + + + + + + +public class SpongeRegisteredCommand +extends co.aikar.commands.RegisteredCommand<SpongeCommandExecutionContext>+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+postCommand() |
+
void |
+preCommand() |
+
addSubcommand, addSubcommands, getCommand, getPermission, getPrefSubCommand, getSyntaxTextpublic void preCommand()+
preCommand in class co.aikar.commands.RegisteredCommand<SpongeCommandExecutionContext>public void postCommand()+
postCommand in class co.aikar.commands.RegisteredCommand<SpongeCommandExecutionContext>Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/SpongeRootCommand.html b/docs/acf-sponge/co/aikar/commands/SpongeRootCommand.html new file mode 100644 index 00000000..b0789d7e --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/SpongeRootCommand.html @@ -0,0 +1,452 @@ + + + + + + +public class SpongeRootCommand +extends Object +implements org.spongepowered.api.command.CommandCallable+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+addChild(co.aikar.commands.BaseCommand command) |
+
default void |
+addChildShared(List<co.aikar.commands.BaseCommand> arg0,
+ com.google.common.collect.SetMultimap<String,co.aikar.commands.RegisteredCommand> arg1,
+ co.aikar.commands.BaseCommand arg2) |
+
default co.aikar.commands.BaseCommand |
+execute(co.aikar.commands.CommandIssuer arg0,
+ String arg1,
+ String[] arg2) |
+
String |
+getCommandName() |
+
default co.aikar.commands.BaseCommand |
+getDefCommand() |
+
Optional<org.spongepowered.api.text.Text> |
+getHelp(@NotNull org.spongepowered.api.command.CommandSource source) |
+
co.aikar.commands.CommandManager |
+getManager() |
+
Optional<org.spongepowered.api.text.Text> |
+getShortDescription(@NotNull org.spongepowered.api.command.CommandSource source) |
+
com.google.common.collect.SetMultimap<String,co.aikar.commands.RegisteredCommand> |
+getSubCommands() |
+
List<String> |
+getSuggestions(@NotNull org.spongepowered.api.command.CommandSource source,
+ @NotNull String arguments,
+ org.spongepowered.api.world.Location<org.spongepowered.api.world.World> location) |
+
org.spongepowered.api.text.Text |
+getUsage(@NotNull org.spongepowered.api.command.CommandSource source) |
+
org.spongepowered.api.command.CommandResult |
+process(@NotNull org.spongepowered.api.command.CommandSource source,
+ @NotNull String arguments) |
+
boolean |
+testPermission(@NotNull org.spongepowered.api.command.CommandSource source) |
+
public String getCommandName()+
public org.spongepowered.api.command.CommandResult process(@NotNull + @NotNull org.spongepowered.api.command.CommandSource source, + @NotNull + @NotNull String arguments) + throws org.spongepowered.api.command.CommandException+
process in interface org.spongepowered.api.command.CommandCallableorg.spongepowered.api.command.CommandExceptionpublic List<String> getSuggestions(@NotNull + @NotNull org.spongepowered.api.command.CommandSource source, + @NotNull + @NotNull String arguments, + @Nullable + org.spongepowered.api.world.Location<org.spongepowered.api.world.World> location) + throws org.spongepowered.api.command.CommandException+
getSuggestions in interface org.spongepowered.api.command.CommandCallableorg.spongepowered.api.command.CommandExceptionpublic boolean testPermission(@NotNull + @NotNull org.spongepowered.api.command.CommandSource source)+
testPermission in interface org.spongepowered.api.command.CommandCallablepublic Optional<org.spongepowered.api.text.Text> getShortDescription(@NotNull + @NotNull org.spongepowered.api.command.CommandSource source)+
getShortDescription in interface org.spongepowered.api.command.CommandCallablepublic Optional<org.spongepowered.api.text.Text> getHelp(@NotNull + @NotNull org.spongepowered.api.command.CommandSource source)+
getHelp in interface org.spongepowered.api.command.CommandCallablepublic org.spongepowered.api.text.Text getUsage(@NotNull + @NotNull org.spongepowered.api.command.CommandSource source)+
getUsage in interface org.spongepowered.api.command.CommandCallablepublic void addChild(co.aikar.commands.BaseCommand command)+
public co.aikar.commands.CommandManager getManager()+
public com.google.common.collect.SetMultimap<String,co.aikar.commands.RegisteredCommand> getSubCommands()+
public void addChildShared(List<co.aikar.commands.BaseCommand> arg0, + com.google.common.collect.SetMultimap<String,co.aikar.commands.RegisteredCommand> arg1, + co.aikar.commands.BaseCommand arg2)+
public co.aikar.commands.BaseCommand execute(co.aikar.commands.CommandIssuer arg0, + String arg1, + String[] arg2)+
public co.aikar.commands.BaseCommand getDefCommand()+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/class-use/ACFSpongeUtil.html b/docs/acf-sponge/co/aikar/commands/class-use/ACFSpongeUtil.html new file mode 100644 index 00000000..5f5bbf34 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/class-use/ACFSpongeUtil.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/class-use/MinecraftMessageKeys.html b/docs/acf-sponge/co/aikar/commands/class-use/MinecraftMessageKeys.html new file mode 100644 index 00000000..ceb8ab73 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/class-use/MinecraftMessageKeys.html @@ -0,0 +1,174 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
static MinecraftMessageKeys |
+MinecraftMessageKeys.valueOf(String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static MinecraftMessageKeys[] |
+MinecraftMessageKeys.values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandCompletionContext.html b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandCompletionContext.html new file mode 100644 index 00000000..a095e148 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandCompletionContext.html @@ -0,0 +1,165 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
co.aikar.commands.CommandCompletions<SpongeCommandCompletionContext> |
+SpongeCommandManager.getCommandCompletions() |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandCompletions.html b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandCompletions.html new file mode 100644 index 00000000..0bcef008 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandCompletions.html @@ -0,0 +1,165 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
protected SpongeCommandCompletions |
+SpongeCommandManager.completions |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandContexts.html b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandContexts.html new file mode 100644 index 00000000..2eea8012 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandContexts.html @@ -0,0 +1,165 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
protected SpongeCommandContexts |
+SpongeCommandManager.contexts |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandExecutionContext.html b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandExecutionContext.html new file mode 100644 index 00000000..95c1fc08 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandExecutionContext.html @@ -0,0 +1,165 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
co.aikar.commands.CommandContexts<SpongeCommandExecutionContext> |
+SpongeCommandManager.getCommandContexts() |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandIssuer.html b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandIssuer.html new file mode 100644 index 00000000..a93ec5a9 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandIssuer.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandManager.html b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandManager.html new file mode 100644 index 00000000..162dcdfe --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandManager.html @@ -0,0 +1,169 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Constructor and Description | +
|---|
SpongeCommandCompletions(SpongeCommandManager manager) |
+
SpongeCommandContexts(SpongeCommandManager manager) |
+
SpongeLocales(SpongeCommandManager manager) |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandOperationContext.html b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandOperationContext.html new file mode 100644 index 00000000..eaec3e7f --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/class-use/SpongeCommandOperationContext.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/class-use/SpongeLocales.html b/docs/acf-sponge/co/aikar/commands/class-use/SpongeLocales.html new file mode 100644 index 00000000..d53b4236 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/class-use/SpongeLocales.html @@ -0,0 +1,178 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
protected SpongeLocales |
+SpongeCommandManager.locales |
+
| Modifier and Type | +Method and Description | +
|---|---|
SpongeLocales |
+SpongeCommandManager.getLocales() |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/class-use/SpongeMessageFormatter.html b/docs/acf-sponge/co/aikar/commands/class-use/SpongeMessageFormatter.html new file mode 100644 index 00000000..c7d8323e --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/class-use/SpongeMessageFormatter.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/class-use/SpongeRegisteredCommand.html b/docs/acf-sponge/co/aikar/commands/class-use/SpongeRegisteredCommand.html new file mode 100644 index 00000000..8c1e0407 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/class-use/SpongeRegisteredCommand.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/class-use/SpongeRootCommand.html b/docs/acf-sponge/co/aikar/commands/class-use/SpongeRootCommand.html new file mode 100644 index 00000000..50a74192 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/class-use/SpongeRootCommand.html @@ -0,0 +1,165 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
protected Map<String,SpongeRootCommand> |
+SpongeCommandManager.registeredCommands |
+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/contexts/CommandResultSupplier.html b/docs/acf-sponge/co/aikar/commands/contexts/CommandResultSupplier.html new file mode 100644 index 00000000..3ec058e3 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/contexts/CommandResultSupplier.html @@ -0,0 +1,288 @@ + + + + + + +public class CommandResultSupplier +extends Object +implements Consumer<org.spongepowered.api.command.CommandResult>+
| Constructor and Description | +
|---|
CommandResultSupplier() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+accept(org.spongepowered.api.command.CommandResult commandResult) |
+
public CommandResultSupplier()+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/contexts/OnlinePlayer.html b/docs/acf-sponge/co/aikar/commands/contexts/OnlinePlayer.html new file mode 100644 index 00000000..2f026b21 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/contexts/OnlinePlayer.html @@ -0,0 +1,359 @@ + + + + + + +public class OnlinePlayer +extends Object+
| Modifier and Type | +Field and Description | +
|---|---|
org.spongepowered.api.entity.living.player.Player |
+player |
+
| Constructor and Description | +
|---|
OnlinePlayer(org.spongepowered.api.entity.living.player.Player player) |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+equals(Object o) |
+
org.spongepowered.api.entity.living.player.Player |
+getPlayer() |
+
int |
+hashCode() |
+
String |
+toString() |
+
public final org.spongepowered.api.entity.living.player.Player player+
public OnlinePlayer(org.spongepowered.api.entity.living.player.Player player)+
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/contexts/class-use/CommandResultSupplier.html b/docs/acf-sponge/co/aikar/commands/contexts/class-use/CommandResultSupplier.html new file mode 100644 index 00000000..fddf542d --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/contexts/class-use/CommandResultSupplier.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/contexts/class-use/OnlinePlayer.html b/docs/acf-sponge/co/aikar/commands/contexts/class-use/OnlinePlayer.html new file mode 100644 index 00000000..91054220 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/contexts/class-use/OnlinePlayer.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/contexts/package-frame.html b/docs/acf-sponge/co/aikar/commands/contexts/package-frame.html new file mode 100644 index 00000000..162d9769 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/contexts/package-frame.html @@ -0,0 +1,21 @@ + + + + + + +| Class | +Description | +
|---|---|
| CommandResultSupplier | ++ |
| OnlinePlayer | ++ |
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/contexts/package-tree.html b/docs/acf-sponge/co/aikar/commands/contexts/package-tree.html new file mode 100644 index 00000000..73c28fe3 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/contexts/package-tree.html @@ -0,0 +1,139 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/contexts/package-use.html b/docs/acf-sponge/co/aikar/commands/contexts/package-use.html new file mode 100644 index 00000000..50b3d5ef --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/contexts/package-use.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/package-frame.html b/docs/acf-sponge/co/aikar/commands/package-frame.html new file mode 100644 index 00000000..a4ae81b9 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/package-frame.html @@ -0,0 +1,35 @@ + + + + + + +| Class | +Description | +
|---|---|
| ACFSpongeUtil | ++ |
| SpongeCommandCompletionContext | ++ |
| SpongeCommandCompletions | ++ |
| SpongeCommandContexts | ++ |
| SpongeCommandExecutionContext | ++ |
| SpongeCommandIssuer | ++ |
| SpongeCommandManager | ++ |
| SpongeCommandOperationContext | ++ |
| SpongeLocales | ++ |
| SpongeMessageFormatter | ++ |
| SpongeRegisteredCommand | ++ |
| SpongeRootCommand | ++ |
| Enum | +Description | +
|---|---|
| MinecraftMessageKeys | ++ |
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/package-tree.html b/docs/acf-sponge/co/aikar/commands/package-tree.html new file mode 100644 index 00000000..4f8898e7 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/package-tree.html @@ -0,0 +1,197 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/co/aikar/commands/package-use.html b/docs/acf-sponge/co/aikar/commands/package-use.html new file mode 100644 index 00000000..5f429405 --- /dev/null +++ b/docs/acf-sponge/co/aikar/commands/package-use.html @@ -0,0 +1,179 @@ + + + + + + +| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| Class and Description | +
|---|
| MinecraftMessageKeys | +
| SpongeCommandCompletionContext | +
| SpongeCommandCompletions | +
| SpongeCommandContexts | +
| SpongeCommandExecutionContext | +
| SpongeCommandManager | +
| SpongeLocales | +
| SpongeRootCommand | +
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/constant-values.html b/docs/acf-sponge/constant-values.html new file mode 100644 index 00000000..0c4c3509 --- /dev/null +++ b/docs/acf-sponge/constant-values.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/deprecated-list.html b/docs/acf-sponge/deprecated-list.html new file mode 100644 index 00000000..9228903b --- /dev/null +++ b/docs/acf-sponge/deprecated-list.html @@ -0,0 +1,125 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/help-doc.html b/docs/acf-sponge/help-doc.html new file mode 100644 index 00000000..5b5aef42 --- /dev/null +++ b/docs/acf-sponge/help-doc.html @@ -0,0 +1,230 @@ + + + + + + +The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+Each annotation type has its own separate page with the following sections:
+Each enum has its own separate page with the following sections:
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+These links take you to the next or previous class, interface, package, or related page.
+These links show and hide the HTML frames. All pages are available with or without frames.
+The All Classes link shows all classes and interfaces except non-static nested types.
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+The Constant Field Values page lists the static final fields and their values.
+Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/index-all.html b/docs/acf-sponge/index-all.html new file mode 100644 index 00000000..f11ac7fb --- /dev/null +++ b/docs/acf-sponge/index-all.html @@ -0,0 +1,381 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/index.html b/docs/acf-sponge/index.html new file mode 100644 index 00000000..314780c1 --- /dev/null +++ b/docs/acf-sponge/index.html @@ -0,0 +1,76 @@ + + + + + + +This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to Non-frame version.
++ + diff --git a/docs/acf-sponge/overview-summary.html b/docs/acf-sponge/overview-summary.html new file mode 100644 index 00000000..b04ec8f2 --- /dev/null +++ b/docs/acf-sponge/overview-summary.html @@ -0,0 +1,143 @@ + + + + + + +
| Package | +Description | +
|---|---|
| co.aikar.commands | ++ |
| co.aikar.commands.contexts | ++ |
Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/overview-tree.html b/docs/acf-sponge/overview-tree.html new file mode 100644 index 00000000..8d3a1930 --- /dev/null +++ b/docs/acf-sponge/overview-tree.html @@ -0,0 +1,200 @@ + + + + + + +Copyright © 2017. All rights reserved.
+ + diff --git a/docs/acf-sponge/package-list b/docs/acf-sponge/package-list new file mode 100644 index 00000000..105851a3 --- /dev/null +++ b/docs/acf-sponge/package-list @@ -0,0 +1,2 @@ +co.aikar.commands +co.aikar.commands.contexts diff --git a/docs/acf-sponge/script.js b/docs/acf-sponge/script.js new file mode 100644 index 00000000..b3463569 --- /dev/null +++ b/docs/acf-sponge/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/docs/acf-sponge/src-html/co/aikar/commands/ACFSpongeUtil.html b/docs/acf-sponge/src-html/co/aikar/commands/ACFSpongeUtil.html new file mode 100644 index 00000000..698fcec8 --- /dev/null +++ b/docs/acf-sponge/src-html/co/aikar/commands/ACFSpongeUtil.html @@ -0,0 +1,174 @@ + + + +001package co.aikar.commands; +002 +003import com.google.common.collect.Iterables; +004import org.jetbrains.annotations.NotNull; +005import org.spongepowered.api.Sponge; +006import org.spongepowered.api.command.CommandSource; +007import org.spongepowered.api.entity.living.player.Player; +008 +009import java.util.ArrayList; +010import java.util.Iterator; +011import java.util.List; +012import java.util.stream.Collectors; +013 +014@SuppressWarnings("WeakerAccess") +015public class ACFSpongeUtil { +016 public static Player findPlayerSmart(CommandIssuer issuer, String search) { +017 CommandSource requester = issuer.getIssuer(); +018 if (search == null) { +019 return null; +020 } +021 String name = ACFUtil.replace(search, ":confirm", ""); +022 if (name.length() < 3) { +023 issuer.sendError(MinecraftMessageKeys.USERNAME_TOO_SHORT); +024 return null; +025 } +026 if (!isValidName(name)) { +027 issuer.sendError(MinecraftMessageKeys.IS_NOT_A_VALID_NAME, "{name}", name); +028 return null; +029 } +030 +031 List<Player> matches = matchPlayer(name); +032 List<Player> confirmList = new ArrayList<>(); +033 findMatches(search, requester, matches, confirmList); +034 +035 +036 if (matches.size() > 1 || confirmList.size() > 1) { +037 String allMatches = matches.stream().map(Player::getName).collect(Collectors.joining(", ")); +038 issuer.sendError(MinecraftMessageKeys.MULTIPLE_PLAYERS_MATCH, +039 "{search}", name, "{all}", allMatches); +040 return null; +041 } +042 +043 if (matches.isEmpty()) { +044 if (confirmList.isEmpty()) { +045 issuer.sendError(MinecraftMessageKeys.NO_PLAYER_FOUND_SERVER, +046 "{search}", name); +047 return null; +048 } else { +049 Player player = Iterables.getOnlyElement(confirmList); +050 issuer.sendInfo(MinecraftMessageKeys.PLAYER_IS_VANISHED_CONFIRM, "{vanished}", player.getName()); +051 return null; +052 } +053 } +054 +055 return matches.get(0); +056 } +057 +058 private static void findMatches(String search, CommandSource requester, List<Player> matches, List<Player> confirmList) { +059 // Remove vanished players from smart matching. +060 Iterator<Player> iter = matches.iterator(); +061 //noinspection Duplicates +062 while (iter.hasNext()) { +063 Player player = iter.next(); +064 if (requester instanceof Player && !((Player) requester).canSee(player)) { +065 if (requester.hasPermission("acf.seevanish")) { +066 if (!search.endsWith(":confirm")) { +067 confirmList.add(player); +068 iter.remove(); +069 } +070 } else { +071 iter.remove(); +072 } +073 } +074 } +075 } +076 +077 public static List<Player> matchPlayer(String partialName) { +078 List<Player> matchedPlayers = new ArrayList<Player>(); +079 +080 for (Player iterPlayer : Sponge.getServer().getOnlinePlayers()) { +081 String iterPlayerName = iterPlayer.getName(); +082 +083 if (partialName.equalsIgnoreCase(iterPlayerName)) { +084 // Exact match +085 matchedPlayers.clear(); +086 matchedPlayers.add(iterPlayer); +087 break; +088 } +089 if (iterPlayerName.toLowerCase(java.util.Locale.ENGLISH).contains(partialName.toLowerCase(java.util.Locale.ENGLISH))) { +090 // Partial match +091 matchedPlayers.add(iterPlayer); +092 } +093 } +094 +095 return matchedPlayers; +096 } +097 +098 public static boolean isValidName(String name) { +099 return name != null && !name.isEmpty() && ACFPatterns.VALID_NAME_PATTERN.matcher(name).matches(); +100 } +101 +102} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import co.aikar.locales.MessageKey; +027import co.aikar.locales.MessageKeyProvider; +028 +029public enum MinecraftMessageKeys implements MessageKeyProvider { +030 INVALID_WORLD, +031 YOU_MUST_BE_HOLDING_ITEM, +032 PLAYER_IS_VANISHED_CONFIRM, +033 USERNAME_TOO_SHORT, +034 IS_NOT_A_VALID_NAME, +035 MULTIPLE_PLAYERS_MATCH, +036 NO_PLAYER_FOUND_SERVER, +037 NO_PLAYER_FOUND +038 ; +039 +040 private final MessageKey key = MessageKey.of("acf-minecraft." + this.name().toLowerCase()); +041 public MessageKey getMessageKey() { +042 return key; +043 } +044} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import org.spongepowered.api.command.CommandSource; +027 +028@SuppressWarnings("WeakerAccess") +029public class SpongeCommandCompletionContext extends CommandCompletionContext { +030 +031 SpongeCommandCompletionContext(final RegisteredCommand command, final CommandIssuer issuer, final String input, final String config, final String[] args) { +032 super(command, issuer, input, config, args); +033 } +034 +035 public CommandSource getSource() { +036 return this.issuer.getIssuer(); +037 } +038} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026@SuppressWarnings("WeakerAccess") +027public class SpongeCommandCompletions extends CommandCompletions<SpongeCommandCompletionContext> { +028 +029 public SpongeCommandCompletions(final SpongeCommandManager manager) { +030 super(manager); +031 } +032} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import co.aikar.commands.annotation.Optional; +027import co.aikar.commands.contexts.CommandResultSupplier; +028import co.aikar.commands.contexts.OnlinePlayer; +029import org.jetbrains.annotations.Nullable; +030import org.spongepowered.api.Sponge; +031import org.spongepowered.api.command.CommandSource; +032import org.spongepowered.api.entity.living.player.Player; +033import org.spongepowered.api.text.format.TextColor; +034import org.spongepowered.api.text.format.TextColors; +035import org.spongepowered.api.text.format.TextStyle; +036import org.spongepowered.api.world.World; +037 +038import javax.swing.plaf.ActionMapUIResource; +039import java.util.HashSet; +040import java.util.Set; +041import java.util.regex.Pattern; +042import java.util.stream.Collectors; +043import java.util.stream.Stream; +044 +045@SuppressWarnings("WeakerAccess") +046public class SpongeCommandContexts extends CommandContexts<SpongeCommandExecutionContext> { +047 +048 public SpongeCommandContexts(final SpongeCommandManager manager) { +049 super(manager); +050 +051 registerIssuerOnlyContext(CommandResultSupplier.class, c -> new CommandResultSupplier()); +052 registerContext(OnlinePlayer.class, c -> getOnlinePlayer(c.getIssuer(), c.popFirstArg(), c.hasAnnotation(Optional.class))); +053 registerContext(TextColor.class, c -> { +054 String first = c.popFirstArg(); +055 Stream<TextColor> colours = Sponge.getRegistry().getAllOf(TextColor.class).stream(); +056 String filter = c.getFlagValue("filter", (String)null); +057 if(filter != null) { +058 filter = ACFUtil.simplifyString(filter); +059 String finalFilter = filter; +060 colours = colours.filter(colour -> finalFilter.equals(ACFUtil.simplifyString(colour.getName()))); +061 } +062 Stream<TextColor> finalColours = colours; +063 TextColor match = Sponge.getRegistry().getType(TextColor.class, ACFUtil.simplifyString(first)).orElseThrow(() -> { +064 String valid = finalColours +065 .map(colour -> "<c2>" + ACFUtil.simplifyString(colour.getName()) + "</c2>") +066 .collect(Collectors.joining("<c1>,</c1> ")); +067 return new InvalidCommandArgument(MessageKeys.PLEASE_SPECIFY_ONE_OF, "{valid}", valid); +068 }); +069 return match; +070 }); +071 registerContext(TextStyle.Base.class, c -> { +072 String first = c.popFirstArg(); +073 Stream<TextStyle.Base> styles = Sponge.getRegistry().getAllOf(TextStyle.Base.class).stream(); +074 String filter = c.getFlagValue("filter", (String)null); +075 if(filter != null) { +076 filter = ACFUtil.simplifyString(filter); +077 String finalFilter = filter; +078 styles = styles.filter(style -> finalFilter.equals(ACFUtil.simplifyString(style.getName()))); +079 } +080 Stream<TextStyle.Base> finalStyles = styles; +081 TextStyle.Base match = Sponge.getRegistry().getType(TextStyle.Base.class, ACFUtil.simplifyString(first)).orElseThrow(() -> { +082 String valid = finalStyles +083 .map(style -> "<c2>" + ACFUtil.simplifyString(style.getName()) + "</c2>") +084 .collect(Collectors.joining("<c1>,</c1> ")); +085 return new InvalidCommandArgument(MessageKeys.PLEASE_SPECIFY_ONE_OF, "{valid}", valid); +086 }); +087 return match; +088 }); +089 +090 registerIssuerAwareContext(CommandSource.class, SpongeCommandExecutionContext::getSource); +091 registerIssuerAwareContext(Player.class, (c) -> { +092 Player player = c.getSource() instanceof Player ? (Player) c.getSource() : null; +093 if (player == null && !c.hasAnnotation(Optional.class)) { +094 throw new InvalidCommandArgument(MessageKeys.NOT_ALLOWED_ON_CONSOLE, false); +095 } +096 /*PlayerInventory inventory = player != null ? player.getInventory() : null; +097 if (inventory != null && c.hasFlag("itemheld") && !ACFBukkitUtil.isValidItem(inventory.getItem(inventory.getHeldItemSlot()))) { +098 throw new InvalidCommandArgument(MinecraftMessageKeys.YOU_MUST_BE_HOLDING_ITEM, false); +099 }*/ +100 return player; +101 }); +102 registerContext(OnlinePlayer[].class, (c) -> { +103 SpongeCommandIssuer issuer = c.getIssuer(); +104 final String search = c.popFirstArg(); +105 boolean allowMissing = c.hasFlag("allowmissing"); +106 Set<OnlinePlayer> players = new HashSet<>(); +107 Pattern split = ACFPatterns.COMMA; +108 String splitter = c.getFlagValue("splitter", (String) null); +109 if (splitter != null) { +110 split = Pattern.compile(Pattern.quote(splitter)); +111 } +112 for (String lookup : split.split(search)) { +113 OnlinePlayer player = getOnlinePlayer(issuer, lookup, allowMissing); +114 if (player != null) { +115 players.add(player); +116 } +117 } +118 if (players.isEmpty() && !c.hasFlag("allowempty")) { +119 issuer.sendError(MinecraftMessageKeys.NO_PLAYER_FOUND_SERVER, +120 "{search}", search); +121 +122 throw new InvalidCommandArgument(false); +123 } +124 return players.toArray(new OnlinePlayer[players.size()]); +125 }); +126 registerIssuerAwareContext(World.class, (c) -> { +127 String firstArg = c.getFirstArg(); +128 java.util.Optional<World> world = firstArg != null ? Sponge.getServer().getWorld(firstArg) : java.util.Optional.empty(); +129 if (world.isPresent()) { +130 c.popFirstArg(); +131 } +132 if (!world.isPresent() && c.getSource() instanceof Player) { +133 world = java.util.Optional.of(((Player) c.getSource()).getWorld()); +134 } +135 if (!world.isPresent()) { +136 throw new InvalidCommandArgument(MinecraftMessageKeys.INVALID_WORLD); +137 } +138 return world.get(); +139 }); +140 } +141 +142 @Nullable +143 OnlinePlayer getOnlinePlayer(SpongeCommandIssuer issuer, String lookup, boolean allowMissing) throws InvalidCommandArgument { +144 Player player = ACFSpongeUtil.findPlayerSmart(issuer, lookup); +145 //noinspection Duplicates +146 if (player == null) { +147 if (allowMissing) { +148 return null; +149 } +150 throw new InvalidCommandArgument(false); +151 } +152 return new OnlinePlayer(player); +153 } +154} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import org.spongepowered.api.command.CommandSource; +027 +028import java.lang.reflect.Parameter; +029import java.util.List; +030import java.util.Map; +031 +032public class SpongeCommandExecutionContext extends CommandExecutionContext<SpongeCommandExecutionContext, SpongeCommandIssuer> { +033 +034 SpongeCommandExecutionContext(RegisteredCommand cmd, Parameter param, SpongeCommandIssuer sender, List<String> args, +035 int index, Map<String, Object> passedArgs) { +036 super(cmd, param, sender, args, index, passedArgs); +037 } +038 +039 public CommandSource getSource() { +040 return this.issuer.getIssuer(); +041 } +042} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import org.spongepowered.api.command.CommandSource; +027import org.spongepowered.api.entity.living.player.Player; +028import org.spongepowered.api.text.Text; +029import org.spongepowered.api.text.format.TextColors; +030import org.spongepowered.api.text.serializer.TextSerializers; +031 +032import java.util.Objects; +033 +034public class SpongeCommandIssuer implements CommandIssuer { +035 +036 private final SpongeCommandManager manager; +037 private final CommandSource source; +038 +039 SpongeCommandIssuer(SpongeCommandManager manager, final CommandSource source) { +040 this.manager = manager; +041 this.source = source; +042 } +043 +044 @Override +045 public boolean isPlayer() { +046 return this.source instanceof Player; +047 } +048 +049 @Override +050 public <T> T getIssuer() { +051 //noinspection unchecked +052 return (T) this.source; +053 } +054 +055 @Override +056 public CommandManager getManager() { +057 return manager; +058 } +059 +060 @Override +061 public void sendMessageInternal(String message) { +062 this.source.sendMessage(TextSerializers.LEGACY_FORMATTING_CODE.deserialize(message)); +063 } +064 +065 @Override +066 public boolean hasPermission(final String permission) { +067 return this.source.hasPermission(permission); +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 SpongeCommandIssuer that = (SpongeCommandIssuer) o; +076 return Objects.equals(source, that.source); +077 } +078 +079 @Override +080 public int hashCode() { +081 return Objects.hash(source); +082 } +083} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import co.aikar.commands.apachecommonslang.ApacheCommonsExceptionUtil; +027import co.aikar.timings.Timing; +028import co.aikar.timings.Timings; +029import org.slf4j.Logger; +030import org.spongepowered.api.Sponge; +031import org.spongepowered.api.command.CommandSource; +032import org.spongepowered.api.plugin.PluginContainer; +033import org.spongepowered.api.text.format.TextColor; +034import org.spongepowered.api.text.format.TextColors; +035 +036import java.lang.reflect.Method; +037import java.lang.reflect.Parameter; +038import java.util.HashMap; +039import java.util.List; +040import java.util.Map; +041 +042@SuppressWarnings("WeakerAccess") +043public class SpongeCommandManager extends CommandManager<CommandSource, TextColor, SpongeMessageFormatter> { +044 +045 protected final PluginContainer plugin; +046 protected Map<String, SpongeRootCommand> registeredCommands = new HashMap<>(); +047 protected SpongeCommandContexts contexts; +048 protected SpongeCommandCompletions completions; +049 private Timing commandTiming; +050 protected SpongeLocales locales; +051 +052 public SpongeCommandManager(PluginContainer plugin) { +053 this.plugin = plugin; +054 String pluginName = "acf-" + plugin.getName(); +055 getLocales().addMessageBundles("acf-minecraft", pluginName, pluginName.toLowerCase()); +056 this.commandTiming = Timings.of(plugin, "Commands"); +057 +058 this.formatters.put(MessageType.ERROR, defaultFormatter = new SpongeMessageFormatter(TextColors.RED, TextColors.YELLOW, TextColors.RED)); +059 this.formatters.put(MessageType.SYNTAX, new SpongeMessageFormatter(TextColors.YELLOW, TextColors.GREEN, TextColors.WHITE)); +060 this.formatters.put(MessageType.INFO, new SpongeMessageFormatter(TextColors.BLUE, TextColors.DARK_GREEN, TextColors.GREEN)); +061 this.formatters.put(MessageType.HELP, new SpongeMessageFormatter(TextColors.AQUA, TextColors.GREEN, TextColors.YELLOW)); +062 getLocales(); // auto load locales +063 } +064 +065 public PluginContainer getPlugin() { +066 return plugin; +067 } +068 +069 @Override +070 public boolean isCommandIssuer(Class<?> type) { +071 return CommandSource.class.isAssignableFrom(type); +072 } +073 +074 @Override +075 public synchronized CommandContexts<SpongeCommandExecutionContext> getCommandContexts() { +076 if (this.contexts == null) { +077 this.contexts = new SpongeCommandContexts(this); +078 } +079 return contexts; +080 } +081 +082 @Override +083 public synchronized CommandCompletions<SpongeCommandCompletionContext> getCommandCompletions() { +084 if (this.completions == null) { +085 this.completions = new SpongeCommandCompletions(this); +086 } +087 return completions; +088 } +089 +090 @Override +091 public SpongeLocales getLocales() { +092 if (this.locales == null) { +093 this.locales = new SpongeLocales(this); +094 this.locales.loadLanguages(); +095 } +096 return locales; +097 } +098 +099 @Override +100 public boolean hasRegisteredCommands() { +101 return !registeredCommands.isEmpty(); +102 } +103 +104 @Override +105 public void registerCommand(BaseCommand command) { +106 command.onRegister(this); +107 +108 for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) { +109 String commandName = entry.getKey().toLowerCase(); +110 SpongeRootCommand spongeCommand = (SpongeRootCommand) entry.getValue(); +111 if (!spongeCommand.isRegistered) { +112 Sponge.getCommandManager().register(this.plugin, spongeCommand, commandName); +113 } +114 spongeCommand.isRegistered = true; +115 registeredCommands.put(commandName, spongeCommand); +116 } +117 } +118 +119 public Timing createTiming(final String name) { +120 return Timings.of(this.plugin, name, this.commandTiming); +121 } +122 +123 @Override +124 public RootCommand createRootCommand(String cmd) { +125 return new SpongeRootCommand(this, cmd); +126 } +127 +128 @Override +129 public CommandIssuer getCommandIssuer(Object issuer) { +130 if (!(issuer instanceof CommandSource)) { +131 throw new IllegalArgumentException(issuer.getClass().getName() + " is not a Command Issuer."); +132 } +133 return new SpongeCommandIssuer(this, (CommandSource) issuer); +134 } +135 +136 @Override +137 public <R extends CommandExecutionContext> R createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs) { +138 //noinspection unchecked +139 return (R) new SpongeCommandExecutionContext(command, parameter, (SpongeCommandIssuer) sender, args, i, passedArgs); +140 } +141 +142 @Override +143 public CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args) { +144 return new SpongeCommandCompletionContext(command, sender, input, config, args); +145 } +146 +147 @Override +148 public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) { +149 return new SpongeRegisteredCommand(command, cmdName, method, prefSubCommand); +150 } +151 +152 @Override +153 public void log(final LogLevel level, final String message, final Throwable throwable) { +154 Logger logger = this.plugin.getLogger(); +155 switch(level) { +156 case INFO: +157 logger.info(LogLevel.LOG_PREFIX + message); +158 if (throwable != null) { +159 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) { +160 logger.info(LogLevel.LOG_PREFIX + line); +161 } +162 } +163 return; +164 case ERROR: +165 logger.error(LogLevel.LOG_PREFIX + message); +166 if (throwable != null) { +167 for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) { +168 logger.error(LogLevel.LOG_PREFIX + line); +169 } +170 } +171 } +172 } +173 +174 @Override +175 public CommandOperationContext createCommandOperationContext(BaseCommand command, CommandIssuer issuer, String commandLabel, String[] args) { +176 return new SpongeCommandOperationContext( +177 this, +178 issuer, +179 command, +180 commandLabel, +181 args +182 ); +183 } +184} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001package co.aikar.commands; +002 +003import org.spongepowered.api.command.CommandResult; +004 +005public class SpongeCommandOperationContext extends CommandOperationContext { +006 private CommandResult result = CommandResult.success(); +007 SpongeCommandOperationContext(CommandManager manager, CommandIssuer issuer, BaseCommand command, String commandLabel, String[] args) { +008 super(manager, issuer, command, commandLabel, args); +009 } +010 +011 public CommandResult getResult() { +012 return result; +013 } +014 +015 public void setResult(CommandResult result) { +016 this.result = result; +017 } +018} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001package co.aikar.commands; +002 +003public class SpongeLocales extends Locales{ +004 private final SpongeCommandManager manager; +005 +006 public SpongeLocales(SpongeCommandManager manager) { +007 super(manager); +008 this.manager = manager; +009 } +010 +011 @Override +012 public void loadLanguages() { +013 super.loadLanguages(); +014 String pluginName = "acf-" + manager.plugin.getName(); +015 addMessageBundles("acf-minecraft", pluginName, pluginName.toLowerCase()); +016 } +017} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001package co.aikar.commands; +002 +003import org.spongepowered.api.text.Text; +004import org.spongepowered.api.text.format.TextColor; +005import org.spongepowered.api.text.serializer.TextSerializers; +006 +007public class SpongeMessageFormatter extends MessageFormatter<TextColor> { +008 +009 public SpongeMessageFormatter(TextColor... colors) { +010 super(colors); +011 } +012 +013 public String format(TextColor color, String message) { +014 return TextSerializers.LEGACY_FORMATTING_CODE.serialize(Text.of(color, message)); +015 } +016} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import co.aikar.timings.Timing; +027 +028import java.lang.reflect.Method; +029 +030public class SpongeRegisteredCommand extends RegisteredCommand<SpongeCommandExecutionContext> { +031 +032 private final Timing timing; +033 +034 SpongeRegisteredCommand(BaseCommand scope, String command, Method method, String prefSubCommand) { +035 super(scope, command, method, prefSubCommand); +036 this.timing = ((SpongeCommandManager) scope.manager).createTiming("Command: " + this.command); +037 } +038 +039 @Override +040 public void preCommand() { +041 this.timing.startTiming(); +042 super.preCommand(); +043 } +044 +045 @Override +046 public void postCommand() { +047 super.postCommand(); +048 this.timing.stopTiming(); +049 } +050} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands; +025 +026import com.google.common.collect.HashMultimap; +027import com.google.common.collect.SetMultimap; +028import org.jetbrains.annotations.NotNull; +029import org.spongepowered.api.command.CommandCallable; +030import org.spongepowered.api.command.CommandException; +031import org.spongepowered.api.command.CommandResult; +032import org.spongepowered.api.command.CommandSource; +033import org.spongepowered.api.text.Text; +034import org.spongepowered.api.world.Location; +035import org.spongepowered.api.world.World; +036 +037import java.util.ArrayList; +038import java.util.HashSet; +039import java.util.List; +040import java.util.Optional; +041import java.util.Set; +042 +043import javax.annotation.Nullable; +044 +045public class SpongeRootCommand implements CommandCallable, RootCommand { +046 +047 private final SpongeCommandManager manager; +048 private final String name; +049 private BaseCommand defCommand; +050 private SetMultimap<String, RegisteredCommand> subCommands = HashMultimap.create(); +051 private List<BaseCommand> children = new ArrayList<>(); +052 boolean isRegistered = false; +053 +054 SpongeRootCommand(SpongeCommandManager manager, String name) { +055 this.manager = manager; +056 this.name = name; +057 } +058 +059 @Override +060 public String getCommandName() { +061 return name; +062 } +063 +064 @Override +065 public CommandResult process(@NotNull CommandSource source, @NotNull String arguments) throws CommandException { +066 String[] args = arguments.isEmpty() ? new String[0] : arguments.split(" "); +067 return this.executeSponge(manager.getCommandIssuer(source), this.name, args); +068 } +069 +070 @Override +071 public List<String> getSuggestions(@NotNull CommandSource source, @NotNull String arguments, @Nullable Location<World> location) throws CommandException { +072 String[] args = arguments.isEmpty() ? new String[0] : arguments.split(" "); +073 return tabComplete(manager.getCommandIssuer(source), this.name, args); +074 } +075 +076 @Override +077 public boolean testPermission(@NotNull CommandSource source) { +078 return this.defCommand.hasPermission(source); +079 } +080 +081 @Override +082 public Optional<Text> getShortDescription(@NotNull CommandSource source) { +083 return Optional.empty(); +084 } +085 +086 @Override +087 public Optional<Text> getHelp(@NotNull CommandSource source) { +088 return Optional.empty(); +089 } +090 +091 @Override +092 public Text getUsage(@NotNull CommandSource source) { +093 return Text.of(); +094 } +095 +096 private List<String> tabComplete(CommandIssuer sender, String alias, String[] args) throws IllegalArgumentException { +097 Set<String> completions = new HashSet<>(); +098 this.children.forEach(child -> completions.addAll(child.tabComplete(sender, alias, args))); +099 return new ArrayList<>(completions); +100 } +101 +102 private CommandResult executeSponge(CommandIssuer sender, String commandLabel, String[] args) { +103 BaseCommand cmd = execute(sender, commandLabel, args); +104 return ((SpongeCommandOperationContext) cmd.lastCommandOperationContext).getResult(); +105 } +106 +107 public void addChild(BaseCommand command) { +108 if (this.defCommand == null || !command.subCommands.get("__default").isEmpty()) { +109 this.defCommand = command; +110 } +111 addChildShared(this.children, this.subCommands, command); +112 } +113 +114 @Override +115 public CommandManager getManager() { +116 return manager; +117 } +118 +119 @Override +120 public SetMultimap<String, RegisteredCommand> getSubCommands() { +121 return subCommands; +122 } +123} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001package co.aikar.commands.contexts; +002 +003import co.aikar.commands.CommandManager; +004import co.aikar.commands.SpongeCommandOperationContext; +005import org.spongepowered.api.command.CommandResult; +006 +007import java.util.function.Consumer; +008 +009public class CommandResultSupplier implements Consumer<CommandResult> { +010 +011 public CommandResultSupplier() { +012 } +013 +014 @Override +015 public void accept(CommandResult commandResult) { +016 SpongeCommandOperationContext context = (SpongeCommandOperationContext) CommandManager.getCurrentCommandOperationContext(); +017 context.setResult(commandResult); +018 } +019} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++
001/* +002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License +003 * +004 * Permission is hereby granted, free of charge, to any person obtaining +005 * a copy of this software and associated documentation files (the +006 * "Software"), to deal in the Software without restriction, including +007 * without limitation the rights to use, copy, modify, merge, publish, +008 * distribute, sublicense, and/or sell copies of the Software, and to +009 * permit persons to whom the Software is furnished to do so, subject to +010 * the following conditions: +011 * +012 * The above copyright notice and this permission notice shall be +013 * included in all copies or substantial portions of the Software. +014 * +015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +016 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +017 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +019 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +020 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +021 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +022 */ +023 +024package co.aikar.commands.contexts; +025 +026import org.spongepowered.api.entity.living.player.Player; +027 +028import java.util.Objects; +029 +030public class OnlinePlayer { +031 public final Player player; +032 +033 public OnlinePlayer(Player player) { +034 this.player = player; +035 } +036 +037 public Player getPlayer() { +038 return this.player; +039 } +040 +041 @Override +042 public boolean equals(Object o) { +043 if (this == o) return true; +044 if (o == null || getClass() != o.getClass()) return false; +045 OnlinePlayer that = (OnlinePlayer) o; +046 return Objects.equals(player, that.player); +047 } +048 +049 @Override +050 public int hashCode() { +051 return Objects.hash(player); +052 } +053 +054 @Override +055 public String toString() { +056 return "OnlinePlayer{" + +057 "player=" + player + +058 '}'; +059 } +060} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++