java.lang.Object
cn.lunadeer.dominion.api.dtos.flag.Flag
Direct Known Subclasses:
EnvFlag, PriFlag

public abstract class Flag extends Object
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 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 flag
      display_name - the default display name of the flag
      description - the default description of the flag
      default_value - the default value of the flag
      enable - the enable status of the flag
      material - 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 flag
      display_name - the default display name of the flag
      description - the default description of the flag
      default_value - the default value of the flag
      enable - the enable status of the flag
      material - the material used to represent the flag in chest UIs
      icon - resource path in namespace:atlas/sprite form; null or blank means no icon
  • Method Details

    • getFlagName

      @NotNull public @NotNull String getFlagName()
      Returns the name of the flag.
      Returns:
      the name of the flag
    • getDisplayName

      @NotNull public @NotNull String 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

      @NotNull public @NotNull String getDescription()
      Returns the description of the flag. Can be translated in language files.
      Returns:
      the description of the flag
    • getDefaultValue

      @NotNull public @NotNull Boolean getDefaultValue()
      Returns the default value of the flag.
      Returns:
      the default value of the flag
    • getEnable

      @NotNull public @NotNull Boolean 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

      @Nullable public @Nullable String getIcon()
      Returns the native Dialog UI sprite path for this flag.
      Returns:
      resource path in namespace:atlas/sprite form
    • setDisplayName

      public void setDisplayName(String displayName)
      Sets the display name of the flag.
      Parameters:
      displayName - the new display name of the flag
    • setDescription

      public void setDescription(String description)
      Sets the description of the flag.
      Parameters:
      description - the new description of the flag
    • setDefaultValue

      public void setDefaultValue(Boolean defaultValue)
      Sets the default value of the flag.
      Parameters:
      defaultValue - the new default value of the flag
    • setEnable

      public void setEnable(Boolean enable)
      Sets the enable status of the flag.
      Parameters:
      enable - the new enable status of the flag
    • setMaterial

      public void setMaterial(String material)
      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

      public void setIcon(@Nullable @Nullable String icon)
      Sets the native Dialog UI sprite path. Null or blank means no icon. Leading and trailing whitespace is removed.
      Parameters:
      icon - resource path in namespace:atlas/sprite form
    • getDisplayNameKey

      public String getDisplayNameKey()
      Returns the configuration key for the display name of the flag.
      Returns:
      the configuration key for the display name
    • getDescriptionKey

      public String getDescriptionKey()
      Returns the configuration key for the description of the flag.
      Returns:
      the configuration key for the description
    • getConfigurationDescKey

      public abstract String getConfigurationDescKey()
      Returns the configuration key for the description of this flag.
      Returns:
      the configuration key for the description
    • getConfigurationDefaultKey

      public abstract String getConfigurationDefaultKey()
      Returns the configuration key for the default value of this flag.
      Returns:
      the configuration key for the default value
    • getConfigurationEnableKey

      public abstract String getConfigurationEnableKey()
      Returns the configuration key for the enable status of this flag.
      Returns:
      the configuration key for the enable status
    • getConfigurationNameKey

      public abstract String getConfigurationNameKey()
      Returns the configuration key for the name of this flag.
      Returns:
      the configuration key for the name
    • getConfigurationMaterialKey

      public abstract String getConfigurationMaterialKey()
      Returns the configuration key for the material of this flag.
      Returns:
      the configuration key for the material
    • getConfigurationDialogUiIconKey

      public String getConfigurationDialogUiIconKey()
      Returns the flags.yml key 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