Commit Graph

133 Commits

Author SHA1 Message Date
Aikar 55883cc3b1 Add an exception to show comamnd help 2018-01-10 21:04:37 -05:00
Aikar 9f7eb9bcf5 Condition handlers wasnt meant to return boolean.
Sorry if anyone wrote one already, remove the return type please.

Really don't want to bump version when very low chance anyones using
this system yet.
2018-01-10 19:44:26 -05:00
Aikar 40eaa9ea07 Command Conditions and MANY other code changes for Generics <3🌮
This completes and fully enables a new feature called "Conditions"

We already had some forms of conditions built into @Flags such as
on the Player for itemheld.

However, letting end users add additional restrictions to existing context
handlers such as players is not possible without redefining the context.

That's not friendly nor scalable.

Flags will now be primarily only for controlling how to resolve a context,
and then Conditions will then be the way to validate the context and trigger
a failure if the condition is not met.

Conditions can be placed on Command Class, Methods, or individual Parameters.
2018-01-08 23:30:27 -05:00
Hex ae52acf6ed Fix typo (parseAndValudateNumber). (#83) 2018-01-06 12:08:43 -05:00
Aikar bfc8534176 Validate that input does not exceed max values for numbers 2018-01-05 20:38:33 -05:00
Aikar 45dcc43d14 Support for Primitive parameter types 2018-01-05 20:07:46 -05:00
Aikar faa1df0309 Fix setFormat(MEssageType, FT) index - Resolves #82 2018-01-03 18:43:58 -05:00
Aikar 2057ed8a42 More work on Command Conditions #58 2017-12-17 13:46:22 -05:00
Aikar 9ef0ac6e5e Current progress on Conditions, not done yet - #58 2017-12-13 23:12:31 -05:00
Aikar 52c95c3ee6 Unwrap Exception Handler receiving InvocationTargetException 2017-12-13 21:55:49 -05:00
Aikar 77631767a7 Fix multiple default/unkown handlers being registered 2017-12-09 13:40:39 -05:00
Aikar abe66948db Fix multi class sub command tab completion for Paper Async Handler 2017-12-02 21:19:10 -05:00
Aikar fe1be188a4 Allow @Default to work on classes bound to a @Subcommand
```java
@CommandAlias("foo")
@Subcommand("bar")
class FooBarCommand {
    @Default
    public void onFooBar(CommandIssuer issuer) {}
}
```

Will now pass `/foo bar` to onFooBar.
Previously this required @Subcommand("") which was unintuitive
2017-12-01 23:56:26 -05:00
Aikar fbed6f2be3 Add Support for Async Tab Completions for Paper Servers
This adds the ability for plugins to define completion handlers as async safe (not on games main thread)

When they are defined async safe, and ran on a Paper 1.12.2+ server, with a Paper ACF manager,
completions will be handled mostly async, letting you safely do heavier operations in tab completions.
2017-11-30 01:18:43 -05:00
Aikar 8251b81a94 Fix Plugin Logger on Bukkit/Paper (not sure whats wrong with plugin.getLogger()) 2017-11-25 22:07:23 -05:00
Aikar b032c677b8 require opting into per-issuer locale 2017-11-25 20:50:19 -05:00
Aikar adfb4b11a1 Add support for Per Player Locale on Bukkit - Resolves #62 2017-11-24 13:05:20 -05:00
Aikar 1915ebf00e check the scope of commands for permissions too and rename to getRequiredPermissions 2017-11-22 22:54:02 -05:00
Aikar 70571a4a0a new API for multi permissions on RegisteredCommand 2017-11-22 22:41:07 -05:00
Aikar 4a54e8c333 support requiring multiple permission nodes for a command 2017-11-22 22:33:49 -05:00
Aikar d560beeeab Include inherited methods on register (for precommand/help etc) 2017-11-22 22:17:04 -05:00
Aikar 171b083cba Ok that solution didn't even work (or only works sometimes?), try 2 2017-10-29 20:37:15 -04:00
Aikar a1fecf3174 Fix java lameness with constructor order
Apparently doing it in the ctor is a different order.

The addReplacements call in CommandReplacements checks registeredCommands in the constructor

This was being called before Bukkit manager even fully loaded, and the registered commands was still null

I don't know why java can't treat this the same code wise....
2017-10-29 20:12:08 -04:00
Aikar 64de86be45 add t/f to the truthy list 2017-10-29 19:54:31 -04:00
Aikar 8a0a5c31af Add @truthy as a default command replacement 2017-10-29 19:54:01 -04:00
Aikar 72e052d953 Finish up the pagination of the help system 2017-10-28 13:36:39 -04:00
Aikar a02d761e5e Set bukkit usage/description data 2017-10-28 12:21:35 -04:00
Aikar c165ca2c36 pagination on help progress 2017-10-09 21:09:43 -04:00
Aikar 9159b3fbb0 Fix typo in separator 2017-10-09 19:11:01 -04:00
Aikar f1423dc3bf support old no args = default logic 2017-09-28 23:09:07 -04:00
Aikar a9f203b5ef Unknown Handlers should have priority over default.
Both conflict with each other to support parameters on @Default
2017-09-28 22:51:24 -04:00
Aikar 052a5d26dc use ExpiringMap for Pattern Cache 2017-08-24 22:45:12 -04:00
Aikar 34642136f5 Only register Unknown/Default for HelpCommand if not already set 2017-08-24 01:21:50 -04:00
Aikar dcbdf0b594 Support context on @Default! Hooray!!!!
@Subcommand("list") @Default
public void onFoo(CommandSender sender, @Default("1") Integer page) {}

type stuff will now work with /cmd list 2 and /cmd 2
2017-08-24 01:17:16 -04:00
Aikar 851b50053b Add @HelpCommand shortcut annotation 2017-08-24 00:41:00 -04:00
Aikar ab192c9e34 Current work on command searching for help, see image
http://i.imgur.com/HQ6nmvF.png

@Default
@Subcommand("help")
@UnknownHandler
public void doHelp(CommandSender sender, CommandHelp help) {
     help.showHelp();
}
2017-08-23 23:54:59 -04:00
Aikar 0746f97ee1 Fix registering subcommands that are also @UnknownHandlers 2017-08-23 23:02:20 -04:00
Marek Šipoš ebb4fd6644 add czech translation (#67)
* Update CommandManager.java (#3)

* Create acf-core_cs.properties (#2)

* Create acf-minecraft_cs.properties (#1)
2017-08-23 20:37:12 -04:00
Aikar b2b7b18cb1 Remove the .iml files to make kashike happy. 2017-08-23 20:23:51 -04:00
Aikar 11dcf57113 Work on the help system to start work on pagination and search 2017-08-23 19:16:45 -04:00
Aikar 287924d434 Fix CoMoEx in loadMissingBundles 2017-08-15 20:22:07 -04:00
Aikar 43a06e9006 Mark the Help system as unstable 2017-08-08 23:43:59 -04:00
Aikar 278e91a76b add Unstable API stuff 2017-08-08 23:41:25 -04:00
Aikar 75579fe649 more fixes, formatting, expand control over format, fix dupe 2017-08-08 22:08:05 -04:00
Aikar 3cdd47942d things are working now 2017-08-08 21:17:56 -04:00
Aikar 05323ea8f8 Get things back compiling 2017-08-08 21:05:42 -04:00
Aikar 57a41c7540 Current progress on updating the help PR 2017-08-08 20:30:40 -04:00
Aikar 88a170cb58 Merge branch 'feature/help' of https://github.com/mrkirby153/commands into mrkirby153-feature/help
* 'feature/help' of https://github.com/mrkirby153/commands:
  Generify help generation
  Rework how help is generated
  First revision of help system
  Wire up command descriptions
2017-08-08 19:37:45 -04:00
Aikar 2306418c83 add Exception to the name 2017-08-02 23:33:57 -04:00
Aikar 5711497ef8 Make kashike happy 2017-08-02 23:33:09 -04:00