Class Flag
java.lang.Object
cn.lunadeer.dominion.api.dtos.flag.Flag
Base type for an environment or privilege flag.
A flag has a stable configuration name, presentation metadata, a default value, and an enabled state. The concrete subclasses provide the configuration-key namespace used by Dominion.
-
Constructor Summary
ConstructorsConstructorDescriptionFlag(@NotNull String flag_name, @NotNull String display_name, @NotNull String description, @NotNull Boolean default_value, @NotNull Boolean enable, @NotNull org.bukkit.Material material) Constructs a new Flag with the specified parameters.Flag(@NotNull String flag_name, @NotNull String display_name, @NotNull String description, @NotNull Boolean default_value, @NotNull Boolean enable, @NotNull org.bukkit.Material material, @Nullable String icon) Constructs a flag with an explicit native Dialog UI sprite path. -
Method Summary
Modifier and TypeMethodDescriptionabstract StringReturns the configuration key for the default value of this flag.abstract StringReturns the configuration key for the description of this flag.Returns theflags.ymlkey for this flag's Dialog UI icon.abstract StringReturns the configuration key for the enable status of this flag.abstract StringReturns the configuration key for the material of this flag.abstract StringReturns the configuration key for the name of this flag.@NotNull BooleanReturns the default value of the flag.@NotNull StringReturns the description of the flag.Returns the configuration key for the description of the flag.@NotNull StringReturns the display name of the flag.Returns the configuration key for the display name of the flag.@NotNull BooleanReturns whether the flag is enabled in the current configuration.@NotNull StringReturns the name of the flag.@Nullable StringgetIcon()Returns the native Dialog UI sprite path for this flag.@NotNull org.bukkit.MaterialReturns the material used by this flag in chest user interfaces.voidsetDefaultValue(Boolean defaultValue) Sets the default value of the flag.voidsetDescription(String description) Sets the description of the flag.voidsetDisplayName(String displayName) Sets the display name of the flag.voidSets the enable status of the flag.voidSets the native Dialog UI sprite path.voidsetMaterial(String material) Sets the material used by this flag in chest user interfaces.
-
Constructor Details
-
Flag
public Flag(@NotNull @NotNull String flag_name, @NotNull @NotNull String display_name, @NotNull @NotNull String description, @NotNull @NotNull Boolean default_value, @NotNull @NotNull Boolean enable, @NotNull @NotNull org.bukkit.Material material) Constructs a new Flag with the specified parameters.- Parameters:
flag_name- the stable name of the flagdisplay_name- the default display name of the flagdescription- the default description of the flagdefault_value- the default value of the flagenable- the enable status of the flagmaterial- the material used to represent the flag in chest UIs
-
Flag
public Flag(@NotNull @NotNull String flag_name, @NotNull @NotNull String display_name, @NotNull @NotNull String description, @NotNull @NotNull Boolean default_value, @NotNull @NotNull Boolean enable, @NotNull @NotNull org.bukkit.Material material, @Nullable @Nullable String icon) Constructs a flag with an explicit native Dialog UI sprite path.- Parameters:
flag_name- the stable name of the flagdisplay_name- the default display name of the flagdescription- the default description of the flagdefault_value- the default value of the flagenable- the enable status of the flagmaterial- the material used to represent the flag in chest UIsicon- resource path innamespace:atlas/spriteform;nullor blank means no icon
-
-
Method Details
-
getFlagName
Returns the name of the flag.- Returns:
- the name of the flag
-
getDisplayName
Returns the display name of the flag. This is the name that will be displayed to the user. Can be translated in language files.- Returns:
- the display name of the flag
-
getDescription
Returns the description of the flag. Can be translated in language files.- Returns:
- the description of the flag
-
getDefaultValue
Returns the default value of the flag.- Returns:
- the default value of the flag
-
getEnable
Returns whether the flag is enabled in the current configuration.- Returns:
- the enable status of the flag
-
getMaterial
@NotNull public @NotNull org.bukkit.Material getMaterial()Returns the material used by this flag in chest user interfaces.- Returns:
- the material used by this flag
-
getIcon
Returns the native Dialog UI sprite path for this flag.- Returns:
- resource path in
namespace:atlas/spriteform
-
setDisplayName
Sets the display name of the flag.- Parameters:
displayName- the new display name of the flag
-
setDescription
Sets the description of the flag.- Parameters:
description- the new description of the flag
-
setDefaultValue
Sets the default value of the flag.- Parameters:
defaultValue- the new default value of the flag
-
setEnable
Sets the enable status of the flag.- Parameters:
enable- the new enable status of the flag
-
setMaterial
Sets the material used by this flag in chest user interfaces. Invalid material names are ignored.- Parameters:
material- the Bukkit material name to use
-
setIcon
Sets the native Dialog UI sprite path. Null or blank means no icon. Leading and trailing whitespace is removed.- Parameters:
icon- resource path innamespace:atlas/spriteform
-
getDisplayNameKey
Returns the configuration key for the display name of the flag.- Returns:
- the configuration key for the display name
-
getDescriptionKey
Returns the configuration key for the description of the flag.- Returns:
- the configuration key for the description
-
getConfigurationDescKey
Returns the configuration key for the description of this flag.- Returns:
- the configuration key for the description
-
getConfigurationDefaultKey
Returns the configuration key for the default value of this flag.- Returns:
- the configuration key for the default value
-
getConfigurationEnableKey
Returns the configuration key for the enable status of this flag.- Returns:
- the configuration key for the enable status
-
getConfigurationNameKey
Returns the configuration key for the name of this flag.- Returns:
- the configuration key for the name
-
getConfigurationMaterialKey
Returns the configuration key for the material of this flag.- Returns:
- the configuration key for the material
-
getConfigurationDialogUiIconKey
Returns theflags.ymlkey for this flag's Dialog UI icon. This method is concrete so existing custom Flag subclasses remain valid.- Returns:
- configuration key for the Dialog UI icon
-