Commit Graph

81 Commits

Author SHA1 Message Date
chickeneer e9ca4fcd65 Change valid name checking to a configurable predicate #382
I see the value in allowing acf users to disable the valid name check.
I think others may want to go a step further and create their own
valid name verification. Those that want to truly accept all names can simply
do `CommandManager#setValidNamePredicate(name -> true)` with the new API.
Another solution I considered was having users override the isValidName method
on their CommandManager, but this functionality seemed more friendly.
2023-04-02 16:41:26 -05:00
AlexProgrammerDE 260a772903 Add backwards api support 2023-04-02 06:52:44 -05:00
AlexProgrammerDE 905d5406ec Add allow illegal name manager option 2023-04-02 06:52:44 -05:00
chickeneer 3652ceb975 Send invalid name feedback only after no player is returned #365 2022-04-27 17:22:49 -05:00
chickeneer 153a636fa1 Fix isOptional usage in onlinePlayer context resolvers
Null should not be returned when something is provided as an argument
2022-01-15 13:45:55 -06:00
Alberto Migliorato 24d97bb3eb Added Velocity 3.0.x support 2021-09-13 16:28:54 +02:00
Hasan Demirtaş 5953e6a99e toLowerCase method with Locale.ENGLISH parameter.
Fixes #255
2020-04-12 13:19:35 -04:00
chickeneer 91e7b9d39b Eliminate all length requirements for username lengths GH-226 2019-07-22 18:33:16 -05:00
chickeneer 4b9bab652e Reduce required length of player names GH-226 2019-07-22 17:59:26 -05:00
Aikar 9032570ca2 Fix getFirstElement to not care if there is more than 1 2019-02-24 13:19:25 -05:00
Aikar 17d89ad216 More work towards relocating OnlinePlayer context
This context was conflicting with each other over multiple
ACF modules, so if someone wanted to use multiple ACF's in same jar,
it would clash and not work.

The PR to move these was incomplete and this finishes fixing the
context handlers to support new and old.
2019-02-23 21:23:35 -05:00
McLive f4a5d6f705 Move OnlinePlayer to own packages and deprecate at old locations (#194) 2019-02-23 17:35:37 -05:00
Aikar a140f2dd4a forgot replacement string 2019-02-11 20:41:05 -05:00
Aikar 94ee929d0f add User context for Sponge 2019-02-11 20:19:26 -05:00
Aikar 6481f22ea4 Fix last context for forwarding commands - Closes #179 2019-02-11 20:10:46 -05:00
Aikar 999c803091 Improve permission resolution of RootCommand's
ACF's permission tree can go more complex where a single root command
may have multiple dependent perm nodes.

So essentially ACF does not assign permission nodes to root in bukkit
and the such in a reasonable manner.

With this commit, we try to identify a single unique permission node,
and assign that permission node as the node to use where applicable.

In Bukkit/Sponge, we implement testPermission instead, which does a smarter
look up of all potential commands that root command might execute for the
given issuer, and if they have permission to any of them, then pass as true.

This is much more accurate, so if the issuer has access to no subcommand
then the root command should not be revealed anymore in Bukkit or Sponge.

In bungee, we are best guess at the unique perm node, and if there is
any ambiguity, it will be null and seen by everyone (but still enforces
permission checks)
2019-02-05 00:56:08 -05:00
Mark Vainomaa 65ff5a5500 Replace Guava Iterables (#158)
Goes under #120

After this, only MultiMaps remain.
2018-08-03 09:57:38 -04:00
Osip Fatkullin 3c979a9ef2 Drop trivial Guava usages (#142)
#120, #127
2018-07-19 19:43:17 -04:00
Gabik21MC 9975c3c24e Forgot to implement method for sponge (#144) 2018-06-18 15:58:58 -04:00
Aikar 8335d580f6 Improvements to help formatter 2018-03-21 22:02:48 -04:00
Aikar ec235d80fc Fix Bukkit Description being null, supply usage/description to Sponge/Bungee 2018-03-17 19:51:52 -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
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 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 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 2057ed8a42 More work on Command Conditions #58 2017-12-17 13:46:22 -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 adfb4b11a1 Add support for Per Player Locale on Bukkit - Resolves #62 2017-11-24 13:05:20 -05:00
Aikar 55d238614f Add missing getDefCommand for Sponge - Fixes #75 2017-11-14 01:00:47 -05: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 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 85554c2b6e remove extra error feedback on OnlinePlayer's 2017-08-02 23:30:37 -04:00
Aikar d76d796feb add hashcodes/equals to command issuers 2017-07-19 19:45:16 -04:00
Aikar af3177f334 Fix sponge context {valid} stuff 2017-07-18 22:39:34 -04: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
Redrield 495e33e47e Added contexts for TextColor and TextStyle.Base (#61) 2017-07-18 20:42:08 -05:00
Aikar d24ae03b12 fix the format API's and add setFormat(type, i, color) 2017-07-18 08:31:35 -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
Aikar b4539aa1ed Open the Locales API! 2017-07-17 23:59:50 -04:00
Aikar 9ee590026f add setFormat API's 2017-07-17 23:57:04 -04:00
Aikar 1813dbe83c support a default formatter 2017-07-17 23:42:37 -04:00