Enum Class Capability

java.lang.Object
java.lang.Enum<Capability>
com.ultikits.ultitools.entities.Capability
All Implemented Interfaces:
Serializable, Comparable<Capability>, java.lang.constant.Constable

public enum Capability extends Enum<Capability>
The panel-facing remote surface, sliced into ten independently-switchable capabilities plus the NONE sentinel for protocol-level messages.

Each config-backed constant owns its own ultipanel.capabilities.* key, its own D-08 shipped default, and the comment lines the capability migration attaches when it writes the key for the first time. isEnabled() is the single config read every inbound and outbound capability gate consults; as of 6.3.1 the UltiCloud protocol v2 router reads it for every request.

Since:
6.3.0
  • Enum Constant Details

    • MONITORING

      public static final Capability MONITORING
    • LOGS

      public static final Capability LOGS
    • PLAYER_EVENTS

      public static final Capability PLAYER_EVENTS
    • FILE_READ

      public static final Capability FILE_READ
    • FILE_WRITE

      public static final Capability FILE_WRITE
    • FILE_DELETE

      public static final Capability FILE_DELETE
    • COMMANDS

      public static final Capability COMMANDS
    • SERVER_PROPERTIES

      public static final Capability SERVER_PROPERTIES
    • POWER_ACTIONS

      public static final Capability POWER_ACTIONS
    • PLAYER_ACTIONS

      public static final Capability PLAYER_ACTIONS
    • NONE

      public static final Capability NONE
      The D-10 sentinel for protocol-level and echo messages that carry no operator-facing policy. Never written to config.yml and never gated — isEnabled() always returns true without touching config.
  • Field Details

    • configKey

      private final String configKey
    • defaultEnabled

      private final boolean defaultEnabled
    • commentLines

      private final List<String> commentLines
  • Constructor Details

    • Capability

      private Capability(String configKey, boolean defaultEnabled, List<String> commentLines)
  • Method Details

    • values

      public static Capability[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Capability valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • configBasePath

      public static String configBasePath()
      The literal config-key prefix every capability lives under in config.yml.
      Returns:
      "ultipanel.capabilities."
    • getConfigKey

      public String getConfigKey()
      This capability's config key suffix (e.g. "commands").
      Returns:
      the config key suffix, or null for NONE
    • getDefaultEnabled

      public boolean getDefaultEnabled()
      The D-08 shipped default this capability resolves to when its key is absent from config.yml.
      Returns:
      the shipped default
    • getCommentLines

      public List<String> getCommentLines()
      The explanatory comment lines the capability migration attaches when it writes this key for the first time. English first with Chinese as supplement.
      Returns:
      an unmodifiable list of comment lines
    • getConfigPath

      public String getConfigPath()
      The full dotted config path for this capability.
      Returns:
      e.g. "ultipanel.capabilities.commands"
    • isEnabled

      public boolean isEnabled()
      Whether this capability is currently enabled.

      Never throws and never propagates a config-read failure — modelled on ErrorReportCollector.loadConfiguration()'s try/catch shape. When UltiTools.getInstance() is null or its config is unavailable, this returns the constant's own getDefaultEnabled() rather than a swallowed NullPointerException, so a test harness without a live config sees shipped behaviour. Not cached — the operator may reload config.

      Returns:
      true if this capability is enabled
    • configurableRefusal

      public static String configurableRefusal(String configKey)
      A refusal sentence for a capability whose gate an operator CAN change through configuration. Names the exact key and file, per D-05/D-13/D-17. This and nonConfigurableRefusal(java.lang.String) are the single source of refusal wording for the whole phase — callers must not format their own refusal strings.
      Parameters:
      configKey - the full dotted config path that would flip this refusal
      Returns:
      the refusal sentence
    • nonConfigurableRefusal

      public static String nonConfigurableRefusal(String reason)
      A refusal sentence for a restriction no configuration can lift. States plainly that it cannot be changed, per D-17's requirement that the two refusal causes never collapse into one sentence.
      Parameters:
      reason - why the restriction exists
      Returns:
      the refusal sentence
    • refusalMessage

      public String refusalMessage()
      This capability's own refusal message, naming its config path.
      Returns:
      the refusal sentence produced by configurableRefusal(String) for this capability's own config path