-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Translatable interface for fluid creation of TranslatableComponents #3558
Conversation
To not confuse users and due to the intended usage inside spigot, the Translateable interface in bungee should have a different name from the existing spigot one. |
I disagree. I think there are plenty of examples of instances where BungeeChat has clashing names with Bukkit classes. ChatColor and some hover contents (Entity and Item) come to mind. The most common use case of this interface would be to pass instances into a TranslatableComponent or a ComponentBuilder. It would be rare for developers to specifically want a If @md-5 agrees with you however, I would at least like to propose one of the following alternatives:
|
|
The Bungee clash causes big issues, but also ChatColor is used a lot more. That being said, I probably like TranslationProvider the best |
I have no issues with |
This PR adds a simple
TranslationProvider
interface to more fluidly createTranslatableComponent
instances. While nothing in the Bungee API needs to implementTranslationProvider
, the Spigot API can most certainly use this interface for types such asItemType
,BlockType
,EntityType
,Enchantment
, so on and so forth.While yes Bukkit does already have a Translatable interface, it cannot be used to directly construct a
TranslatableComponent
which makes working with it cumbersome and forcing developers to access the translation key rather than passing the translatable object directly. Bukkit'sTranslatable
interface may extend BungeeChat'sTranslationProvider
interface for convenience.Perhaps
ComponentBuilder#append(TranslationProvider)
is not clear enough, in which case I proposeappendTranslatable()
instead as a clearer distinction. I'm open to either one.