Class CommandDescriptions
java.lang.Object
dev.ua.theroer.magicutils.commands.CommandDescriptions
Resolves command descriptions, optionally treating
@key values as language keys.-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable StringdefaultDescriptionKey(@Nullable String commandName) Builds the implicit description translation key for a root command.static @Nullable StringdefaultDescriptionKey(@Nullable String commandName, @Nullable List<String> subCommandPath) Builds the implicit description translation key for a command or subcommand.static booleanisTranslationKey(@Nullable String description) Returns whether the description uses the@keylocalisation syntax.static StringresolveForAudience(@Nullable String languageScope, @Nullable Audience audience, @Nullable String description) Resolves a command description for a specific audience, respecting per-player language overrides.static StringresolveForAudience(@Nullable String languageScope, @Nullable Audience audience, @Nullable String description, @Nullable String commandName) Resolves a command description for a specific audience, respecting per-player language overrides, and falling back to the implicitcommands.<name>.descriptionkey when the description is blank.static StringresolveForAudience(@Nullable String languageScope, @Nullable Audience audience, @Nullable String description, @Nullable String commandName, @Nullable List<String> subCommandPath) Resolves a command description for a specific audience, respecting per-player language overrides, and falling back to the implicitcommands.<command>[.<subcommand>...].descriptionkey when the description is blank.static StringresolveGlobal(@Nullable String languageScope, @Nullable String description) Resolves a command description for global metadata such as registration and schema inspection.static StringresolveGlobal(@Nullable String languageScope, @Nullable String description, @Nullable String commandName) Resolves a command description for global metadata such as registration and schema inspection, falling back to the implicitcommands.<name>.descriptionkey when the description is blank.static StringresolveGlobal(@Nullable String languageScope, @Nullable String description, @Nullable String commandName, @Nullable List<String> subCommandPath) Resolves a command description for global metadata such as registration and schema inspection, falling back to the implicitcommands.<command>[.<subcommand>...].descriptionkey when the description is blank.
-
Method Details
-
resolveGlobal
public static String resolveGlobal(@Nullable @Nullable String languageScope, @Nullable @Nullable String description) Resolves a command description for global metadata such as registration and schema inspection.- Parameters:
languageScope- plugin/mod scope used for scoped language managersdescription- raw description or@key- Returns:
- resolved description text
-
resolveGlobal
public static String resolveGlobal(@Nullable @Nullable String languageScope, @Nullable @Nullable String description, @Nullable @Nullable String commandName) Resolves a command description for global metadata such as registration and schema inspection, falling back to the implicitcommands.<name>.descriptionkey when the description is blank.- Parameters:
languageScope- plugin/mod scope used for scoped language managersdescription- raw description or@keycommandName- root command name- Returns:
- resolved description text
-
resolveGlobal
public static String resolveGlobal(@Nullable @Nullable String languageScope, @Nullable @Nullable String description, @Nullable @Nullable String commandName, @Nullable @Nullable List<String> subCommandPath) Resolves a command description for global metadata such as registration and schema inspection, falling back to the implicitcommands.<command>[.<subcommand>...].descriptionkey when the description is blank.- Parameters:
languageScope- plugin/mod scope used for scoped language managersdescription- raw description or@keycommandName- root command namesubCommandPath- relative subcommand path- Returns:
- resolved description text
-
resolveForAudience
public static String resolveForAudience(@Nullable @Nullable String languageScope, @Nullable @Nullable Audience audience, @Nullable @Nullable String description) Resolves a command description for a specific audience, respecting per-player language overrides.- Parameters:
languageScope- plugin/mod scope used for scoped language managersaudience- recipient audiencedescription- raw description or@key- Returns:
- resolved description text
-
resolveForAudience
public static String resolveForAudience(@Nullable @Nullable String languageScope, @Nullable @Nullable Audience audience, @Nullable @Nullable String description, @Nullable @Nullable String commandName) Resolves a command description for a specific audience, respecting per-player language overrides, and falling back to the implicitcommands.<name>.descriptionkey when the description is blank.- Parameters:
languageScope- plugin/mod scope used for scoped language managersaudience- recipient audiencedescription- raw description or@keycommandName- root command name- Returns:
- resolved description text
-
resolveForAudience
public static String resolveForAudience(@Nullable @Nullable String languageScope, @Nullable @Nullable Audience audience, @Nullable @Nullable String description, @Nullable @Nullable String commandName, @Nullable @Nullable List<String> subCommandPath) Resolves a command description for a specific audience, respecting per-player language overrides, and falling back to the implicitcommands.<command>[.<subcommand>...].descriptionkey when the description is blank.- Parameters:
languageScope- plugin/mod scope used for scoped language managersaudience- recipient audiencedescription- raw description or@keycommandName- root command namesubCommandPath- relative subcommand path- Returns:
- resolved description text
-
isTranslationKey
Returns whether the description uses the@keylocalisation syntax.- Parameters:
description- description to inspect- Returns:
- true when the value should be resolved through
LanguageManager
-
defaultDescriptionKey
-
defaultDescriptionKey
@Nullable public static @Nullable String defaultDescriptionKey(@Nullable @Nullable String commandName, @Nullable @Nullable List<String> subCommandPath) Builds the implicit description translation key for a command or subcommand.The key format is
commands.<command>[.<subcommand>...].description.- Parameters:
commandName- root command namesubCommandPath- relative subcommand path- Returns:
- translation key or null when the command name is blank
-