├── .idea ├── .name ├── fileTemplates │ └── includes │ │ └── File Header.java ├── codeStyles │ ├── codeStyleConfig.xml │ └── Project.xml ├── vcs.xml ├── externalDependencies.xml ├── copyright │ ├── profiles_settings.xml │ └── MIT.xml ├── codeInsightSettings.xml ├── scopes │ └── All_But_Apache_Commons.xml ├── saveactions_settings.xml ├── encodings.xml ├── runConfigurations │ ├── ACF__All_.xml │ ├── ACF__Core_Only_.xml │ ├── ACF__Core___Bukkit_.xml │ ├── ACF__Core___Bukkit___Paper_.xml │ └── ACF__Core___Bukkit___Example_.xml ├── inspectionProfiles │ └── Project_Default.xml └── compiler.xml ├── README.md ├── docs ├── _config.yml ├── acf-paper │ ├── package-list │ ├── script.js │ ├── allclasses-noframe.html │ ├── allclasses-frame.html │ └── co │ │ └── aikar │ │ └── commands │ │ └── package-frame.html ├── acf-bukkit │ ├── package-list │ ├── script.js │ ├── co │ │ └── aikar │ │ │ └── commands │ │ │ └── contexts │ │ │ └── package-frame.html │ ├── overview-frame.html │ └── allclasses-noframe.html ├── acf-bungee │ ├── package-list │ ├── script.js │ ├── co │ │ └── aikar │ │ │ └── commands │ │ │ └── contexts │ │ │ └── package-frame.html │ ├── overview-frame.html │ └── src-html │ │ └── co │ │ └── aikar │ │ └── commands │ │ ├── BungeeParameterConditionContext.html │ │ ├── BungeeMessageFormatter.html │ │ └── MinecraftMessageKeys.html ├── acf-jda │ ├── package-list │ ├── script.js │ ├── overview-frame.html │ ├── co │ │ └── aikar │ │ │ └── commands │ │ │ └── annotation │ │ │ └── package-frame.html │ └── src-html │ │ └── co │ │ └── aikar │ │ └── commands │ │ ├── CommandPermissionResolver.html │ │ ├── JDALocales.html │ │ ├── CommandConfigProvider.html │ │ ├── JDAConditionContext.html │ │ ├── JDACommandExecutionContext.html │ │ ├── JDAMessageFormatter.html │ │ ├── CommandConfig.html │ │ ├── annotation │ │ └── SelfUser.html │ │ └── JDACommandConfig.html ├── acf-sponge │ ├── package-list │ ├── script.js │ ├── overview-frame.html │ ├── co │ │ └── aikar │ │ │ └── commands │ │ │ └── contexts │ │ │ └── package-frame.html │ └── src-html │ │ └── co │ │ └── aikar │ │ └── commands │ │ ├── SpongeParameterConditionContext.html │ │ └── SpongeMessageFormatter.html └── acf-core │ ├── package-list │ ├── script.js │ ├── co │ └── aikar │ │ └── commands │ │ ├── processors │ │ └── package-frame.html │ │ ├── apachecommonslang │ │ └── package-frame.html │ │ └── contexts │ │ └── package-frame.html │ └── overview-frame.html ├── languages ├── core │ ├── acf-core_pl.properties │ ├── acf-core_sv.properties │ └── acf-core_cs.properties └── minecraft │ ├── acf-minecraft_de.properties │ ├── acf-minecraft_pl.properties │ ├── acf-minecraft_pt.properties │ └── acf-minecraft_sv.properties ├── jda └── src │ └── main │ └── java │ └── co │ └── aikar │ └── commands │ ├── JDALocales.java │ ├── CommandPermissionResolver.java │ ├── CommandConfigProvider.java │ ├── JDAConditionContext.java │ ├── CommandConfig.java │ ├── JDACommandExecutionContext.java │ ├── JDAMessageFormatter.java │ ├── JDACommandConfig.java │ ├── annotation │ ├── SelfUser.java │ ├── Author.java │ └── CrossGuild.java │ ├── JDAListener.java │ ├── JDAOptions.java │ ├── JDACommandPermissionResolver.java │ ├── JDACommandCompletions.java │ ├── JDARootCommand.java │ └── JDACommandEvent.java ├── example └── src │ └── main │ ├── resources │ └── plugin.yml │ └── java │ └── co │ └── aikar │ └── acfexample │ ├── SomeHandler.java │ └── SomeCommand_ExtraSubs.java ├── deploy.sh ├── .travis.yml ├── bungee ├── src │ └── main │ │ └── java │ │ └── co │ │ └── aikar │ │ └── commands │ │ ├── BungeeMessageFormatter.java │ │ ├── MinecraftMessageKeys.java │ │ ├── BungeeConditionContext.java │ │ ├── BungeeLocales.java │ │ ├── ACFBungeeListener.java │ │ ├── BungeeRegisteredCommand.java │ │ ├── BungeeCommandCompletionContext.java │ │ ├── BungeeCommandExecutionContext.java │ │ └── contexts │ │ └── OnlineProxiedPlayer.java └── pom.xml ├── .gitignore ├── sponge └── src │ └── main │ └── java │ └── co │ └── aikar │ └── commands │ ├── SpongeMessageFormatter.java │ ├── SpongeConditionContext.java │ ├── SpongeLocales.java │ ├── contexts │ ├── CommandResultSupplier.java │ └── OnlinePlayer.java │ ├── SpongeCommandOperationContext.java │ ├── ACFSpongeListener.java │ ├── SpongeCommandCompletions.java │ ├── MinecraftMessageKeys.java │ ├── SpongeCommandCompletionContext.java │ ├── SpongeRegisteredCommand.java │ └── SpongeCommandExecutionContext.java ├── CHANGELOG.md ├── CONTRIBUTORS.md ├── LICENSE ├── core └── src │ └── main │ └── java │ └── co │ └── aikar │ └── commands │ ├── CommandCompletionTextLookupException.java │ ├── LogLevel.java │ ├── UnstableAPI.java │ ├── InvalidCommandContextException.java │ ├── IssuerLocaleChangedCallback.java │ ├── contexts │ ├── IssuerAwareContextResolver.java │ ├── IssuerOnlyContextResolver.java │ ├── SenderAwareContextResolver.java │ ├── OptionalContextResolver.java │ └── ContextResolver.java │ ├── UnresolvedDependencyException.java │ ├── annotation │ ├── PreCommand.java │ ├── CatchAll.java │ ├── Private.java │ ├── Single.java │ ├── UnknownHandler.java │ ├── Description.java │ ├── Split.java │ ├── CommandPermission.java │ ├── Default.java │ ├── Values.java │ ├── Optional.java │ ├── Dependency.java │ ├── HelpSearchTags.java │ ├── Subcommand.java │ ├── Conditions.java │ ├── CatchUnknown.java │ ├── Flags.java │ ├── CommandAlias.java │ ├── CommandCompletion.java │ ├── Syntax.java │ └── HelpCommand.java │ ├── ShowCommandHelp.java │ ├── processors │ └── ConditionsProcessor.java │ ├── ConditionFailedException.java │ ├── MessageType.java │ └── ExceptionHandler.java ├── paper └── src │ └── main │ └── java │ └── co │ └── aikar │ └── commands │ ├── PaperCommandContexts.java │ └── PaperCommandCompletions.java └── bukkit └── src └── main └── java └── co └── aikar └── commands ├── BukkitMessageFormatter.java ├── BukkitConditionContext.java ├── BukkitCommandCompletionContext.java ├── MinecraftMessageKeys.java ├── BukkitRegisteredCommand.java ├── BukkitCommandExecutionContext.java ├── BukkitCommandContexts_1_12.java └── contexts └── OnlinePlayer.java /.idea/.name: -------------------------------------------------------------------------------- 1 | acf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | docs/README.md -------------------------------------------------------------------------------- /.idea/fileTemplates/includes/File Header.java: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-midnight -------------------------------------------------------------------------------- /docs/acf-paper/package-list: -------------------------------------------------------------------------------- 1 | co.aikar.commands 2 | -------------------------------------------------------------------------------- /docs/acf-bukkit/package-list: -------------------------------------------------------------------------------- 1 | co.aikar.commands 2 | co.aikar.commands.contexts 3 | -------------------------------------------------------------------------------- /docs/acf-bungee/package-list: -------------------------------------------------------------------------------- 1 | co.aikar.commands 2 | co.aikar.commands.contexts 3 | -------------------------------------------------------------------------------- /docs/acf-jda/package-list: -------------------------------------------------------------------------------- 1 | co.aikar.commands 2 | co.aikar.commands.annotation 3 | -------------------------------------------------------------------------------- /docs/acf-sponge/package-list: -------------------------------------------------------------------------------- 1 | co.aikar.commands 2 | co.aikar.commands.contexts 3 | -------------------------------------------------------------------------------- /languages/core/acf-core_pl.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJPlaysNow/commands/master/languages/core/acf-core_pl.properties -------------------------------------------------------------------------------- /languages/core/acf-core_sv.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJPlaysNow/commands/master/languages/core/acf-core_sv.properties -------------------------------------------------------------------------------- /languages/minecraft/acf-minecraft_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJPlaysNow/commands/master/languages/minecraft/acf-minecraft_de.properties -------------------------------------------------------------------------------- /languages/minecraft/acf-minecraft_pl.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJPlaysNow/commands/master/languages/minecraft/acf-minecraft_pl.properties -------------------------------------------------------------------------------- /languages/minecraft/acf-minecraft_pt.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJPlaysNow/commands/master/languages/minecraft/acf-minecraft_pt.properties -------------------------------------------------------------------------------- /languages/minecraft/acf-minecraft_sv.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJPlaysNow/commands/master/languages/minecraft/acf-minecraft_sv.properties -------------------------------------------------------------------------------- /docs/acf-core/package-list: -------------------------------------------------------------------------------- 1 | co.aikar.commands 2 | co.aikar.commands.annotation 3 | co.aikar.commands.apachecommonslang 4 | co.aikar.commands.contexts 5 | co.aikar.commands.processors 6 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/externalDependencies.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/JDALocales.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | public class JDALocales extends Locales { 4 | public JDALocales(CommandManager manager) { 5 | super(manager); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /example/src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: ACFExample 2 | version: ${project.version} 3 | main: co.aikar.acfexample.ACFExample 4 | prefix: ACF 5 | authors: [Aikar] 6 | description: Example / Test for ACF 7 | website: https://github.com/aikar/commands 8 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/CommandPermissionResolver.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | 4 | public interface CommandPermissionResolver { 5 | boolean hasPermission(JDACommandManager manager, JDACommandEvent event, String permission); 6 | } 7 | -------------------------------------------------------------------------------- /.idea/codeInsightSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | java.awt 6 | 7 | 8 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [ ! -z "$1" ]; then 3 | cd $1 || exit 1 4 | fi 5 | mvn -T 4 clean javadoc:jar deploy || exit 1 6 | if [ ! -z "$1" ]; then 7 | cd - || exit 1 8 | fi 9 | git add docs 10 | git commit docs -m "(DEPLOYED ACF) Updated JavaDocs" 11 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/CommandConfigProvider.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import net.dv8tion.jda.core.events.message.MessageReceivedEvent; 4 | 5 | public interface CommandConfigProvider { 6 | CommandConfig provide(MessageReceivedEvent event); 7 | } 8 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/JDAConditionContext.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | public class JDAConditionContext extends ConditionContext { 4 | JDAConditionContext(JDACommandEvent issuer, String config) { 5 | super(issuer, config); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | dist: trusty 3 | jdk: 4 | - oraclejdk8 5 | git: 6 | submodules: false 7 | before_install: 8 | - git config --global user.email "travis-ci@travis-ci.com" 9 | - git config --global user.name "Travis CI" 10 | cache: 11 | directories: 12 | - '$HOME/.m2/repository' 13 | -------------------------------------------------------------------------------- /.idea/scopes/All_But_Apache_Commons.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /example/src/main/java/co/aikar/acfexample/SomeHandler.java: -------------------------------------------------------------------------------- 1 | package co.aikar.acfexample; 2 | 3 | public class SomeHandler { 4 | 5 | private String someField; 6 | 7 | public String getSomeField() { 8 | return someField; 9 | } 10 | 11 | public void setSomeField(String someField) { 12 | this.someField = someField; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /bungee/src/main/java/co/aikar/commands/BungeeMessageFormatter.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import net.md_5.bungee.api.ChatColor; 4 | 5 | public class BungeeMessageFormatter extends MessageFormatter { 6 | 7 | public BungeeMessageFormatter(ChatColor... colors) { 8 | super(colors); 9 | } 10 | 11 | @Override 12 | String format(ChatColor color, String message) { 13 | return color + message; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/CommandConfig.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import net.dv8tion.jda.core.events.message.MessageReceivedEvent; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.util.List; 7 | 8 | public interface CommandConfig extends CommandConfigProvider { 9 | @NotNull List getCommandPrefixes(); 10 | 11 | @Override 12 | default CommandConfig provide(MessageReceivedEvent event) { 13 | return this; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/JDACommandExecutionContext.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | public class JDACommandExecutionContext extends CommandExecutionContext { 7 | JDACommandExecutionContext(RegisteredCommand cmd, CommandParameter param, JDACommandEvent sender, List args, int index, Map passedArgs) { 8 | super(cmd, param, sender, args, index, passedArgs); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/JDAMessageFormatter.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | public class JDAMessageFormatter extends MessageFormatter { 4 | public JDAMessageFormatter() { 5 | // JDA does not support coloring messages outside of embed fields. 6 | // We pass three empty strings so as to remove color coded messages from appearing. 7 | super("", "", ""); 8 | } 9 | 10 | @Override 11 | String format(String color, String message) { 12 | return message; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/JDACommandConfig.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import java.util.List; 6 | import java.util.concurrent.CopyOnWriteArrayList; 7 | 8 | public class JDACommandConfig implements CommandConfig { 9 | protected @NotNull List commandPrefixes = new CopyOnWriteArrayList<>(new String[]{"!"}); 10 | 11 | public JDACommandConfig() { 12 | 13 | } 14 | 15 | @NotNull 16 | public List getCommandPrefixes() { 17 | return commandPrefixes; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/annotation/SelfUser.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * The {@link SelfUser} annotation is to define whether the parameter should be represented by JDA's user object 10 | * or if it should be parsed from command input. 11 | */ 12 | @Target(ElementType.PARAMETER) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface SelfUser { 15 | } 16 | -------------------------------------------------------------------------------- /.idea/saveactions_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 16 | -------------------------------------------------------------------------------- /bungee/src/main/java/co/aikar/commands/MinecraftMessageKeys.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import co.aikar.locales.MessageKey; 4 | import co.aikar.locales.MessageKeyProvider; 5 | 6 | public enum MinecraftMessageKeys implements MessageKeyProvider { 7 | USERNAME_TOO_SHORT, 8 | IS_NOT_A_VALID_NAME, 9 | MULTIPLE_PLAYERS_MATCH, 10 | NO_PLAYER_FOUND_SERVER, 11 | NO_PLAYER_FOUND 12 | ; 13 | 14 | private final MessageKey key = MessageKey.of("acf-minecraft." + this.name().toLowerCase()); 15 | public MessageKey getMessageKey() { 16 | return key; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | .DS_Store 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | .idea/workspace.xml 7 | .idea/dictionaries 8 | .idea/misc.xml 9 | .idea/libraries 10 | .idea/uiDesigner.xml 11 | .idea/kotlinc.xml 12 | .idea/modules.xml 13 | .idea/usage.statistics.xml 14 | .idea/checkstyle-idea.xml 15 | **/*.iml 16 | 17 | 18 | # Package Files # 19 | *.jar 20 | *.war 21 | *.ear 22 | 23 | */target 24 | target 25 | 26 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 27 | hs_err_pid* 28 | 29 | # eclipse project file 30 | .settings/ 31 | .classpath 32 | .project 33 | 34 | -------------------------------------------------------------------------------- /sponge/src/main/java/co/aikar/commands/SpongeMessageFormatter.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import org.spongepowered.api.text.Text; 4 | import org.spongepowered.api.text.format.TextColor; 5 | import org.spongepowered.api.text.serializer.TextSerializers; 6 | 7 | public class SpongeMessageFormatter extends MessageFormatter { 8 | 9 | public SpongeMessageFormatter(TextColor... colors) { 10 | super(colors); 11 | } 12 | 13 | public String format(TextColor color, String message) { 14 | return TextSerializers.LEGACY_FORMATTING_CODE.serialize(Text.of(color, message)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bungee/src/main/java/co/aikar/commands/BungeeConditionContext.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import net.md_5.bungee.api.CommandSender; 4 | import net.md_5.bungee.api.connection.ProxiedPlayer; 5 | 6 | public class BungeeConditionContext extends ConditionContext { 7 | BungeeConditionContext(BungeeCommandIssuer issuer, String config) { 8 | super(issuer, config); 9 | } 10 | 11 | 12 | public CommandSender getSender() { 13 | return getIssuer().getIssuer(); 14 | } 15 | 16 | public ProxiedPlayer getPlayer() { 17 | return getIssuer().getPlayer(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /sponge/src/main/java/co/aikar/commands/SpongeConditionContext.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import org.spongepowered.api.command.CommandSource; 4 | import org.spongepowered.api.entity.living.player.Player; 5 | 6 | public class SpongeConditionContext extends ConditionContext { 7 | SpongeConditionContext(SpongeCommandIssuer issuer, String config) { 8 | super(issuer, config); 9 | } 10 | 11 | 12 | public CommandSource getSource() { 13 | return getIssuer().getIssuer(); 14 | } 15 | 16 | public Player getPlayer() { 17 | return getIssuer().getPlayer(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/annotation/Author.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * The {@link Author} annotation is to define whether the parameter should be the author object from the event or 10 | * parsed from the user's input. 11 | *

12 | * Using this on a User/Member will fetch the author and otherwise it'll parse the input. 13 | *

14 | */ 15 | @Target(ElementType.PARAMETER) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | public @interface Author { 18 | } 19 | -------------------------------------------------------------------------------- /sponge/src/main/java/co/aikar/commands/SpongeLocales.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | public class SpongeLocales extends Locales{ 4 | private final SpongeCommandManager manager; 5 | 6 | public SpongeLocales(SpongeCommandManager manager) { 7 | super(manager); 8 | this.manager = manager; 9 | this.addBundleClassLoader(this.manager.getPlugin().getClass().getClassLoader()); 10 | } 11 | 12 | @Override 13 | public void loadLanguages() { 14 | super.loadLanguages(); 15 | String pluginName = "acf-" + manager.plugin.getName(); 16 | addMessageBundles("acf-minecraft", pluginName, pluginName.toLowerCase()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /bungee/src/main/java/co/aikar/commands/BungeeLocales.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | public class BungeeLocales extends Locales { 4 | private final BungeeCommandManager manager; 5 | 6 | public BungeeLocales(BungeeCommandManager manager) { 7 | super(manager); 8 | 9 | this.manager = manager; 10 | this.addBundleClassLoader(this.manager.getPlugin().getClass().getClassLoader()); 11 | } 12 | 13 | @Override 14 | public void loadLanguages() { 15 | super.loadLanguages(); 16 | String pluginName = "acf-" + manager.plugin.getDescription().getName(); 17 | addMessageBundles("acf-minecraft", pluginName, pluginName.toLowerCase()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /sponge/src/main/java/co/aikar/commands/contexts/CommandResultSupplier.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands.contexts; 2 | 3 | import co.aikar.commands.CommandManager; 4 | import co.aikar.commands.SpongeCommandOperationContext; 5 | import org.spongepowered.api.command.CommandResult; 6 | 7 | import java.util.function.Consumer; 8 | 9 | public class CommandResultSupplier implements Consumer { 10 | 11 | public CommandResultSupplier() { 12 | } 13 | 14 | @Override 15 | public void accept(CommandResult commandResult) { 16 | SpongeCommandOperationContext context = (SpongeCommandOperationContext) CommandManager.getCurrentCommandOperationContext(); 17 | context.setResult(commandResult); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /sponge/src/main/java/co/aikar/commands/SpongeCommandOperationContext.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import org.spongepowered.api.command.CommandResult; 4 | 5 | public class SpongeCommandOperationContext extends CommandOperationContext { 6 | private CommandResult result = CommandResult.success(); 7 | SpongeCommandOperationContext(CommandManager manager, CommandIssuer issuer, BaseCommand command, String commandLabel, String[] args, boolean isAsync) { 8 | super(manager, issuer, command, commandLabel, args, isAsync); 9 | } 10 | 11 | public CommandResult getResult() { 12 | return result; 13 | } 14 | 15 | public void setResult(CommandResult result) { 16 | this.result = result; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/annotation/CrossGuild.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * The {@link CrossGuild} annotation is to define whether the parameter should be guild-specific or global. 10 | *

11 | * If a supported parameter is marked with the CrossGuild annotation, the parameter will be filled from 12 | * a global perspective (i.e., all of the guilds the bot is connected to). Otherwise, the parameter will 13 | * be filled from command input. 14 | *

15 | */ 16 | @Target(ElementType.PARAMETER) 17 | @Retention(RetentionPolicy.RUNTIME) 18 | public @interface CrossGuild { 19 | } 20 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/JDAListener.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import net.dv8tion.jda.core.entities.ChannelType; 4 | import net.dv8tion.jda.core.events.ReadyEvent; 5 | import net.dv8tion.jda.core.events.message.MessageReceivedEvent; 6 | import net.dv8tion.jda.core.hooks.ListenerAdapter; 7 | 8 | public class JDAListener extends ListenerAdapter { 9 | 10 | private final JDACommandManager manager; 11 | 12 | JDAListener(JDACommandManager manager) { 13 | 14 | this.manager = manager; 15 | } 16 | 17 | @Override 18 | public void onMessageReceived(MessageReceivedEvent event) { 19 | if (event.isFromType(ChannelType.TEXT) || event.isFromType(ChannelType.PRIVATE)) { 20 | this.manager.dispatchEvent(event); 21 | } 22 | } 23 | 24 | @Override 25 | public void onReady(ReadyEvent event) { 26 | manager.initializeBotOwner(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /docs/acf-bukkit/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/acf-bungee/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/acf-core/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/acf-jda/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/acf-paper/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/acf-sponge/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/acf-bukkit/co/aikar/commands/contexts/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | co.aikar.commands.contexts (ACF (Bukkit) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 |

co.aikar.commands.contexts

13 |
14 |

Classes

15 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/acf-bungee/co/aikar/commands/contexts/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | co.aikar.commands.contexts (ACF (Bungee) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 |

co.aikar.commands.contexts

13 |
14 |

Classes

15 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/acf-core/co/aikar/commands/processors/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | co.aikar.commands.processors (ACF (Core) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 |

co.aikar.commands.processors

13 |
14 |

Classes

15 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/acf-jda/overview-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Overview List (ACF (JDA) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 | 13 |
14 |

Packages

15 | 19 |
20 |

 

21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/acf-bukkit/overview-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Overview List (ACF (Bukkit) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 | 13 |
14 |

Packages

15 | 19 |
20 |

 

21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/acf-bungee/overview-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Overview List (ACF (Bungee) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 | 13 |
14 |

Packages

15 | 19 |
20 |

 

21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/acf-paper/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (ACF (Paper) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/acf-sponge/overview-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Overview List (ACF (Sponge) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 | 13 |
14 |

Packages

15 | 19 |
20 |

 

21 | 22 | 23 | -------------------------------------------------------------------------------- /.idea/runConfigurations/ACF__All_.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /.idea/runConfigurations/ACF__Core_Only_.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | This won't have everything ever changed in ACF, but will mainly note API breakages and Migration Guide links 3 | 4 | 5 | ## 0.5.0 6 | ***Main Goals:*** 7 | * Refactor the project into a modular, and game agnostic core. 8 | * Moves bukkit and paper manages into their own standalone artifacts 9 | * Adds support for Bungee & Sponge 10 | * Update Command Completion Context Handlers to be implemented like Context Resolvers 11 | * Lots of significant API changes that will require changes from users 12 | 13 | ***Migration Guide:*** [0.4.0 -> 0.5.0 Migration Guide](https://github.com/aikar/commands/wiki/Migrating-from-0.4.0-to-0.5.0) 14 | 15 | ## 0.4.0 16 | * Added support for Completion Context to add additional information about completion context 17 | * [Migration Guide](https://www.spigotmc.org/threads/acf-beta-annotation-command-framework.234266/page-2#post-2385699) 18 | 19 | ## 0.2.0 and 0.3.0 20 | * Changed group ID and artifact ID/name around to be consistent with [TaskChain](https://taskchain.emc.gs) 21 | 22 | ## 0.1.0 23 | Initial release 24 | -------------------------------------------------------------------------------- /docs/acf-paper/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (ACF (Paper) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/JDAOptions.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import net.dv8tion.jda.core.JDA; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public class JDAOptions { 7 | CommandConfig defaultConfig = new JDACommandConfig(); 8 | CommandConfigProvider configProvider = null; 9 | CommandPermissionResolver permissionResolver = new JDACommandPermissionResolver(); 10 | 11 | public JDAOptions() { 12 | } 13 | 14 | public JDAOptions defaultConfig(@NotNull CommandConfig defaultConfig) { 15 | this.defaultConfig = defaultConfig; 16 | return this; 17 | } 18 | 19 | public JDAOptions configProvider(@NotNull CommandConfigProvider configProvider) { 20 | this.configProvider = configProvider; 21 | return this; 22 | } 23 | 24 | public JDAOptions permissionResolver(@NotNull CommandPermissionResolver permissionResolver) { 25 | this.permissionResolver = permissionResolver; 26 | return this; 27 | } 28 | 29 | public JDACommandManager create(JDA jda) { 30 | return new JDACommandManager(jda, this); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /docs/acf-sponge/co/aikar/commands/contexts/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | co.aikar.commands.contexts (ACF (Sponge) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 |

co.aikar.commands.contexts

13 |
14 |

Classes

15 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/runConfigurations/ACF__Core___Bukkit_.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 | 24 | 25 | 27 | 28 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | # Contributors to ACF 2 | Below are the following people who have contributed to ACF. 3 | 4 | If you open a PR and are not already in this file, please feel free to add yourself in the PR (With what ever information you want to be public), and if desired, what you contributed. 5 | 6 | * [***Daniel Ennis / Aikar***](https://github.com/aikar/commands/commits?author=aikar) - Main Author / Project Lead 7 | * [***chickeneer***](https://github.com/aikar/commands/commits?author=chickeneer) - ACF Team 8 | * [***MiniDigger***](https://github.com/aikar/commands/commits?author=MiniDigger) - Dependency Injection Support, Exception Handlers 9 | * [***simpleauthority***](https://github.com/aikar/commands/commits?author=simpleauthority) 10 | * [***kashike***](https://github.com/aikar/commands/commits?author=kashike) - Sponge Support, Random nit picks 11 | * [***Williambraecky***](https://github.com/aikar/commands/commits?author=Williambraecky) - BungeeCord Support 12 | * [***dumptruckman***](https://github.com/aikar/commands/commits?author=dumptruckman) - JDA Support 13 | * [***willies952002***](https://github.com/aikar/commands/commits?author=willies952002) 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2015-2018 Daniel Ennis and Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/acf-paper/co/aikar/commands/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | co.aikar.commands (ACF (Paper) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 |

co.aikar.commands

13 |
14 |

Classes

15 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /sponge/src/main/java/co/aikar/commands/ACFSpongeListener.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import org.spongepowered.api.entity.living.player.Player; 4 | import org.spongepowered.api.event.Listener; 5 | import org.spongepowered.api.event.Order; 6 | import org.spongepowered.api.event.entity.living.humanoid.player.PlayerChangeClientSettingsEvent; 7 | import org.spongepowered.api.event.filter.cause.First; 8 | import org.spongepowered.api.event.network.ClientConnectionEvent; 9 | 10 | public class ACFSpongeListener { 11 | 12 | private final SpongeCommandManager manager; 13 | 14 | public ACFSpongeListener(SpongeCommandManager manager) { 15 | this.manager = manager; 16 | } 17 | 18 | @Listener(order = Order.POST) 19 | public void onSettingsChange(PlayerChangeClientSettingsEvent changeSettingsEvent, @First Player targetPlayer) { 20 | //this event will be fired on join as well as every time the player changes it 21 | manager.setIssuerLocale(targetPlayer, targetPlayer.getLocale()); 22 | } 23 | 24 | @Listener 25 | public void onDisconnectCleanup(ClientConnectionEvent.Disconnect disconnectEvent, @First Player player) { 26 | manager.issuersLocale.remove(player.getUniqueId()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /docs/acf-jda/co/aikar/commands/annotation/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | co.aikar.commands.annotation (ACF (JDA) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 |

co.aikar.commands.annotation

13 |
14 |

Annotation Types

15 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /.idea/runConfigurations/ACF__Core___Bukkit___Paper_.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 | 24 | 25 | 28 | 29 | -------------------------------------------------------------------------------- /docs/acf-jda/src-html/co/aikar/commands/CommandPermissionResolver.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Source code 5 | 6 | 7 | 8 |
9 |
001package co.aikar.commands;
10 | 002
11 | 003
12 | 004public interface CommandPermissionResolver {
13 | 005    boolean hasPermission(JDACommandManager manager, JDACommandEvent event, String permission);
14 | 006}
15 | 
16 | 
17 | 
18 | 
19 | 
20 | 
21 | 
22 | 
23 | 
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 | 
31 | 
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 | 
44 | 
45 | 
46 | 
47 | 
48 | 
49 | 
50 | 
51 | 
52 | 
53 | 
54 | 
55 | 
56 | 
57 | 
58 | 
59 | 
60 | 
61 | 
62 | 
63 | 
64 | 
65 | 
66 | 
67 | 
68 | 
69 | 
70 | 
71 | 
72 | 
73 | 
74 | 
75 | 
76 |
77 | 78 | 79 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 34 | -------------------------------------------------------------------------------- /.idea/runConfigurations/ACF__Core___Bukkit___Example_.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 24 | 25 | 26 | 29 | 30 | -------------------------------------------------------------------------------- /docs/acf-jda/src-html/co/aikar/commands/JDALocales.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Source code 5 | 6 | 7 | 8 |
9 |
001package co.aikar.commands;
10 | 002
11 | 003public class JDALocales extends Locales {
12 | 004    public JDALocales(CommandManager manager) {
13 | 005        super(manager);
14 | 006    }
15 | 007}
16 | 
17 | 
18 | 
19 | 
20 | 
21 | 
22 | 
23 | 
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 | 
31 | 
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 | 
44 | 
45 | 
46 | 
47 | 
48 | 
49 | 
50 | 
51 | 
52 | 
53 | 
54 | 
55 | 
56 | 
57 | 
58 | 
59 | 
60 | 
61 | 
62 | 
63 | 
64 | 
65 | 
66 | 
67 | 
68 | 
69 | 
70 | 
71 | 
72 | 
73 | 
74 | 
75 | 
76 | 
77 |
78 | 79 | 80 | -------------------------------------------------------------------------------- /.idea/copyright/MIT.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /docs/acf-jda/src-html/co/aikar/commands/CommandConfigProvider.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Source code 5 | 6 | 7 | 8 |
9 |
001package co.aikar.commands;
10 | 002
11 | 003import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
12 | 004
13 | 005public interface CommandConfigProvider {
14 | 006    CommandConfig provide(MessageReceivedEvent event);
15 | 007}
16 | 
17 | 
18 | 
19 | 
20 | 
21 | 
22 | 
23 | 
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 | 
31 | 
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 | 
44 | 
45 | 
46 | 
47 | 
48 | 
49 | 
50 | 
51 | 
52 | 
53 | 
54 | 
55 | 
56 | 
57 | 
58 | 
59 | 
60 | 
61 | 
62 | 
63 | 
64 | 
65 | 
66 | 
67 | 
68 | 
69 | 
70 | 
71 | 
72 | 
73 | 
74 | 
75 | 
76 | 
77 |
78 | 79 | 80 | -------------------------------------------------------------------------------- /docs/acf-core/overview-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Overview List (ACF (Core) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 | 13 | 23 |

 

24 | 25 | 26 | -------------------------------------------------------------------------------- /docs/acf-jda/src-html/co/aikar/commands/JDAConditionContext.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Source code 5 | 6 | 7 | 8 |
9 |
001package co.aikar.commands;
10 | 002
11 | 003public class JDAConditionContext extends ConditionContext<JDACommandEvent> {
12 | 004    JDAConditionContext(JDACommandEvent issuer, String config) {
13 | 005        super(issuer, config);
14 | 006    }
15 | 007}
16 | 
17 | 
18 | 
19 | 
20 | 
21 | 
22 | 
23 | 
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 | 
31 | 
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 | 
44 | 
45 | 
46 | 
47 | 
48 | 
49 | 
50 | 
51 | 
52 | 
53 | 
54 | 
55 | 
56 | 
57 | 
58 | 
59 | 
60 | 
61 | 
62 | 
63 | 
64 | 
65 | 
66 | 
67 | 
68 | 
69 | 
70 | 
71 | 
72 | 
73 | 
74 | 
75 | 
76 | 
77 |
78 | 79 | 80 | -------------------------------------------------------------------------------- /bungee/src/main/java/co/aikar/commands/ACFBungeeListener.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import net.md_5.bungee.api.connection.ProxiedPlayer; 4 | import net.md_5.bungee.api.event.PlayerDisconnectEvent; 5 | import net.md_5.bungee.api.event.PostLoginEvent; 6 | import net.md_5.bungee.api.plugin.Listener; 7 | import net.md_5.bungee.api.plugin.Plugin; 8 | import net.md_5.bungee.event.EventHandler; 9 | 10 | import java.util.concurrent.TimeUnit; 11 | 12 | public class ACFBungeeListener implements Listener { 13 | 14 | private final BungeeCommandManager manager; 15 | private final Plugin plugin; 16 | 17 | public ACFBungeeListener(BungeeCommandManager manager, Plugin plugin) { 18 | this.manager = manager; 19 | this.plugin = plugin; 20 | } 21 | 22 | @EventHandler 23 | public void onPlayerJoin(PostLoginEvent loginEvent) { 24 | ProxiedPlayer player = loginEvent.getPlayer(); 25 | 26 | //the client settings are sent after a successful login 27 | Runnable task = () -> manager.readLocale(player); 28 | plugin.getProxy().getScheduler().schedule(plugin, task, 1, TimeUnit.SECONDS); 29 | } 30 | 31 | @EventHandler 32 | public void onDisconnect(PlayerDisconnectEvent disconnectEvent) { 33 | //cleanup 34 | ProxiedPlayer player = disconnectEvent.getPlayer(); 35 | manager.issuersLocale.remove(player.getUniqueId()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/CommandCompletionTextLookupException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | class CommandCompletionTextLookupException extends Throwable { 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/LogLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | enum LogLevel { 27 | INFO, 28 | ERROR; 29 | 30 | static final String LOG_PREFIX = "[ACF] "; 31 | } 32 | -------------------------------------------------------------------------------- /docs/acf-core/co/aikar/commands/apachecommonslang/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | co.aikar.commands.apachecommonslang (ACF (Core) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 |

co.aikar.commands.apachecommonslang

13 |
14 |

Interfaces

15 | 18 |

Classes

19 | 23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/UnstableAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import java.lang.annotation.Retention; 27 | import java.lang.annotation.RetentionPolicy; 28 | 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Deprecated 31 | public @interface UnstableAPI {} 32 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/InvalidCommandContextException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | public class InvalidCommandContextException extends RuntimeException { 27 | InvalidCommandContextException(String message) { 28 | super(message); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/IssuerLocaleChangedCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import java.util.Locale; 27 | 28 | public interface IssuerLocaleChangedCallback { 29 | void onIssuerLocaleChange(I issuer, Locale oldLocale, Locale newLocale); 30 | } 31 | -------------------------------------------------------------------------------- /paper/src/main/java/co/aikar/commands/PaperCommandContexts.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | @SuppressWarnings("WeakerAccess") 27 | public class PaperCommandContexts extends BukkitCommandContexts { 28 | public PaperCommandContexts(PaperCommandManager manager) { 29 | super(manager); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/JDACommandPermissionResolver.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import net.dv8tion.jda.core.Permission; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | public class JDACommandPermissionResolver implements CommandPermissionResolver { 9 | private Map discordPermissionOffsets; 10 | 11 | public JDACommandPermissionResolver() { 12 | discordPermissionOffsets = new HashMap<>(); 13 | for (Permission permission : Permission.values()) { 14 | discordPermissionOffsets.put(permission.name().toLowerCase().replaceAll("_", "-"), permission.getOffset()); 15 | } 16 | } 17 | 18 | @Override 19 | public boolean hasPermission(JDACommandManager manager, JDACommandEvent event, String permission) { 20 | // Explicitly return true if the issuer is the bot's owner. They are always allowed. 21 | if (manager.getBotOwnerId() == event.getIssuer().getAuthor().getIdLong()) { 22 | return true; 23 | } 24 | 25 | // Return false on webhook messages, as they cannot have permissions defined. 26 | if (event.getIssuer().isWebhookMessage()) { 27 | return false; 28 | } 29 | 30 | Integer permissionOffset = discordPermissionOffsets.get(permission); 31 | if (permissionOffset == null) { 32 | return false; 33 | } 34 | 35 | return event.getIssuer().getMember().hasPermission( 36 | Permission.getFromOffset(permissionOffset) 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /paper/src/main/java/co/aikar/commands/PaperCommandCompletions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | @SuppressWarnings("WeakerAccess") 27 | public class PaperCommandCompletions extends BukkitCommandCompletions { 28 | public PaperCommandCompletions(PaperCommandManager manager) { 29 | super(manager); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/JDACommandCompletions.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import java.util.Collections; 6 | import java.util.List; 7 | 8 | public class JDACommandCompletions extends CommandCompletions> { 9 | private boolean initialized; 10 | 11 | public JDACommandCompletions(CommandManager manager) { 12 | super(manager); 13 | this.initialized = true; 14 | } 15 | 16 | @Override 17 | public CommandCompletionHandler registerCompletion(String id, CommandCompletionHandler> handler) { 18 | if (initialized) { 19 | throw new UnsupportedOperationException("JDA Doesn't support Command Completions"); 20 | } 21 | return null; 22 | } 23 | 24 | @Override 25 | public CommandCompletionHandler registerAsyncCompletion(String id, AsyncCommandCompletionHandler> handler) { 26 | if (initialized) { 27 | throw new UnsupportedOperationException("JDA Doesn't support Command Completions"); 28 | } 29 | return null; 30 | } 31 | 32 | @NotNull 33 | @Override 34 | List of(RegisteredCommand command, CommandIssuer sender, String[] args, boolean isAsync) { 35 | return Collections.emptyList(); 36 | } 37 | 38 | @Override 39 | List getCompletionValues(RegisteredCommand command, CommandIssuer sender, String completion, String[] args, boolean isAsync) { 40 | return Collections.emptyList(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /sponge/src/main/java/co/aikar/commands/SpongeCommandCompletions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | @SuppressWarnings("WeakerAccess") 27 | public class SpongeCommandCompletions extends CommandCompletions { 28 | 29 | public SpongeCommandCompletions(final SpongeCommandManager manager) { 30 | super(manager); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/contexts/IssuerAwareContextResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.contexts; 25 | 26 | import co.aikar.commands.CommandExecutionContext; 27 | import co.aikar.commands.CommandIssuer; 28 | 29 | 30 | public interface IssuerAwareContextResolver> extends ContextResolver {} 31 | -------------------------------------------------------------------------------- /bungee/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | acf-parent 7 | co.aikar 8 | 0.5.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | acf-bungee 13 | 0.5.0-SNAPSHOT 14 | 15 | ACF (Bungee) 16 | 17 | 18 | 19 | sonatype-snapshots 20 | https://oss.sonatype.org/content/repositories/snapshots 21 | 22 | 23 | 24 | 25 | 26 | 27 | co.aikar 28 | acf-core 29 | 0.5.0-SNAPSHOT 30 | compile 31 | 32 | 33 | net.md-5 34 | bungeecord-api 35 | 1.12-SNAPSHOT 36 | provided 37 | 38 | 39 | 40 | 41 | 42 | ${project.basedir}/../languages/minecraft/ 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /bukkit/src/main/java/co/aikar/commands/BukkitMessageFormatter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import org.bukkit.ChatColor; 27 | 28 | public class BukkitMessageFormatter extends MessageFormatter { 29 | 30 | public BukkitMessageFormatter(ChatColor... colors) { 31 | super(colors); 32 | } 33 | 34 | @Override 35 | String format(ChatColor color, String message) { 36 | return color + message; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/UnresolvedDependencyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2018 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | /** 27 | * Thrown when a command mananger couldn't find a registered instance for a field that is marked with 28 | * {@link co.aikar.commands.annotation.Dependency} 29 | */ 30 | public class UnresolvedDependencyException extends RuntimeException { 31 | UnresolvedDependencyException(String message) { 32 | super(message); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/JDARootCommand.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import com.google.common.collect.HashMultimap; 4 | import com.google.common.collect.SetMultimap; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | public class JDARootCommand implements RootCommand { 10 | 11 | private final String name; 12 | boolean isRegistered = false; 13 | private JDACommandManager manager; 14 | private BaseCommand defCommand; 15 | private SetMultimap subCommands = HashMultimap.create(); 16 | private List children = new ArrayList<>(); 17 | 18 | JDARootCommand(JDACommandManager manager, String name) { 19 | this.manager = manager; 20 | this.name = name; 21 | } 22 | 23 | @Override 24 | 25 | public void addChild(BaseCommand command) { 26 | if (this.defCommand == null || !command.subCommands.get(BaseCommand.DEFAULT).isEmpty()) { 27 | this.defCommand = command; 28 | } 29 | addChildShared(this.children, this.subCommands, command); 30 | } 31 | 32 | @Override 33 | public CommandManager getManager() { 34 | return this.manager; 35 | } 36 | 37 | @Override 38 | public SetMultimap getSubCommands() { 39 | return this.subCommands; 40 | } 41 | 42 | @Override 43 | public List getChildren() { 44 | return this.children; 45 | } 46 | 47 | @Override 48 | public String getCommandName() { 49 | return this.name; 50 | } 51 | 52 | @Override 53 | public BaseCommand getDefCommand() { 54 | return defCommand; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/PreCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | 27 | import java.lang.annotation.ElementType; 28 | import java.lang.annotation.Retention; 29 | import java.lang.annotation.RetentionPolicy; 30 | import java.lang.annotation.Target; 31 | 32 | /** 33 | * This runs before any other command method each time it is invoked. 34 | */ 35 | @Retention(RetentionPolicy.RUNTIME) 36 | @Target({ElementType.METHOD}) 37 | public @interface PreCommand {} 38 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/CatchAll.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2018 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * @deprecated Use {@link CatchUnknown instead, which is more accurately named} 33 | */ 34 | @Deprecated 35 | @Retention(RetentionPolicy.RUNTIME) 36 | @Target({ElementType.METHOD}) 37 | public @interface CatchAll {} 38 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/Private.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2018 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * Marks a command to not be included in stuff like tab completion and help pages 33 | */ 34 | @Retention(RetentionPolicy.RUNTIME) 35 | @Target({ElementType.METHOD, ElementType.TYPE}) 36 | public @interface Private { 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/Single.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * Don't join remaining arguments. Used on String parameters, which normally would combine the remaining arguments 33 | */ 34 | @Retention(RetentionPolicy.RUNTIME) 35 | @Target({ElementType.PARAMETER}) 36 | public @interface Single {} 37 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/UnknownHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | 27 | import java.lang.annotation.ElementType; 28 | import java.lang.annotation.Retention; 29 | import java.lang.annotation.RetentionPolicy; 30 | import java.lang.annotation.Target; 31 | 32 | /** 33 | * @deprecated Use {@link CatchUnknown instead, which is more accurately named} 34 | */ 35 | @Deprecated 36 | @Retention(RetentionPolicy.RUNTIME) 37 | @Target({ElementType.METHOD}) 38 | public @interface UnknownHandler {} 39 | -------------------------------------------------------------------------------- /docs/acf-core/co/aikar/commands/contexts/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | co.aikar.commands.contexts (ACF (Core) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 |

co.aikar.commands.contexts

13 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/contexts/IssuerOnlyContextResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.contexts; 25 | 26 | import co.aikar.commands.CommandExecutionContext; 27 | import co.aikar.commands.CommandIssuer; 28 | 29 | /** 30 | * A context resolver that will never consume input, and only resolves using the context of the issuer of the command 31 | * @param 32 | * @param 33 | */ 34 | public interface IssuerOnlyContextResolver> extends ContextResolver {} 35 | -------------------------------------------------------------------------------- /docs/acf-bungee/src-html/co/aikar/commands/BungeeParameterConditionContext.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Source code 5 | 6 | 7 | 8 |
9 |
001package co.aikar.commands;
10 | 002
11 | 003import co.aikar.commands.annotation.Conditions;
12 | 004
13 | 005public class BungeeParameterConditionContext <P> extends ParameterConditionContext<P, BungeeCommandExecutionContext, BungeeCommandIssuer> {
14 | 006    BungeeParameterConditionContext(RegisteredCommand cmd, BungeeCommandIssuer issuer, BungeeCommandExecutionContext execContext, Conditions conditions) {
15 | 007        super(cmd, issuer, execContext, conditions);
16 | 008    }
17 | 009}
18 | 
19 | 
20 | 
21 | 
22 | 
23 | 
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 | 
31 | 
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 | 
44 | 
45 | 
46 | 
47 | 
48 | 
49 | 
50 | 
51 | 
52 | 
53 | 
54 | 
55 | 
56 | 
57 | 
58 | 
59 | 
60 | 
61 | 
62 | 
63 | 
64 | 
65 | 
66 | 
67 | 
68 | 
69 | 
70 | 
71 | 
72 | 
73 | 
74 | 
75 | 
76 | 
77 | 
78 | 
79 |
80 | 81 | 82 | -------------------------------------------------------------------------------- /docs/acf-sponge/src-html/co/aikar/commands/SpongeParameterConditionContext.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Source code 5 | 6 | 7 | 8 |
9 |
001package co.aikar.commands;
10 | 002
11 | 003import co.aikar.commands.annotation.Conditions;
12 | 004
13 | 005public class SpongeParameterConditionContext <P> extends ParameterConditionContext<P, SpongeCommandExecutionContext, SpongeCommandIssuer> {
14 | 006    SpongeParameterConditionContext(RegisteredCommand cmd, SpongeCommandIssuer issuer, SpongeCommandExecutionContext execContext, Conditions conditions) {
15 | 007        super(cmd, issuer, execContext, conditions);
16 | 008    }
17 | 009}
18 | 
19 | 
20 | 
21 | 
22 | 
23 | 
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 | 
31 | 
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 | 
44 | 
45 | 
46 | 
47 | 
48 | 
49 | 
50 | 
51 | 
52 | 
53 | 
54 | 
55 | 
56 | 
57 | 
58 | 
59 | 
60 | 
61 | 
62 | 
63 | 
64 | 
65 | 
66 | 
67 | 
68 | 
69 | 
70 | 
71 | 
72 | 
73 | 
74 | 
75 | 
76 | 
77 | 
78 | 
79 |
80 | 81 | 82 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/ShowCommandHelp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2018 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import java.util.ArrayList; 27 | import java.util.List; 28 | 29 | public class ShowCommandHelp extends InvalidCommandArgument { 30 | List searchArgs = null; 31 | boolean search = false; 32 | ShowCommandHelp() { 33 | 34 | } 35 | ShowCommandHelp(boolean search) { 36 | this.search = search; 37 | } 38 | ShowCommandHelp(List args) { 39 | this(true); 40 | this.searchArgs = new ArrayList<>(args); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/contexts/SenderAwareContextResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.contexts; 25 | 26 | import co.aikar.commands.CommandExecutionContext; 27 | import co.aikar.commands.CommandIssuer; 28 | 29 | /** 30 | * Wrapper for IssuerAwareContextResolver 31 | * 32 | * @deprecated Please use {@link IssuerAwareContextResolver} 33 | * @see IssuerAwareContextResolver 34 | */ 35 | @Deprecated 36 | public interface SenderAwareContextResolver> extends IssuerAwareContextResolver {} 37 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/Description.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * Sets a description to the parameter or method this is attached to. 33 | * This is used in the help menus. 34 | */ 35 | @Retention(RetentionPolicy.RUNTIME) 36 | @Target({ElementType.METHOD, ElementType.PARAMETER}) 37 | public @interface Description { 38 | String value(); 39 | } 40 | -------------------------------------------------------------------------------- /docs/acf-jda/src-html/co/aikar/commands/JDACommandExecutionContext.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Source code 5 | 6 | 7 | 8 |
9 |
001package co.aikar.commands;
10 | 002
11 | 003import java.util.List;
12 | 004import java.util.Map;
13 | 005
14 | 006public class JDACommandExecutionContext extends CommandExecutionContext<JDACommandExecutionContext, JDACommandEvent> {
15 | 007    JDACommandExecutionContext(RegisteredCommand cmd, CommandParameter param, JDACommandEvent sender, List<String> args, int index, Map<String, Object> passedArgs) {
16 | 008        super(cmd, param, sender, args, index, passedArgs);
17 | 009    }
18 | 010}
19 | 
20 | 
21 | 
22 | 
23 | 
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 | 
31 | 
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 | 
44 | 
45 | 
46 | 
47 | 
48 | 
49 | 
50 | 
51 | 
52 | 
53 | 
54 | 
55 | 
56 | 
57 | 
58 | 
59 | 
60 | 
61 | 
62 | 
63 | 
64 | 
65 | 
66 | 
67 | 
68 | 
69 | 
70 | 
71 | 
72 | 
73 | 
74 | 
75 | 
76 | 
77 | 
78 | 
79 | 
80 |
81 | 82 | 83 | -------------------------------------------------------------------------------- /bukkit/src/main/java/co/aikar/commands/BukkitConditionContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import org.bukkit.command.CommandSender; 27 | import org.bukkit.entity.Player; 28 | 29 | public class BukkitConditionContext extends ConditionContext { 30 | BukkitConditionContext(BukkitCommandIssuer issuer, String config) { 31 | super(issuer, config); 32 | } 33 | 34 | public CommandSender getSender() { 35 | return getIssuer().getIssuer(); 36 | } 37 | 38 | public Player getPlayer() { 39 | return getIssuer().getPlayer(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/contexts/OptionalContextResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.contexts; 25 | 26 | import co.aikar.commands.CommandExecutionContext; 27 | import co.aikar.commands.CommandIssuer; 28 | 29 | /** 30 | * The same as {@link ContextResolver}, however it can accept a null context. 31 | * 32 | * If the parameter was marked optional, will still be called with an empty args list 33 | * 34 | * @param 35 | * @param 36 | */ 37 | public interface OptionalContextResolver > extends ContextResolver {} 38 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/Split.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | 27 | import java.lang.annotation.ElementType; 28 | import java.lang.annotation.Retention; 29 | import java.lang.annotation.RetentionPolicy; 30 | import java.lang.annotation.Target; 31 | 32 | /** 33 | * Joins arguments into a single piece of text with the specified separator. 34 | * For array based parameters, defines the regex pattern to split on 35 | */ 36 | @Retention(RetentionPolicy.RUNTIME) 37 | @Target({ElementType.PARAMETER}) 38 | public @interface Split { 39 | String value() default ","; 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/CommandPermission.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * Sets the permission required to perform this command. 33 | * 34 | * Permission format will vary based on implementation platform 35 | */ 36 | @Retention(RetentionPolicy.RUNTIME) 37 | @Target({ElementType.METHOD, ElementType.TYPE}) 38 | public @interface CommandPermission { 39 | String value(); 40 | } 41 | -------------------------------------------------------------------------------- /bungee/src/main/java/co/aikar/commands/BungeeRegisteredCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import java.lang.reflect.Method; 27 | 28 | public class BungeeRegisteredCommand extends RegisteredCommand { 29 | 30 | BungeeRegisteredCommand(BaseCommand scope, String command, Method method, String prefSubCommand) { 31 | super(scope, command, method, prefSubCommand); 32 | } 33 | 34 | @Override 35 | public void preCommand() { 36 | super.preCommand(); 37 | } 38 | 39 | @Override 40 | public void postCommand() { 41 | super.postCommand(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/Default.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * If used on a method, sets default command handler for the root command of this group 33 | * If used on a parameter, sets the value to be used for context resolution 34 | */ 35 | @Retention(RetentionPolicy.RUNTIME) 36 | @Target({ElementType.METHOD, ElementType.PARAMETER}) 37 | public @interface Default { 38 | String value() default ""; 39 | } 40 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/Values.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * Specifies a list of values that the command input should be validated against, or else show an error. 33 | * 34 | * You may also use {@link CommandCompletion} handler codes here to feed dynamic values and avoid repetition. 35 | */ 36 | @Retention(RetentionPolicy.RUNTIME) 37 | @Target({ElementType.PARAMETER}) 38 | public @interface Values { 39 | String value(); 40 | } 41 | -------------------------------------------------------------------------------- /sponge/src/main/java/co/aikar/commands/MinecraftMessageKeys.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import co.aikar.locales.MessageKey; 27 | import co.aikar.locales.MessageKeyProvider; 28 | 29 | public enum MinecraftMessageKeys implements MessageKeyProvider { 30 | INVALID_WORLD, 31 | YOU_MUST_BE_HOLDING_ITEM, 32 | PLAYER_IS_VANISHED_CONFIRM, 33 | USERNAME_TOO_SHORT, 34 | IS_NOT_A_VALID_NAME, 35 | MULTIPLE_PLAYERS_MATCH, 36 | NO_PLAYER_FOUND_SERVER, 37 | NO_PLAYER_FOUND 38 | ; 39 | 40 | private final MessageKey key = MessageKey.of("acf-minecraft." + this.name().toLowerCase()); 41 | public MessageKey getMessageKey() { 42 | return key; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/Optional.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * Marks the parameter this is attached to as optional. 33 | * This will set the parameter as null if it was not provided. 34 | *

35 | * In the case the language used is Kotlin, Ceylon or any other null-enforcing JVM language, 36 | * you will need to allow for a nullable value. 37 | */ 38 | @Retention(RetentionPolicy.RUNTIME) 39 | @Target({ElementType.PARAMETER}) 40 | public @interface Optional { 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/processors/ConditionsProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2018 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.processors; 25 | 26 | import co.aikar.commands.AnnotationProcessor; 27 | import co.aikar.commands.CommandExecutionContext; 28 | import co.aikar.commands.CommandOperationContext; 29 | import co.aikar.commands.annotation.Conditions; 30 | 31 | @Deprecated /* @deprecated UNFINISHED */ 32 | public class ConditionsProcessor implements AnnotationProcessor { 33 | 34 | @Override 35 | public void onPreComand(CommandOperationContext context) { 36 | 37 | } 38 | 39 | @Override 40 | public void onPostContextResolution(CommandExecutionContext context, Object resolvedValue) { 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/Dependency.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2018 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * Injects a dependency into the field this is attached to. 33 | * Any time a new dependency is registered, this will be overwritten. 34 | */ 35 | @Retention(RetentionPolicy.RUNTIME) 36 | @Target(ElementType.FIELD) 37 | public @interface Dependency { 38 | /** 39 | * The key that should be used to lookup the instances, defaults to \"\" 40 | * @return the key 41 | */ 42 | String value() default ""; 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/HelpSearchTags.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * Defines additional keywords to feed into the search help system. 33 | * 34 | * For example, if a specific word doesn't make sense to use in the command name or description, but should 35 | * be used for help in discovering the correct command, then you can add it as a tag. 36 | */ 37 | @Retention(RetentionPolicy.RUNTIME) 38 | @Target({ElementType.METHOD}) 39 | public @interface HelpSearchTags { 40 | String value(); 41 | } 42 | -------------------------------------------------------------------------------- /bungee/src/main/java/co/aikar/commands/BungeeCommandCompletionContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import net.md_5.bungee.api.CommandSender; 27 | import net.md_5.bungee.api.connection.ProxiedPlayer; 28 | 29 | public class BungeeCommandCompletionContext extends CommandCompletionContext { 30 | 31 | BungeeCommandCompletionContext(RegisteredCommand command, BungeeCommandIssuer issuer, String input, String config, String[] args) { 32 | super(command, issuer, input, config, args); 33 | } 34 | 35 | public CommandSender getSender() { 36 | return this.getIssuer().getIssuer(); 37 | } 38 | 39 | public ProxiedPlayer getPlayer() { 40 | return this.issuer.getPlayer(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/ConditionFailedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2018 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import co.aikar.locales.MessageKey; 27 | import co.aikar.locales.MessageKeyProvider; 28 | 29 | public class ConditionFailedException extends InvalidCommandArgument { 30 | public ConditionFailedException() { 31 | super(false); 32 | } 33 | 34 | public ConditionFailedException(MessageKeyProvider key, String... replacements) { 35 | super(key, false, replacements); 36 | } 37 | 38 | public ConditionFailedException(MessageKey key, String... replacements) { 39 | super(key, false, replacements); 40 | } 41 | 42 | public ConditionFailedException(String message) { 43 | super(message, false); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/Subcommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * Defines the subcommand that can be used to execute this command. 33 | * This is appended onto the root command for the command group, 34 | * as well as any parent command groups subcommand base. 35 | * 36 | * Defines the part after root command like so: "/rootcommand {@link #value()}". 37 | */ 38 | @Retention(RetentionPolicy.RUNTIME) 39 | @Target({ElementType.METHOD, ElementType.TYPE}) 40 | public @interface Subcommand { 41 | String value(); 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/Conditions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * Specifies conditions that must be met in order to execute this command. 33 | * 34 | * If used on a method or a class, will be checked before parameter context is resolved 35 | * If used on a parameter, will be checked after the context is resolved 36 | * 37 | * @see {@link co.aikar.commands.CommandConditions} 38 | */ 39 | @Retention(RetentionPolicy.RUNTIME) 40 | @Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE}) 41 | public @interface Conditions { 42 | String value(); 43 | } 44 | -------------------------------------------------------------------------------- /docs/acf-bungee/src-html/co/aikar/commands/BungeeMessageFormatter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Source code 5 | 6 | 7 | 8 |

9 |
001package co.aikar.commands;
10 | 002
11 | 003import net.md_5.bungee.api.ChatColor;
12 | 004
13 | 005public class BungeeMessageFormatter extends MessageFormatter<ChatColor> {
14 | 006
15 | 007    public BungeeMessageFormatter(ChatColor... colors) {
16 | 008        super(colors);
17 | 009    }
18 | 010
19 | 011    @Override
20 | 012    String format(ChatColor color, String message) {
21 | 013        return color + message;
22 | 014    }
23 | 015}
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 | 
31 | 
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 | 
44 | 
45 | 
46 | 
47 | 
48 | 
49 | 
50 | 
51 | 
52 | 
53 | 
54 | 
55 | 
56 | 
57 | 
58 | 
59 | 
60 | 
61 | 
62 | 
63 | 
64 | 
65 | 
66 | 
67 | 
68 | 
69 | 
70 | 
71 | 
72 | 
73 | 
74 | 
75 | 
76 | 
77 | 
78 | 
79 | 
80 | 
81 | 
82 | 
83 | 
84 | 
85 |
86 | 87 | 88 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/MessageType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import java.util.concurrent.atomic.AtomicInteger; 27 | 28 | @SuppressWarnings("WeakerAccess") 29 | public class MessageType { 30 | private static final AtomicInteger counter = new AtomicInteger(1); 31 | 32 | public static final MessageType INFO = new MessageType(); 33 | public static final MessageType SYNTAX = new MessageType(); 34 | public static final MessageType ERROR = new MessageType(); 35 | public static final MessageType HELP = new MessageType(); 36 | 37 | private final int id = counter.getAndIncrement(); 38 | 39 | public int hashCode() { 40 | return id; 41 | } 42 | 43 | @Override 44 | public boolean equals(Object o) { 45 | return (this == o); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /sponge/src/main/java/co/aikar/commands/SpongeCommandCompletionContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import org.spongepowered.api.command.CommandSource; 27 | import org.spongepowered.api.entity.living.player.Player; 28 | 29 | @SuppressWarnings("WeakerAccess") 30 | public class SpongeCommandCompletionContext extends CommandCompletionContext { 31 | 32 | SpongeCommandCompletionContext(final RegisteredCommand command, final SpongeCommandIssuer issuer, final String input, final String config, final String[] args) { 33 | super(command, issuer, input, config, args); 34 | } 35 | 36 | public CommandSource getSource() { 37 | return this.issuer.getIssuer(); 38 | } 39 | 40 | public Player getPlayer() { 41 | return this.issuer.getPlayer(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /bukkit/src/main/java/co/aikar/commands/BukkitCommandCompletionContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import org.bukkit.command.CommandSender; 27 | import org.bukkit.entity.Player; 28 | 29 | public class BukkitCommandCompletionContext extends CommandCompletionContext { 30 | BukkitCommandCompletionContext(RegisteredCommand command, BukkitCommandIssuer issuer, String input, String config, String[] args) { 31 | super(command, issuer, input, config, args); 32 | } 33 | 34 | public CommandSender getSender() { 35 | return this.getIssuer().getIssuer(); 36 | } 37 | 38 | /** 39 | * Returns the Player object if this Issuer is a Player 40 | * @return 41 | */ 42 | public Player getPlayer() { 43 | return this.issuer.getPlayer(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/CatchUnknown.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2018 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * Defines a method that should receive any unknown command for the related root command. 33 | * 34 | * For example, if a BaseCommand /foo has a method with this, and /foo someunknowncommand is used 35 | * 36 | * If a method is tagged with this annotation, it will catch unknown commands and let you react to them. 37 | * 38 | * Only one instance of this annotation can be used per root command. 39 | */ 40 | @Retention(RetentionPolicy.RUNTIME) 41 | @Target({ElementType.METHOD}) 42 | public @interface CatchUnknown { 43 | } 44 | -------------------------------------------------------------------------------- /docs/acf-jda/src-html/co/aikar/commands/JDAMessageFormatter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Source code 5 | 6 | 7 | 8 |
9 |
001package co.aikar.commands;
10 | 002
11 | 003public class JDAMessageFormatter extends MessageFormatter<String> {
12 | 004    public JDAMessageFormatter() {
13 | 005        // JDA does not support coloring messages outside of embed fields.
14 | 006        // We pass three empty strings so as to remove color coded messages from appearing.
15 | 007        super("", "", "");
16 | 008    }
17 | 009
18 | 010    @Override
19 | 011    String format(String color, String message) {
20 | 012        return message;
21 | 013    }
22 | 014}
23 | 
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 | 
31 | 
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 | 
44 | 
45 | 
46 | 
47 | 
48 | 
49 | 
50 | 
51 | 
52 | 
53 | 
54 | 
55 | 
56 | 
57 | 
58 | 
59 | 
60 | 
61 | 
62 | 
63 | 
64 | 
65 | 
66 | 
67 | 
68 | 
69 | 
70 | 
71 | 
72 | 
73 | 
74 | 
75 | 
76 | 
77 | 
78 | 
79 | 
80 | 
81 | 
82 | 
83 | 
84 |
85 | 86 | 87 | -------------------------------------------------------------------------------- /docs/acf-jda/src-html/co/aikar/commands/CommandConfig.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Source code 5 | 6 | 7 | 8 |
9 |
001package co.aikar.commands;
10 | 002
11 | 003import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
12 | 004import org.jetbrains.annotations.NotNull;
13 | 005
14 | 006import java.util.List;
15 | 007
16 | 008public interface CommandConfig extends CommandConfigProvider {
17 | 009    @NotNull List<String> getCommandPrefixes();
18 | 010
19 | 011    @Override
20 | 012    default CommandConfig provide(MessageReceivedEvent event) {
21 | 013        return this;
22 | 014    }
23 | 015}
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 | 
31 | 
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 | 
44 | 
45 | 
46 | 
47 | 
48 | 
49 | 
50 | 
51 | 
52 | 
53 | 
54 | 
55 | 
56 | 
57 | 
58 | 
59 | 
60 | 
61 | 
62 | 
63 | 
64 | 
65 | 
66 | 
67 | 
68 | 
69 | 
70 | 
71 | 
72 | 
73 | 
74 | 
75 | 
76 | 
77 | 
78 | 
79 | 
80 | 
81 | 
82 | 
83 | 
84 | 
85 |
86 | 87 | 88 | -------------------------------------------------------------------------------- /bukkit/src/main/java/co/aikar/commands/MinecraftMessageKeys.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import co.aikar.locales.MessageKey; 27 | import co.aikar.locales.MessageKeyProvider; 28 | 29 | public enum MinecraftMessageKeys implements MessageKeyProvider { 30 | INVALID_WORLD, 31 | YOU_MUST_BE_HOLDING_ITEM, 32 | PLAYER_IS_VANISHED_CONFIRM, 33 | USERNAME_TOO_SHORT, 34 | IS_NOT_A_VALID_NAME, 35 | MULTIPLE_PLAYERS_MATCH, 36 | NO_PLAYER_FOUND_SERVER, 37 | NO_PLAYER_FOUND_OFFLINE, 38 | NO_PLAYER_FOUND, 39 | LOCATION_PLEASE_SPECIFY_WORLD, 40 | LOCATION_PLEASE_SPECIFY_XYZ, 41 | LOCATION_CONSOLE_NOT_RELATIVE; 42 | 43 | private final MessageKey key = MessageKey.of("acf-minecraft." + this.name().toLowerCase()); 44 | public MessageKey getMessageKey() { 45 | return key; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/Flags.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * Provides configuration options for {@link co.aikar.commands.contexts.ContextResolver}'s to change how they resolve context. 33 | * 34 | * Example: Searching for a player, you might use @Flags("loose") to indicate a fuzzy match instead of an exact match. 35 | * 36 | * If you want to restrict if an issuer can use the command, please use {@link co.aikar.commands.CommandConditions.Condition} instead. 37 | */ 38 | @Retention(RetentionPolicy.RUNTIME) 39 | @Target({ElementType.PARAMETER}) 40 | public @interface Flags { 41 | String value(); 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/CommandAlias.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * Allows to add a single or several command alias(es). 33 | * In order to add more than one in a single go, use the syntax "alias|otheralias". 34 | * You can register as many aliases as wanted in a single value. 35 | * 36 | * Used on a Class, defines the root command for all subcommands in the base command. 37 | * Used on a method, defines a root command alias to that specific command 38 | */ 39 | @Retention(RetentionPolicy.RUNTIME) 40 | @Target({ElementType.METHOD, ElementType.TYPE}) 41 | public @interface CommandAlias { 42 | String value(); 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/CommandCompletion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * Many implementation platforms have a concept of "Tab Completions", 33 | * where pressing tab will give suggestions on what you can input. 34 | * 35 | * This annotation specifies either static completion values, 36 | * or special @codes that let you define Completion Handlers to dynamically 37 | * populate completion values. 38 | * 39 | * @see {@link co.aikar.commands.CommandCompletions} 40 | */ 41 | @Retention(RetentionPolicy.RUNTIME) 42 | @Target({ElementType.METHOD}) 43 | public @interface CommandCompletion { 44 | String value(); 45 | } 46 | -------------------------------------------------------------------------------- /bungee/src/main/java/co/aikar/commands/BungeeCommandExecutionContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import net.md_5.bungee.api.CommandSender; 27 | import net.md_5.bungee.api.connection.ProxiedPlayer; 28 | 29 | import java.util.List; 30 | import java.util.Map; 31 | 32 | public class BungeeCommandExecutionContext extends CommandExecutionContext { 33 | 34 | BungeeCommandExecutionContext(RegisteredCommand cmd, CommandParameter param, BungeeCommandIssuer sender, List args, int index, Map passedArgs) { 35 | super(cmd, param, sender, args, index, passedArgs); 36 | } 37 | 38 | public CommandSender getSender() { 39 | return this.issuer.getIssuer(); 40 | } 41 | 42 | public ProxiedPlayer getPlayer() { 43 | return this.issuer.getPlayer(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/Syntax.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * Specifies the syntax to be used when executing this command. 33 | * It should not include any descriptions of the arguments nor when some are allowed and when they are not. 34 | * 35 | * Use of this annotation is not necessary. Syntax will be automatically generated for you. 36 | * Use this annotation to override automatic syntax 37 | * 38 | * Use {@link Description} together with the help menu for that purpose. 39 | **/ 40 | @Retention(RetentionPolicy.RUNTIME) 41 | @Target({ElementType.METHOD, ElementType.PARAMETER}) 42 | public @interface Syntax { 43 | String value(); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 43 | -------------------------------------------------------------------------------- /sponge/src/main/java/co/aikar/commands/SpongeRegisteredCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import co.aikar.timings.Timing; 27 | 28 | import java.lang.reflect.Method; 29 | 30 | public class SpongeRegisteredCommand extends RegisteredCommand { 31 | 32 | private final Timing timing; 33 | 34 | SpongeRegisteredCommand(BaseCommand scope, String command, Method method, String prefSubCommand) { 35 | super(scope, command, method, prefSubCommand); 36 | this.timing = ((SpongeCommandManager) scope.manager).createTiming("Command: " + this.command); 37 | } 38 | 39 | @Override 40 | public void preCommand() { 41 | this.timing.startTiming(); 42 | super.preCommand(); 43 | } 44 | 45 | @Override 46 | public void postCommand() { 47 | super.postCommand(); 48 | this.timing.stopTiming(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /jda/src/main/java/co/aikar/commands/JDACommandEvent.java: -------------------------------------------------------------------------------- 1 | package co.aikar.commands; 2 | 3 | import net.dv8tion.jda.core.entities.Message; 4 | import net.dv8tion.jda.core.entities.MessageEmbed; 5 | import net.dv8tion.jda.core.events.message.MessageReceivedEvent; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import java.util.UUID; 9 | 10 | public class JDACommandEvent implements CommandIssuer { 11 | 12 | private MessageReceivedEvent event; 13 | private JDACommandManager manager; 14 | 15 | public JDACommandEvent(JDACommandManager manager, MessageReceivedEvent event) { 16 | 17 | this.manager = manager; 18 | this.event = event; 19 | } 20 | 21 | public MessageReceivedEvent getEvent() { 22 | return event; 23 | } 24 | 25 | @Override 26 | public MessageReceivedEvent getIssuer() { 27 | return event; 28 | } 29 | 30 | @Override 31 | public CommandManager getManager() { 32 | return this.manager; 33 | } 34 | 35 | @Override 36 | public boolean isPlayer() { 37 | return false; 38 | } 39 | 40 | @Override 41 | public @NotNull UUID getUniqueId() { 42 | // Discord id only have 64 bit width (long) while UUIDs have twice the size. 43 | // In order to keep it unique we use 0L for the first 64 bit. 44 | long authorId = event.getAuthor().getIdLong(); 45 | return new UUID(0, authorId); 46 | } 47 | 48 | @Override 49 | public boolean hasPermission(String permission) { 50 | CommandPermissionResolver permissionResolver = this.manager.getPermissionResolver(); 51 | return permissionResolver == null || permissionResolver.hasPermission(manager, this, permission); 52 | } 53 | 54 | @Override 55 | public void sendMessageInternal(String message) { 56 | this.event.getChannel().sendMessage(message).queue(); 57 | } 58 | 59 | public void sendMessage(Message message) { 60 | this.event.getChannel().sendMessage(message).queue(); 61 | } 62 | 63 | public void sendMessage(MessageEmbed message) { 64 | this.event.getChannel().sendMessage(message).queue(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /sponge/src/main/java/co/aikar/commands/SpongeCommandExecutionContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import org.spongepowered.api.command.CommandSource; 27 | import org.spongepowered.api.entity.living.player.Player; 28 | 29 | import java.util.List; 30 | import java.util.Map; 31 | 32 | public class SpongeCommandExecutionContext extends CommandExecutionContext { 33 | 34 | SpongeCommandExecutionContext(RegisteredCommand cmd, CommandParameter param, SpongeCommandIssuer sender, List args, 35 | int index, Map passedArgs) { 36 | super(cmd, param, sender, args, index, passedArgs); 37 | } 38 | 39 | public CommandSource getSource() { 40 | return this.issuer.getIssuer(); 41 | } 42 | 43 | public Player getPlayer() { 44 | return this.issuer.getPlayer(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /docs/acf-jda/src-html/co/aikar/commands/annotation/SelfUser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Source code 5 | 6 | 7 | 8 |
9 |
001package co.aikar.commands.annotation;
10 | 002
11 | 003import java.lang.annotation.ElementType;
12 | 004import java.lang.annotation.Retention;
13 | 005import java.lang.annotation.RetentionPolicy;
14 | 006import java.lang.annotation.Target;
15 | 007
16 | 008/**
17 | 009 * The {@link SelfUser} annotation is to define whether the parameter should be represented by JDA's user object
18 | 010 * or if it should be parsed from command input.
19 | 011 */
20 | 012@Target(ElementType.PARAMETER)
21 | 013@Retention(RetentionPolicy.RUNTIME)
22 | 014public @interface SelfUser {
23 | 015}
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 | 
31 | 
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 | 
44 | 
45 | 
46 | 
47 | 
48 | 
49 | 
50 | 
51 | 
52 | 
53 | 
54 | 
55 | 
56 | 
57 | 
58 | 
59 | 
60 | 
61 | 
62 | 
63 | 
64 | 
65 | 
66 | 
67 | 
68 | 
69 | 
70 | 
71 | 
72 | 
73 | 
74 | 
75 | 
76 | 
77 | 
78 | 
79 | 
80 | 
81 | 
82 | 
83 | 
84 | 
85 |
86 | 87 | 88 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 46 | 47 | -------------------------------------------------------------------------------- /bukkit/src/main/java/co/aikar/commands/BukkitRegisteredCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import co.aikar.timings.lib.MCTiming; 27 | 28 | import java.lang.reflect.Method; 29 | 30 | public class BukkitRegisteredCommand extends RegisteredCommand { 31 | private final MCTiming timing; 32 | BukkitRegisteredCommand(BaseCommand scope, String command, Method method, String prefSubCommand) { 33 | super(scope, command, method, prefSubCommand); 34 | BukkitCommandManager manager = (BukkitCommandManager) scope.manager; 35 | this.timing = manager.getTimings().of("Command: " + this.command, manager.commandTiming); 36 | } 37 | 38 | 39 | @Override 40 | public void preCommand() { 41 | timing.startTiming(); 42 | super.preCommand(); 43 | } 44 | 45 | @Override 46 | public void postCommand() { 47 | super.postCommand(); 48 | timing.stopTiming(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /bukkit/src/main/java/co/aikar/commands/BukkitCommandExecutionContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import org.bukkit.command.CommandSender; 27 | import org.bukkit.entity.Player; 28 | 29 | import java.util.List; 30 | import java.util.Map; 31 | 32 | public class BukkitCommandExecutionContext extends CommandExecutionContext { 33 | BukkitCommandExecutionContext(RegisteredCommand cmd, CommandParameter param, BukkitCommandIssuer sender, List args, 34 | int index, Map passedArgs) { 35 | super(cmd, param, sender, args, index, passedArgs); 36 | } 37 | 38 | public CommandSender getSender() { 39 | return this.issuer.getIssuer(); 40 | } 41 | 42 | /** 43 | * Returns the Player object if this Issuer is a Player 44 | * @return 45 | */ 46 | public Player getPlayer() { 47 | return this.issuer.getPlayer(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/annotation/HelpCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.annotation; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | /** 32 | * A Shortcut for specifying {@link CatchUnknown}, {@link Default} and {@link Subcommand} on a method. 33 | * Subcommand carries the same value as this annotations value to define the list of subcommands to register for. 34 | * 35 | * a method marked with this annotation should also use a {@link co.aikar.commands.CommandHelp} context parameter to show help. 36 | */ 37 | @Retention(RetentionPolicy.RUNTIME) 38 | @Target({ElementType.METHOD}) 39 | public @interface HelpCommand { 40 | /** 41 | * The value to forward to the @Subcommand annotation. Lists which subcommands to register to trigger help 42 | * @return 43 | */ 44 | String value() default "help|?|-help|-h|-?"; 45 | } 46 | -------------------------------------------------------------------------------- /bukkit/src/main/java/co/aikar/commands/BukkitCommandContexts_1_12.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import org.bukkit.NamespacedKey; 27 | 28 | class BukkitCommandContexts_1_12 { 29 | static void register(BukkitCommandContexts contexts) { 30 | contexts.registerContext(NamespacedKey.class, c -> { 31 | String arg = c.popFirstArg(); 32 | String[] split = ACFPatterns.COLON.split(arg, 2); 33 | if (split.length == 1) { 34 | String namespace = c.getFlagValue("namespace", (String) null); 35 | if (namespace == null) { 36 | return NamespacedKey.minecraft(split[0]); 37 | } else { 38 | //noinspection deprecation 39 | return new NamespacedKey(namespace, split[0]); 40 | } 41 | } else { 42 | //noinspection deprecation 43 | return new NamespacedKey(split[0], split[1]); 44 | } 45 | }); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /bukkit/src/main/java/co/aikar/commands/contexts/OnlinePlayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.contexts; 25 | 26 | import org.bukkit.entity.Player; 27 | 28 | import java.util.Objects; 29 | 30 | public class OnlinePlayer { 31 | public final Player player; 32 | 33 | public OnlinePlayer(Player player) { 34 | this.player = player; 35 | } 36 | 37 | public Player getPlayer() { 38 | return this.player; 39 | } 40 | 41 | @Override 42 | public boolean equals(Object o) { 43 | if (this == o) return true; 44 | if (o == null || getClass() != o.getClass()) return false; 45 | OnlinePlayer that = (OnlinePlayer) o; 46 | return Objects.equals(player, that.player); 47 | } 48 | 49 | @Override 50 | public int hashCode() { 51 | return Objects.hash(player); 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return "OnlinePlayer{" + 57 | "player=" + player + 58 | '}'; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/ExceptionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands; 25 | 26 | import java.util.List; 27 | 28 | /** 29 | * Functional interface to allow plugins to handle uncaught excetpions 30 | */ 31 | @FunctionalInterface 32 | public interface ExceptionHandler { 33 | 34 | /** 35 | * Called when an exception occurs while executing a command
36 | * If an exception handler properly handles an exception, the user will not be noticied by the 37 | * framework that something went unexceptected. 38 | * 39 | * @param command the command that was executed 40 | * @param registeredCommand the registered command 41 | * @param sender the issuer who send the command 42 | * @param args the args he used 43 | * @param t the throwable that caused this exception 44 | * 45 | * @return if the exception was handeled by the exception handler. 46 | */ 47 | boolean execute(BaseCommand command, RegisteredCommand registeredCommand, CommandIssuer sender, List args, Throwable t); 48 | } 49 | -------------------------------------------------------------------------------- /docs/acf-sponge/src-html/co/aikar/commands/SpongeMessageFormatter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Source code 5 | 6 | 7 | 8 |
9 |
001package co.aikar.commands;
10 | 002
11 | 003import org.spongepowered.api.text.Text;
12 | 004import org.spongepowered.api.text.format.TextColor;
13 | 005import org.spongepowered.api.text.serializer.TextSerializers;
14 | 006
15 | 007public class SpongeMessageFormatter extends MessageFormatter<TextColor> {
16 | 008
17 | 009    public SpongeMessageFormatter(TextColor... colors) {
18 | 010        super(colors);
19 | 011    }
20 | 012
21 | 013    public String format(TextColor color, String message) {
22 | 014        return TextSerializers.LEGACY_FORMATTING_CODE.serialize(Text.of(color, message));
23 | 015    }
24 | 016}
25 | 
26 | 
27 | 
28 | 
29 | 
30 | 
31 | 
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 | 
44 | 
45 | 
46 | 
47 | 
48 | 
49 | 
50 | 
51 | 
52 | 
53 | 
54 | 
55 | 
56 | 
57 | 
58 | 
59 | 
60 | 
61 | 
62 | 
63 | 
64 | 
65 | 
66 | 
67 | 
68 | 
69 | 
70 | 
71 | 
72 | 
73 | 
74 | 
75 | 
76 | 
77 | 
78 | 
79 | 
80 | 
81 | 
82 | 
83 | 
84 | 
85 | 
86 |
87 | 88 | 89 | -------------------------------------------------------------------------------- /sponge/src/main/java/co/aikar/commands/contexts/OnlinePlayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.contexts; 25 | 26 | import org.spongepowered.api.entity.living.player.Player; 27 | 28 | import java.util.Objects; 29 | 30 | public class OnlinePlayer { 31 | public final Player player; 32 | 33 | public OnlinePlayer(Player player) { 34 | this.player = player; 35 | } 36 | 37 | public Player getPlayer() { 38 | return this.player; 39 | } 40 | 41 | @Override 42 | public boolean equals(Object o) { 43 | if (this == o) return true; 44 | if (o == null || getClass() != o.getClass()) return false; 45 | OnlinePlayer that = (OnlinePlayer) o; 46 | return Objects.equals(player, that.player); 47 | } 48 | 49 | @Override 50 | public int hashCode() { 51 | return Objects.hash(player); 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return "OnlinePlayer{" + 57 | "player=" + player + 58 | '}'; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /languages/core/acf-core_cs.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining 4 | # a copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, 7 | # distribute, sublicense, and/or sell copies of the Software, and to 8 | # permit persons to whom the Software is furnished to do so, subject to 9 | # the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be 12 | # included in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | # 22 | 23 | acf-core.permission_denied = Na tento prikaz nemas dostatecna opravneni. 24 | acf-core.error_generic_logged = Nastala chyba. Problem byl zaznamenan v logu. Omlouvame se. 25 | acf-core.unknown_command = Neznamy prikaz, zkus zadat /help 26 | acf-core.invalid_syntax = Pouziti: {command} {syntax} 27 | acf-core.error_prefix = Chyba: {message} 28 | acf-core.error_performing_command = Omlouvame se, ale pri provadeni prikazu doslo k chybe. 29 | acf-core.info_message = {message} 30 | acf-core.please_specify_one_of = Chyba: Je potreba zadat alespon jednu polozku ({valid}). 31 | acf-core.must_be_a_number = Chyba: Musi byt cislo. 32 | acf-core.must_be_min_length = Chyba: Musi mit alespon {min} znaku. 33 | acf-core.must_be_max_length = Chyba: Musi mit maximalne {max} znaku. 34 | acf-core.not_allowed_on_console = Chyba: Tento prikaz nelze pouzivat v konzoli. 35 | acf-core.could_not_find_player = Chyba: Nepodarilo se najit hrace s prezdivkou: {search} 36 | acf-core.help_format = {command} {parameters} {separator} {description} 37 | -------------------------------------------------------------------------------- /example/src/main/java/co/aikar/acfexample/SomeCommand_ExtraSubs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.acfexample; 25 | 26 | import co.aikar.commands.BaseCommand; 27 | import co.aikar.commands.CommandHelp; 28 | import co.aikar.commands.annotation.CommandAlias; 29 | import co.aikar.commands.annotation.CommandCompletion; 30 | import co.aikar.commands.annotation.HelpCommand; 31 | import co.aikar.commands.annotation.Private; 32 | import co.aikar.commands.annotation.Subcommand; 33 | import org.bukkit.command.CommandSender; 34 | 35 | @CommandAlias("acf") 36 | public class SomeCommand_ExtraSubs extends BaseCommand { 37 | 38 | @Subcommand("testsub test2") 39 | @CommandCompletion("Foo2") 40 | public void onTestSub2(CommandSender sender, String hi) { 41 | sender.sendMessage(hi); 42 | } 43 | 44 | @Private 45 | @Subcommand("testsub private") 46 | public void privateSub(CommandSender sender){ 47 | sender.sendMessage("Am a sneaky ninja!"); 48 | } 49 | 50 | @HelpCommand 51 | public void help(CommandSender sender, CommandHelp help){ 52 | help.showHelp(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /bungee/src/main/java/co/aikar/commands/contexts/OnlineProxiedPlayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.contexts; 25 | 26 | import net.md_5.bungee.api.connection.ProxiedPlayer; 27 | 28 | import java.util.Objects; 29 | 30 | public class OnlineProxiedPlayer { 31 | 32 | public final ProxiedPlayer player; 33 | 34 | public OnlineProxiedPlayer(ProxiedPlayer player) { 35 | this.player = player; 36 | } 37 | 38 | public ProxiedPlayer getPlayer(){ 39 | return player; 40 | } 41 | 42 | @Override 43 | public boolean equals(Object o) { 44 | if (this == o) return true; 45 | if (o == null || getClass() != o.getClass()) return false; 46 | OnlineProxiedPlayer that = (OnlineProxiedPlayer) o; 47 | return Objects.equals(player, that.player); 48 | } 49 | 50 | @Override 51 | public int hashCode() { 52 | return Objects.hash(player); 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return "OnlineProxiedPlayer{" + 58 | "proxiedPlayer=" + player + 59 | '}'; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /docs/acf-bungee/src-html/co/aikar/commands/MinecraftMessageKeys.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Source code 5 | 6 | 7 | 8 |
9 |
001package co.aikar.commands;
10 | 002
11 | 003import co.aikar.locales.MessageKey;
12 | 004import co.aikar.locales.MessageKeyProvider;
13 | 005
14 | 006public enum MinecraftMessageKeys implements MessageKeyProvider {
15 | 007    USERNAME_TOO_SHORT,
16 | 008    IS_NOT_A_VALID_NAME,
17 | 009    MULTIPLE_PLAYERS_MATCH,
18 | 010    NO_PLAYER_FOUND_SERVER,
19 | 011    NO_PLAYER_FOUND
20 | 012    ;
21 | 013
22 | 014    private final MessageKey key = MessageKey.of("acf-minecraft." + this.name().toLowerCase());
23 | 015    public MessageKey getMessageKey() {
24 | 016        return key;
25 | 017    }
26 | 018}
27 | 
28 | 
29 | 
30 | 
31 | 
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 | 
44 | 
45 | 
46 | 
47 | 
48 | 
49 | 
50 | 
51 | 
52 | 
53 | 
54 | 
55 | 
56 | 
57 | 
58 | 
59 | 
60 | 
61 | 
62 | 
63 | 
64 | 
65 | 
66 | 
67 | 
68 | 
69 | 
70 | 
71 | 
72 | 
73 | 
74 | 
75 | 
76 | 
77 | 
78 | 
79 | 
80 | 
81 | 
82 | 
83 | 
84 | 
85 | 
86 | 
87 | 
88 |
89 | 90 | 91 | -------------------------------------------------------------------------------- /core/src/main/java/co/aikar/commands/contexts/ContextResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package co.aikar.commands.contexts; 25 | 26 | import co.aikar.commands.CommandExecutionContext; 27 | import co.aikar.commands.CommandIssuer; 28 | import co.aikar.commands.InvalidCommandArgument; 29 | 30 | /** 31 | * This defines a context resolver, which parses {@link T} from {@link C}. 32 | * 33 | * @param 34 | * The type to be parsed. 35 | * @param 36 | * The type of the context which the resolver would get its data from. 37 | */ 38 | @FunctionalInterface 39 | public interface ContextResolver > { 40 | /** 41 | * Parses the context of type {@link C} into {@link T}, or throws an exception. 42 | * 43 | * @param c 44 | * The context to parse from. 45 | * 46 | * @return The parsed instance of the wanted type. 47 | * 48 | * @throws InvalidCommandArgument 49 | * In case the context contains any discrepancies, it will throw this exception. 50 | */ 51 | T getContext(C c) throws InvalidCommandArgument; 52 | } 53 | -------------------------------------------------------------------------------- /docs/acf-jda/src-html/co/aikar/commands/JDACommandConfig.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Source code 5 | 6 | 7 | 8 |
9 |
001package co.aikar.commands;
10 | 002
11 | 003import org.jetbrains.annotations.NotNull;
12 | 004
13 | 005import java.util.List;
14 | 006import java.util.concurrent.CopyOnWriteArrayList;
15 | 007
16 | 008public class JDACommandConfig implements CommandConfig {
17 | 009    protected @NotNull List<String> commandPrefixes = new CopyOnWriteArrayList<>(new String[]{"!"});
18 | 010
19 | 011    public JDACommandConfig() {
20 | 012
21 | 013    }
22 | 014
23 | 015    @NotNull
24 | 016    public List<String> getCommandPrefixes() {
25 | 017        return commandPrefixes;
26 | 018    }
27 | 019}
28 | 
29 | 
30 | 
31 | 
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 | 
44 | 
45 | 
46 | 
47 | 
48 | 
49 | 
50 | 
51 | 
52 | 
53 | 
54 | 
55 | 
56 | 
57 | 
58 | 
59 | 
60 | 
61 | 
62 | 
63 | 
64 | 
65 | 
66 | 
67 | 
68 | 
69 | 
70 | 
71 | 
72 | 
73 | 
74 | 
75 | 
76 | 
77 | 
78 | 
79 | 
80 | 
81 | 
82 | 
83 | 
84 | 
85 | 
86 | 
87 | 
88 | 
89 |
90 | 91 | 92 | -------------------------------------------------------------------------------- /docs/acf-bukkit/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (ACF (Bukkit) 0.5.0-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 | 31 | 32 | 33 | --------------------------------------------------------------------------------