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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull StringtranslateColors(@NotNull String message) Translates the colors in the text given.static @NotNull net.md_5.bungee.api.chat.TranslatableComponenttranslateEffect(@NotNull org.bukkit.potion.PotionEffectType type) Generates a translation key for thePotionEffectTypegiven.static @NotNull net.md_5.bungee.api.chat.TranslatableComponenttranslateEnchantment(@NotNull org.bukkit.enchantments.Enchantment enchantment) Generates a translation key for theEnchantmentgiven.static @NotNull net.md_5.bungee.api.chat.TranslatableComponenttranslateEntity(@NotNull org.bukkit.entity.EntityType type) Generates a translation key for theEntityTypegiven.static @NotNull net.md_5.bungee.api.chat.TranslatableComponenttranslateMaterial(@NotNull org.bukkit.Material material) Generates a translation key for theMaterialgiven.
-
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 theMaterialgiven.- Parameters:
material- A material thatMaterial.isBlock()orMaterial.isItem().- Returns:
- A
TranslatableComponentthat 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 theEntityTypegiven.- Parameters:
type- Any entity type.- Returns:
- A
TranslatableComponentthat 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 theEnchantmentgiven.- Parameters:
enchantment- Any enchantment.- Returns:
- A
TranslatableComponentthat 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 thePotionEffectTypegiven.- Parameters:
type- One of thePotionEffectTypes in game.- Returns:
- A
TranslatableComponentthat 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.
-