Commit Graph

156 Commits

Author SHA1 Message Date
Aikar df6ccc0a24 move annotation lookup methods into their own file to declutter class 2018-03-17 16:49:01 -04:00
Aikar 8008d6d063 clean up code more, break out methods 2018-03-17 12:31:05 -04:00
Aikar d8017789d6 Refactor all annotation lookups in prep for processors 2018-03-17 12:31:05 -04:00
Aikar b55e15db50 Fix max value check for Long and add more type flag helpers 2018-03-17 12:26:34 -04:00
Aikar 99e2b8543d Fix inverted syntax logic, thanks minecoder 2018-03-17 00:17:10 -04:00
Aikar 3034b11724 move syntax parsing to CommandParameter 2018-03-16 23:54:59 -04:00
Aikar 7353aa0b2e fix sponge tab complete API 2018-03-16 16:51:09 -04:00
Aikar 2d0995a3ac Refactor how parameter annotations are parsed to prep for processors
this also will improve performance, as we will only do flag parsing and replacements
once on register instead of every execution for some things.
2018-03-15 23:22:18 -04:00
MiniDigger 79f4074caf better number error msg (#108) 2018-03-11 11:42:08 -04:00
Aikar 37e435ce34 add min/max validation flags.
This should of really been conditions, but lazy to set that up proper for now.
2018-03-10 16:07:28 -05:00
Aikar 0babe4cdf4 Add Contexts for BigDecimal and BigInteger 2018-02-28 20:01:05 -05:00
Aikar f2c906a17a Validate subcommand configuration 2018-02-28 19:39:02 -05:00
Aikar 82390e5443 restore .setPlayerLocale API on bukkit manager
This was public, so cant remove it
2018-02-28 18:03:58 -05:00
games647 edf7ecc020 Add support for per issuer locale in Sponge and BungeeCord (#104)
* Add support for per issuer locale in Sponge and BungeeCord

* Added Optional<UUID> getUniqueId to CommandIssuer
* Added update task and delayed join listener in BungeeCord
* Added settings change listener in Sponge
* Moved setLocale method up to the CommandManager to remove the
amount of duplicated code

* Remove Optional usage

* Remove player terminology in core
2018-02-28 17:53:27 -05:00
LucasD c3ee9d4f20 Add brazilian portuguese translation (#103)
* Add brazilian portuguese translation

* Renaming pt_BR to pt, sub dialects must be implemented by plugin authors.
2018-02-27 20:11:38 -05:00
Aikar 1a9c9ab9ef some start of an annotation processor interface 2018-02-15 23:56:29 -05:00
Xavier 0d0b2ef425 Added support for loading message bundles from other ClassLoaders, an… (#99)
* Added support for loading message bundles from other ClassLoaders, and made the Bukkit & Bungee locales attempt to load from the ClassLoader that ACF is apart of, and the ClassLoader that the CommandManagers plugin belongs to

* Added the ability to add/register a ClassLoader to be scanned for Locales. The Locales automatically adds its own ClassLoader to the list, and the Bungee, Bukkit and Sponge implementations automatically add the plugins ClassLoader to the list

* Fixes the issue with conflicting bundle names although they may belong to two different ClassLoaders
2018-02-08 15:27:50 -05:00
MiniDigger cebe28ef6c [WIP] Add dependency injection functionality, Closes #85 (#86)
* misc improvements (as suggested by intellij)

* first draft of the DI functionality (#85)

* address review

* reenabled disabled inspections

* overload registerDependency method

* inject fields of superclasses two and remove invalid sponge default dependency
2018-01-25 14:21:16 -05:00
kashike f858e71d7e Deprecate CatchAll in favour of CatchUnknown (#87) 2018-01-23 23:05:52 -05:00
Aikar 2ce58133dc Repeat the last command completion param for all args 2018-01-15 21:14:53 -05:00
Aikar 442e438952 Nothing to see here 2018-01-14 19:51:13 -05:00
Aikar 1739bfc39c Add way to set @Flags context for entire command - Closes #29
Couldn't do it through annotations due to limitations on annotations,
but this achieves same goal.
2018-01-14 19:48:25 -05:00
Aikar a14b30caea Add @CatchAll as a better named replacement to @UnknownHandler
UnknownHandler will still work until we remove it in some future major update
2018-01-14 19:01:26 -05:00
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