Class TranslateManager

java.lang.Object
me.efekos.simpler.translation.TranslateManager

public class TranslateManager extends Object
Static manager to translate colors and generate translation keys.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Pattern
    The pattern used for detecting hex colors.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new manager instance if you somehow need one.
  • Method Summary

    Modifier and Type
    Method
    Description
    static @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 the PotionEffectType given.
    static @NotNull net.md_5.bungee.api.chat.TranslatableComponent
    translateEnchantment(@NotNull org.bukkit.enchantments.Enchantment enchantment)
    Generates a translation key for the Enchantment given.
    static @NotNull net.md_5.bungee.api.chat.TranslatableComponent
    translateEntity(@NotNull org.bukkit.entity.EntityType type)
    Generates a translation key for the EntityType given.
    static @NotNull net.md_5.bungee.api.chat.TranslatableComponent
    translateMaterial(@NotNull org.bukkit.Material material)
    Generates a translation key for the Material given.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • hexColorsPattern

      public static final Pattern 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 the Material given.
      Parameters:
      material - A material that Material.isBlock() or Material.isItem().
      Returns:
      A TranslatableComponent that will show name of the material. You can use it with Player.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 the EntityType given.
      Parameters:
      type - Any entity type.
      Returns:
      A TranslatableComponent that will show name of the entity. You can use it with Player.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 the Enchantment given.
      Parameters:
      enchantment - Any enchantment.
      Returns:
      A TranslatableComponent that will show name of the enchantment. You can use it with Player.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 the PotionEffectType given.
      Parameters:
      type - One of the PotionEffectTypes in game.
      Returns:
      A TranslatableComponent that will show name of the potion effect. You can use it with Player.Spigot.sendMessage(BaseComponent...).
    • translateColors

      @NotNull public static @NotNull String translateColors(@NotNull @NotNull String message)
      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.