- 
                Notifications
    
You must be signed in to change notification settings  - Fork 0
 
Custom CommandOperator's
Thanks to the smart object-oriented design, CommandAPI is not limited to the proposed standard objects and methods. You can always write your own CommandOperator.
A CommandOperator is an object that takes in data about what the player enters and executes some custom logic based on that. Pretty much the same as the standard CommandExecutor from Bukkit. Here are two methods you can implement:
void on(CommandWrite write);
void on(CommandDispatch dispatch);If you connect the CommandOperator directly to the command center or to some tree, these methods will be called and data will be passed there.
You can also use CommandOperator as a lambda expression in the command tree, like this:
``java new CommandDelegator( new Raw( new Adviser(new LAPIMessage(Artifex.class, "command.language.enter-language") ), new SubCommand( new StringDelegatePattern("set"), new Arguments( List.of( new Argument("language", new Self() ), // this is where the CommandOperator is hidden as a lambda. Dispatch is a CommandDispatch. dispatch -> Bukkit.getPluginManager().callEvent( new LanguageChangeEvent( dispatch.source().sender(), dispatch.arguments().get("language", String.class) ) ) ) ) )
- 
Создание плагина
- Создание main-класса
 - Настройка ancapplugin.yml
 - Использование AncapPluginAPI
 - Использование LanguageAPI
 - Использование CommunicatorAPI
 - Использование ConfigurationAPI
 - Использование CommandAPI
 - Использование DatabaseAPI
 - Использование EventAPI
 - Использование MaterialAPI
 - Использование WorldIteratorAPI
 - Использование BukkitUtil
 - Использование ResourceAPI
 
 
- 
- Creating main class
 - Setting up the ancapplugin.yml
 - Using the AncapPluginAPI
 - Using the LanguageAPI
 - Using the CommunicatorAPI
 - Using the ConfigurationAPI
 - Using the CommandAPI
 - Using the DatabaseAPI
 - Using the EventAPI
 - Using the MaterialAPI
 - Using the WorldIteratorAPI
 - Using the BukkitUtil
 - Using the ResouceAPI