Enum Class MergePolicy

java.lang.Object
java.lang.Enum<MergePolicy>
dev.ua.theroer.magicutils.annotations.MergePolicy
All Implemented Interfaces:
Serializable, Comparable<MergePolicy>, Constable

public enum MergePolicy extends Enum<MergePolicy>
How a command node behaves when several plugins contribute to the same command tree — e.g. two plugins each adding sub-commands under a shared /nox root. It governs ownership of a node's execute action (the handler that runs when a player stops at that node), not whether sub-commands are added: leaf sub-commands always accumulate.

The default is CONTRIBUTE, which makes merging safe: a node's execute is claimed only if still free, so contributions accumulate and no plugin silently clobbers another's handler regardless of load order.

  • Enum Constant Details

    • CONTRIBUTE

      public static final MergePolicy CONTRIBUTE
      Claim this node's execute only if no one has claimed it yet (put-if-absent); never overwrite another plugin's execute. The safe default for contributing into a shared root.
    • OVERRIDE

      public static final MergePolicy OVERRIDE
      Take this node's execute for this contributor, replacing any existing one. If two contributors both OVERRIDE the same node, the last one wins and a warning naming both is logged.
    • EXTEND

      public static final MergePolicy EXTEND
      Only add sub-commands under this node; never claim its execute. Use when a plugin extends a node another plugin owns (e.g. adding worlds create without owning what /nox worlds itself runs).
  • Method Details

    • values

      public static MergePolicy[] 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 MergePolicy 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