Custom Flag
About 220 wordsLess than 1 minute
2025-10-10
Starting from version 4.7.0, Dominion introduces the custom Flag feature, allowing developers to add custom Flags to the dominion system.
Introduction
The Flag system in Dominion consists of two types of Flags:
EnvFlag
: Environment Flag, used to represent territory attributes unrelated to player behavior, such as natural environment, weather, etc.PriFlag
: Privilege Flag, used to represent territory attributes related to player behavior, such as whether players can build or destroy within the territory.
Flag object definition:
/**
* Constructs a new Flag.
*
* @param flag_name the name of the flag (should be unique and not contain spaces)
* @param display_name the display name of the flag
* @param description the description of the flag
* @param default_value the default value of the flag
* @param enable the enable status of the flag
* @param material the material of flag in CUI
*/
Creating a Custom Flag
// Define a custom EnvFlag
public static EnvFlag NO_RAIN = new EnvFlag("no_rain", "No Rain", "Weather does not change to rain in this dominion.", false, true, Material.SUNFLOWER);
// Define a custom PriFlag
public static PriFlag BED = new PriFlag("bed", "Bed", "Weather can sleep in bed (set spawn point).", false, true, Material.RED_BED);
// Register the custom flags
Flags.registerEnvFlag(NO_RAIN);
Flags.registerPriFlag(BED);
// Apply the custom flags to dominion system.
Flags.applyNewCustomFlags();