Class FlagGroups

java.lang.Object
cn.lunadeer.dominion.api.dtos.flag.FlagGroups

public final class FlagGroups extends Object
Registry for logical flag groups used by Dominion's permission UIs.

Groups affect presentation and bulk editing only; they do not change the result of privilege evaluation. Registered groups retain insertion order.

  • Method Details

    • registerEnvFlagGroup

      public static boolean registerEnvFlagGroup(@NotNull @NotNull org.bukkit.plugin.java.JavaPlugin plugin, @NotNull @NotNull EnvFlagGroup group)
      Registers an environment flag group.
      Parameters:
      plugin - the plugin requesting registration
      group - the group to register
      Returns:
      true when the group was registered; false when its identifier is already registered or is reserved
    • registerPriFlagGroup

      public static boolean registerPriFlagGroup(@NotNull @NotNull org.bukkit.plugin.java.JavaPlugin plugin, @NotNull @NotNull PriFlagGroup group)
      Registers a privilege flag group.
      Parameters:
      plugin - the plugin requesting registration
      group - the group to register
      Returns:
      true when the group was registered; false when its identifier is already registered or is reserved
    • unregisterEnvFlagGroup

      @Nullable public static @Nullable EnvFlagGroup unregisterEnvFlagGroup(@NotNull @NotNull String id)
      Removes an environment flag group from the registry.
      Parameters:
      id - the identifier of the group to remove
      Returns:
      the removed group, or null if no group has that identifier
    • unregisterPriFlagGroup

      @Nullable public static @Nullable PriFlagGroup unregisterPriFlagGroup(@NotNull @NotNull String id)
      Removes a privilege flag group from the registry.
      Parameters:
      id - the identifier of the group to remove
      Returns:
      the removed group, or null if no group has that identifier
    • getEnvFlagGroup

      @Nullable public static @Nullable EnvFlagGroup getEnvFlagGroup(@NotNull @NotNull String id)
      Looks up an environment flag group by identifier.
      Parameters:
      id - the group identifier
      Returns:
      the registered group, or null when it is not registered
    • getPriFlagGroup

      @Nullable public static @Nullable PriFlagGroup getPriFlagGroup(@NotNull @NotNull String id)
      Looks up a privilege flag group by identifier.
      Parameters:
      id - the group identifier
      Returns:
      the registered group, or null when it is not registered
    • getEnvFlagGroups

      @NotNull public static @NotNull List<EnvFlagGroup> getEnvFlagGroups()
      Gets all registered environment flag groups in registration order.
      Returns:
      an immutable snapshot of the registered groups
    • getPriFlagGroups

      @NotNull public static @NotNull List<PriFlagGroup> getPriFlagGroups()
      Gets all registered privilege flag groups in registration order.
      Returns:
      an immutable snapshot of the registered groups
    • getUngroupedEnvFlags

      @NotNull public static @NotNull EnvFlagGroup getUngroupedEnvFlags()
      Creates a dynamic group containing environment flags not in a registered group. The returned group is not added to the registry.
      Returns:
      the current ungrouped environment flags
    • getUngroupedPriFlags

      @NotNull public static @NotNull PriFlagGroup getUngroupedPriFlags()
      Creates a dynamic group containing privilege flags not in a registered group. The returned group is not added to the registry.
      Returns:
      the current ungrouped privilege flags
    • getRevision

      public static long getRevision()
      Gets the registry revision.

      The revision changes when a group is added, removed, reloaded, or its presentation metadata changes.

      Returns:
      the current registry revision
    • replaceConfiguredGroups

      @Internal public static void replaceConfiguredGroups(@NotNull @NotNull Collection<EnvFlagGroup> environment, @NotNull @NotNull Collection<PriFlagGroup> privilege)
      Replaces the configured groups during plugin configuration loading.
      Parameters:
      environment - the environment groups to load
      privilege - the privilege groups to load
    • defaultEnvironmentGroups

      @Internal @NotNull public static @NotNull List<EnvFlagGroup> defaultEnvironmentGroups()
      Creates the built-in default environment groups.
      Returns:
      the default environment groups in display order
    • defaultPrivilegeGroups

      @Internal @NotNull public static @NotNull List<PriFlagGroup> defaultPrivilegeGroups()
      Creates the built-in default privilege groups.
      Returns:
      the default privilege groups in display order