Class FlagGroups
java.lang.Object
cn.lunadeer.dominion.api.dtos.flag.FlagGroups
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 Summary
Modifier and TypeMethodDescriptionstatic @NotNull List<EnvFlagGroup>Creates the built-in default environment groups.static @NotNull List<PriFlagGroup>Creates the built-in default privilege groups.static @Nullable EnvFlagGroupgetEnvFlagGroup(@NotNull String id) Looks up an environment flag group by identifier.static @NotNull List<EnvFlagGroup>Gets all registered environment flag groups in registration order.static @Nullable PriFlagGroupgetPriFlagGroup(@NotNull String id) Looks up a privilege flag group by identifier.static @NotNull List<PriFlagGroup>Gets all registered privilege flag groups in registration order.static longGets the registry revision.static @NotNull EnvFlagGroupCreates a dynamic group containing environment flags not in a registered group.static @NotNull PriFlagGroupCreates a dynamic group containing privilege flags not in a registered group.static booleanregisterEnvFlagGroup(@NotNull org.bukkit.plugin.java.JavaPlugin plugin, @NotNull EnvFlagGroup group) Registers an environment flag group.static booleanregisterPriFlagGroup(@NotNull org.bukkit.plugin.java.JavaPlugin plugin, @NotNull PriFlagGroup group) Registers a privilege flag group.static voidreplaceConfiguredGroups(@NotNull Collection<EnvFlagGroup> environment, @NotNull Collection<PriFlagGroup> privilege) Replaces the configured groups during plugin configuration loading.static @Nullable EnvFlagGroupunregisterEnvFlagGroup(@NotNull String id) Removes an environment flag group from the registry.static @Nullable PriFlagGroupunregisterPriFlagGroup(@NotNull String id) Removes a privilege flag group from the registry.
-
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 registrationgroup- the group to register- Returns:
truewhen the group was registered;falsewhen 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 registrationgroup- the group to register- Returns:
truewhen the group was registered;falsewhen its identifier is already registered or is reserved
-
unregisterEnvFlagGroup
Removes an environment flag group from the registry.- Parameters:
id- the identifier of the group to remove- Returns:
- the removed group, or
nullif no group has that identifier
-
unregisterPriFlagGroup
Removes a privilege flag group from the registry.- Parameters:
id- the identifier of the group to remove- Returns:
- the removed group, or
nullif no group has that identifier
-
getEnvFlagGroup
Looks up an environment flag group by identifier.- Parameters:
id- the group identifier- Returns:
- the registered group, or
nullwhen it is not registered
-
getPriFlagGroup
Looks up a privilege flag group by identifier.- Parameters:
id- the group identifier- Returns:
- the registered group, or
nullwhen it is not registered
-
getEnvFlagGroups
Gets all registered environment flag groups in registration order.- Returns:
- an immutable snapshot of the registered groups
-
getPriFlagGroups
Gets all registered privilege flag groups in registration order.- Returns:
- an immutable snapshot of the registered groups
-
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
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 loadprivilege- the privilege groups to load
-
defaultEnvironmentGroups
Creates the built-in default environment groups.- Returns:
- the default environment groups in display order
-
defaultPrivilegeGroups
Creates the built-in default privilege groups.- Returns:
- the default privilege groups in display order
-