类 JsonLocalizations

java.lang.Object
cn.afternode.commons.bukkit.JsonLocalizations
所有已实现的接口:
IAdventureLocalizations, cn.afternode.commons.localizations.ILocalizations

public class JsonLocalizations extends Object implements IAdventureLocalizations
Minecraft style *.json language file
  • 构造器详细资料

    • JsonLocalizations

      public JsonLocalizations(com.google.gson.JsonObject obj)
      Load from JsonObject
      参数:
      obj - Json
      另请参阅:
      • Gson.fromJson(String, Class)
    • JsonLocalizations

      public JsonLocalizations(ClassLoader loader, String path)
      Load from ClassLoader resources with raw path
      参数:
      loader - Loader
      path - Raw resource path
    • JsonLocalizations

      public JsonLocalizations(String path)
      Load from resources with raw path
      参数:
      path - Raw resource path
    • JsonLocalizations

      public JsonLocalizations(ClassLoader loader, String namespace, String langCode)
      Load from ClassLoader resources, at /assets/(namespace)/lang/(langCode).json
      参数:
      loader - Loader
      namespace - Namespace in path
      langCode - Language file name
      另请参阅:
    • JsonLocalizations

      public JsonLocalizations(String namespace, String langCode)
      Load from resources
      参数:
      namespace - Namespace in path
      langCode - Language file name
      另请参阅:
  • 方法详细资料

    • get

      public String get(String key)
      指定者:
      get 在接口中 cn.afternode.commons.localizations.ILocalizations
    • get

      public String get(String key, Map<String,Object> placeholders)
      指定者:
      get 在接口中 cn.afternode.commons.localizations.ILocalizations
    • get

      public String get(String key, String... args)
      指定者:
      get 在接口中 cn.afternode.commons.localizations.ILocalizations
    • keys

      public Set<String> keys()
      指定者:
      keys 在接口中 cn.afternode.commons.localizations.ILocalizations
    • getResourcePath

      public static String getResourcePath(String namespace, String langCode)
    • legacy

      public net.kyori.adventure.text.TextComponent legacy(String key)
      从接口复制的说明: IAdventureLocalizations
      Get localizations without any placeholder and deserialize with legacy serializer
      指定者:
      legacy 在接口中 IAdventureLocalizations
      参数:
      key - Localization key
      返回:
      Result localization or provided key if not found
    • legacy

      public net.kyori.adventure.text.TextComponent legacy(String key, Map<String,Object> placeholders)
      从接口复制的说明: IAdventureLocalizations
      Get localizations with specified placeholders and deserialize with legacy serializer
      指定者:
      legacy 在接口中 IAdventureLocalizations
      参数:
      key - Localization key
      placeholders - Placeholders
      返回:
      Result localizations with placeholders applied, or provided key if not found
    • legacy

      public net.kyori.adventure.text.TextComponent legacy(String key, String... args)
      从接口复制的说明: IAdventureLocalizations
      Get localizations with java formatter and deserialize with legacy serializer
      指定者:
      legacy 在接口中 IAdventureLocalizations
      参数:
      key - Localization key
      args - Formater replacements
      返回:
      Result localizations with String#format
      另请参阅:
    • mini

      public net.kyori.adventure.text.Component mini(String key)
      从接口复制的说明: IAdventureLocalizations
      Get localizations without any placeholder and deserialize with MiniMessage
      指定者:
      mini 在接口中 IAdventureLocalizations
      参数:
      key - Localization key
      返回:
      Result localization or provided key if not found
    • mini

      public net.kyori.adventure.text.Component mini(String key, Map<String,Object> placeholders)
      从接口复制的说明: IAdventureLocalizations
      Get localizations with specified placeholders and deserialize with MiniMessage
      指定者:
      mini 在接口中 IAdventureLocalizations
      参数:
      key - Localization key
      placeholders - Placeholders
      返回:
      Result localizations with placeholders applied, or provided key if not found
    • mini

      public net.kyori.adventure.text.Component mini(String key, String... args)
      从接口复制的说明: IAdventureLocalizations
      Get localizations, format with Java formatter and deserialize with MiniMessage
      指定者:
      mini 在接口中 IAdventureLocalizations
      参数:
      key - Localization key
      args - Formater replacements
      返回:
      Result localizations with String#format
      另请参阅:
    • withLegacySerializer

      public void withLegacySerializer(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer serializer)
      从接口复制的说明: IAdventureLocalizations
      Set current legacy serializer
      指定者:
      withLegacySerializer 在接口中 IAdventureLocalizations
      参数:
      serializer - Serializer
    • withMiniMessage

      public void withMiniMessage(net.kyori.adventure.text.minimessage.MiniMessage mm)
      从接口复制的说明: IAdventureLocalizations
      Set current MiniMessage
      指定者:
      withMiniMessage 在接口中 IAdventureLocalizations
      参数:
      mm - instance
    • withFallback

      public JsonLocalizations withFallback(cn.afternode.commons.localizations.ILocalizations fallback)
      指定者:
      withFallback 在接口中 cn.afternode.commons.localizations.ILocalizations