Commit Graph

86 Commits

Author SHA1 Message Date
Gabik21MC 7c75cdd48c Improvements (#143)
Improve help output for commands split over multiple base commands
Fix help last page detection
Fix missing argument on Player Context Resolve
Expose registered root commands
2018-06-18 15:15:03 -04:00
Gabik21MC 961009a77c Support old user names (#133)
Recently a player with a two letter account joined on my server and I noticed that the context resolver for the player interface does not work. This PR also fixes crazy names like these:
https://de.namemc.com/profile/%24.1
https://de.namemc.com/profile/u.1
2018-05-29 11:04:14 -04:00
Aikar 8335d580f6 Improvements to help formatter 2018-03-21 22:02:48 -04:00
Aikar 55a5e5eaf9 Merge branch 'annotations'
* annotations:
  Default empty descriptions
  fix annotation lookup
  Fix Bukkit Description being null, supply usage/description to Sponge/Bungee
  fix looking up annotations without value methods
  More cleanup and refactoring
  move annotation lookup methods into their own file to declutter class
  clean up code more, break out methods
  Refactor all annotation lookups in prep for processors
2018-03-17 23:51:22 -04:00
Aikar d3a00bfde6 fix bukkit get offline player check 2018-03-17 22:37:56 -04:00
Aikar ec235d80fc Fix Bukkit Description being null, supply usage/description to Sponge/Bungee 2018-03-17 19:51:52 -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
Aikar 4b74170a92 Automatically remove commands registered through plugin.yml
avoids mystery "command does nothing" accidents.
2018-03-05 22:17:54 -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
Xavier 816f1953df Added the autoDetectFromClient feature for Bukkit languages, it will disable the automated language detection system. (#100) 2018-02-08 15:28:54 -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
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 dce6bd2e64 add setPlayerLocale API for Bukkit 2018-01-13 11:20:45 -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
Aikar f591117733 Support looking up offline players 2018-01-05 19:51:15 -05:00
Aikar a1c9382251 Allow using Bukkit Player in place of OnlinePlayer
requires @Flags("other") is set
and also supports @Flags("other,defaultself") to target self if not supplied
2018-01-05 19:38:22 -05:00
Aikar 2057ed8a42 More work on Command Conditions #58 2017-12-17 13:46:22 -05:00
Aikar d23588b046 Bukkit/Paper: expose .getPlayer() to completion/execution context 2017-12-09 13:01:39 -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 e8c05cc39b Fix Cast to player issue for Bukkit 2017-11-25 19:17:33 -05:00
Aikar adfb4b11a1 Add support for Per Player Locale on Bukkit - Resolves #62 2017-11-24 13:05:20 -05:00
Aikar fd314b0f7c Fix syntax/desc returning null 2017-10-28 12:42:23 -04:00
Aikar a02d761e5e Set bukkit usage/description data 2017-10-28 12:21:35 -04:00
Aikar c188312fb1 Fix unregister of bukkit/bungee commands.
A RootCommand is shared between any BaseCommand that all use the same root.

We should not unregister the root command until all sub commands are unregistered.
2017-09-05 23:35:27 -04:00
Aikar 75579fe649 more fixes, formatting, expand control over format, fix dupe 2017-08-08 22:08:05 -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 76aba7993d Undeprecate the findPlayerSmart(CommandSender) methods and route them to the Issuer version 2017-08-03 00:31:53 -04:00
Aikar 85554c2b6e remove extra error feedback on OnlinePlayer's 2017-08-02 23:30:37 -04:00
Aikar bba86047aa Clean up rel and force it to be before x 2017-08-01 21:47:31 -04:00
Aikar 7ba15c1454 If one coord is relative, all should be treated relative (so only prefix X) 2017-08-01 21:44:51 -04:00
Aikar 48dc4e7fe9 Add Location context to Bukkit 2017-08-01 21:33:56 -04:00
Aikar 6be206ffa7 add dye color completions 2017-07-31 22:33:36 -04:00
Aikar 829d79a737 Fix the Bukkit force unregister command logic
The previous made the command think it was fully unregistered,
instead of just removing just the conflicting entry.
2017-07-19 22:57:01 -04:00
Aikar d76d796feb add hashcodes/equals to command issuers 2017-07-19 19:45:16 -04:00
mrkirby153 5be72c40e2 Generify help generation 2017-07-18 19:41:45 -07:00
Aikar ef3b844ffa Move MessageFormatter stuff to base class using generics, readd default formatter G/S 2017-07-18 21:52:42 -04:00
Aikar 418bbd6fd9 Use generics on manager to understand impl types
Slight risk of API breakage but risk is minimal enough that I'm not bumping versions.

0.5.0 Migration guide suggested (Platform)CommandManager, which will set the generics for you.
Only if you stored the ref as the Abstract CommandManager would you now run into generic issues.

Also, cleaned up the sendMessage API's to not need Object now since we know the Generic type.

This is technically an API break, but considering Locales was only released last night and
the likelyhood someone overrode that method, is unlikey.

If you did, just fix the method signature! Sorry <3
2017-07-18 21:43:32 -04:00
mrkirby153 1d5b0f086d Rework how help is generated 2017-07-18 15:57:51 -07:00
mrkirby153 fd61e67974 First revision of help system 2017-07-18 11:25:56 -07:00
Aikar d24ae03b12 fix the format API's and add setFormat(type, i, color) 2017-07-18 08:31:35 -04:00
Aikar 0335378205 clean up bukkit command map stuff 2017-07-18 00:24:43 -04:00
Aikar 05b8141573 auto load locales 2017-07-18 00:21:45 -04:00
Aikar 39f569330b load parent acf-core lang 2017-07-18 00:20:27 -04:00
Aikar b0ae0209c9 Load languages post locales construction 2017-07-18 00:11:13 -04:00