Package me.efekos.simpler.translation
Class TranslateManager
java.lang.Object
me.efekos.simpler.translation.TranslateManager
Static manager to translate colors and generate translation keys.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull String
translateColors
(@NotNull String message) Translates the colors in the text given.static @NotNull net.md_5.bungee.api.chat.TranslatableComponent
translateEffect
(@NotNull org.bukkit.potion.PotionEffectType type) Generates a translation key for thePotionEffectType
given.static @NotNull net.md_5.bungee.api.chat.TranslatableComponent
translateEnchantment
(@NotNull org.bukkit.enchantments.Enchantment enchantment) Generates a translation key for theEnchantment
given.static @NotNull net.md_5.bungee.api.chat.TranslatableComponent
translateEntity
(@NotNull org.bukkit.entity.EntityType type) Generates a translation key for theEntityType
given.static @NotNull net.md_5.bungee.api.chat.TranslatableComponent
translateMaterial
(@NotNull org.bukkit.Material material) Generates a translation key for theMaterial
given.
-
Field Details
-
hexColorsPattern
The pattern used for detecting hex colors.
-
-
Constructor Details
-
TranslateManager
public TranslateManager()Creates a new manager instance if you somehow need one.
-
-
Method Details
-
translateMaterial
@NotNull public static @NotNull net.md_5.bungee.api.chat.TranslatableComponent translateMaterial(@NotNull @NotNull org.bukkit.Material material) Generates a translation key for theMaterial
given.- Parameters:
material
- A material thatMaterial.isBlock()
orMaterial.isItem()
.- Returns:
- A
TranslatableComponent
that will show name of the material. You can use it withPlayer.Spigot.sendMessage(BaseComponent...)
.
-
translateEntity
@NotNull public static @NotNull net.md_5.bungee.api.chat.TranslatableComponent translateEntity(@NotNull @NotNull org.bukkit.entity.EntityType type) Generates a translation key for theEntityType
given.- Parameters:
type
- Any entity type.- Returns:
- A
TranslatableComponent
that will show name of the entity. You can use it withPlayer.Spigot.sendMessage(BaseComponent...)
.
-
translateEnchantment
@NotNull public static @NotNull net.md_5.bungee.api.chat.TranslatableComponent translateEnchantment(@NotNull @NotNull org.bukkit.enchantments.Enchantment enchantment) Generates a translation key for theEnchantment
given.- Parameters:
enchantment
- Any enchantment.- Returns:
- A
TranslatableComponent
that will show name of the enchantment. You can use it withPlayer.Spigot.sendMessage(BaseComponent...)
.
-
translateEffect
@NotNull public static @NotNull net.md_5.bungee.api.chat.TranslatableComponent translateEffect(@NotNull @NotNull org.bukkit.potion.PotionEffectType type) Generates a translation key for thePotionEffectType
given.- Parameters:
type
- One of thePotionEffectType
s in game.- Returns:
- A
TranslatableComponent
that will show name of the potion effect. You can use it withPlayer.Spigot.sendMessage(BaseComponent...)
.
-
translateColors
Translates the colors in the text given. Supports default minecraft color codes that uses the character&
and hex colors.- Parameters:
message
- Message to translate colors.- Returns:
- Translated message.
-