Revxrsal / Lamp

A modern annotations-driven commands framework for Java and Kotlin
MIT License
202 stars 38 forks source link

Add inline function for AnnotationReplacers & fix issue #14 #15

Closed GrowlyX closed 2 years ago

GrowlyX commented 2 years ago

The second commits fixes locales on legacy spigot versions. (https://github.com/Revxrsal/Lamp/issues/14)

Revxrsal commented 2 years ago

LGTM, thanks!

therealnv6 commented 2 years ago

Keep in mind commit https://github.com/Revxrsal/Lamp/pull/15/commits/d8668a9f85ac78b8ae9487b7876b01166da19c64 makes it incompatible with Bukkit, but (as far as I know) there is a locale field within the EntityPlayer class if you wish to support bukkit (which I assume you do, considering the module name is bukkit).

Not sure if this field exists in every version, but most versions I was able to find contain it:

Rather simple reflection should be able to retrieve this field.

GrowlyX commented 2 years ago

Keep in mind commit d8668a9 makes it incompatible with Bukkit, but (as far as I know) there is a locale field within the EntityPlayer class if you wish to support bukkit (which I assume you do, considering the module name is bukkit).

Although my pull request was merged, @Revxrsal pushed an additional commit with additional code allowing for fallback locales if an exception is thrown & the use of the modern Player#getLocale method if available.

Here's the commit: Fix #14