Commit Graph

49 Commits

Author SHA1 Message Date
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 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
Aikar e82b5ef9bd Refactor supported languages and move MessageKeyProvider to co.a.locales 2017-07-17 23:25:30 -04:00
Aikar 89d5e86823 Use per-platform Locales classes 2017-07-17 21:07:53 -04:00
Aikar d2d0f22a07 use acf prefixes to msg keys 2017-07-03 19:04:31 -05:00
Aikar 60821e6c00 add World context to Sponge 2017-07-03 18:39:33 -05:00
Aikar bafbef5358 add OnlinePlayer[] to Sponge 2017-07-03 18:35:29 -05:00
Aikar e6ab045607 add command source/player context for sponge 2017-07-03 18:34:42 -05:00
Aikar 5398e3f8a7 add OnlinePlayer context for Sponge 2017-07-03 18:30:06 -05:00
Aikar f900a739df Add Sponge CommandResult API/Context and move/add operation context 2017-07-03 02:35:34 -05:00
Aikar 6243202fe9 Fix sponge @Default command handling 2017-07-03 00:04:45 -05:00
Aikar b128908a77 Replace a bit of code duplication and misc cleanup 2017-07-03 00:02:43 -05:00
Aikar d9652ba9eb autoload message bundles based on plugin name 2017-07-02 14:27:44 -05:00
Aikar 8168122241 Massive i18n work, not fully finished set but resolves #53 2017-06-30 12:05:00 -05:00
Aikar c9acb55a48 ton more I18N/Locales work, messages migrated! 2017-06-29 00:36:59 -04:00
Aikar a93d1cf5bc add MessageKey method to CommandIssuer and misc stuff 2017-06-28 23:02:23 -04:00
Aikar 12b5da35f4 Refactor the MessageFormatter to support any number of colors 2017-06-27 19:41:51 -04:00
Aikar cd109eb266 Implement Chat Formatting per platform 2017-06-27 00:24:05 -04:00
Aikar 2e493fcb49 Clean up logging code duplication 2017-06-26 23:12:48 -04:00
Aikar f2e96ea244 Start of I18N work 2017-06-26 23:03:18 -04:00
Aikar 3a4ebe2d45 MC Timing upgrade, fix timing integrations, add parent timing 2017-06-24 01:23:22 -04:00
Aikar 15b149d55c Big Break: Change the Command Completion Handler signature to match Context
For consistency, make Completion Handlers be implemented the same way Context Handlers are.

Previously when we added the Context parameter, we left the original signature in place and simply tacked , c on the end.

This made migration easier than changing all completion handlers bodies.

But since 0.5.0 is a big migration already, let's just get it over with.

See changes to Bukkit default completions and the example plugin for migration example.
2017-06-14 22:17:33 -04:00
Aikar bd19a78ec1 rename testPermission to hasPermission 2017-06-07 23:51:42 -04:00
Aikar 93221e7832 fix sponge perm check 2017-06-07 23:50:34 -04:00
Aikar 64c04e5944 clean up permission checking 2017-06-07 23:46:33 -04:00
kashike 96a3a3c57d Death to ACFLog (#42) 2017-06-06 19:03:01 -04:00
kashike cd892fccd4 Start of Sponge support (#41) 2017-06-05 11:25:00 -04:00