Enum Class PlayerFlag

java.lang.Object
java.lang.Enum<PlayerFlag>
me.tayebyassine.homestead.flags.PlayerFlag
All Implemented Interfaces:
Serializable, Comparable<PlayerFlag>, Constable

public enum PlayerFlag extends Enum<PlayerFlag>
Enum representing player flags that control individual player permissions within a region.

Player flags govern what actions a specific player can perform in a region, such as breaking/placing blocks, using containers, interacting with entities, PvP combat, and various other gameplay mechanics. These flags are typically assigned per-member or for everyone within a region. Each flag is represented as a unique bit in a 64-bit integer.

See Also:
  • Enum Constant Details

    • BREAK_BLOCKS

      public static final PlayerFlag BREAK_BLOCKS
      Allows breaking blocks in the region.
    • PLACE_BLOCKS

      public static final PlayerFlag PLACE_BLOCKS
      Allows placing blocks in the region.
    • CONTAINERS

      public static final PlayerFlag CONTAINERS
      Allows opening and accessing containers (chests, furnaces, barrels, etc.).
    • DOORS

      public static final PlayerFlag DOORS
      Allows opening and closing wooden doors.
    • TRAP_DOORS

      public static final PlayerFlag TRAP_DOORS
      Allows opening and closing trapdoors.
    • FENCE_GATES

      public static final PlayerFlag FENCE_GATES
      Allows opening and closing fence gates.
    • USE_ANVIL

      public static final PlayerFlag USE_ANVIL
      Allows using anvils for repairing and renaming items.
    • REDSTONE

      public static final PlayerFlag REDSTONE
      Allows interacting with redstone components, excluding buttons, levers, and pressure plates.
    • LEVERS

      public static final PlayerFlag LEVERS
      Allows using levers.
    • BUTTONS

      public static final PlayerFlag BUTTONS
      Allows pressing buttons.
    • PRESSURE_PLATES

      public static final PlayerFlag PRESSURE_PLATES
      Allows activating pressure plates.
    • USE_BELLS

      public static final PlayerFlag USE_BELLS
      Allows ringing bells.
    • TRIGGER_TRIPWIRE

      public static final PlayerFlag TRIGGER_TRIPWIRE
      Allows triggering tripwire hooks.
    • FROST_WALKER

      public static final PlayerFlag FROST_WALKER
      Allows Frost Walker enchantment to create ice on water.
    • HARVEST_CROPS

      public static final PlayerFlag HARVEST_CROPS
      Allows harvesting fully grown crops.
    • BLOCK_TRAMPLING

      public static final PlayerFlag BLOCK_TRAMPLING
      Prevents trampling farmland when walking/jumping on it.
    • GENERAL_INTERACTION

      public static final PlayerFlag GENERAL_INTERACTION
      Allows general interaction with blocks.
    • ARMOR_STANDS

      public static final PlayerFlag ARMOR_STANDS
      Allows interacting with armor stands.
    • INTERACT_ENTITIES

      public static final PlayerFlag INTERACT_ENTITIES
      Allows interacting with entities.
    • ITEM_FRAME_INTERACTION

      public static final PlayerFlag ITEM_FRAME_INTERACTION
      Allows interacting with item frames and glow item frames.
    • DAMAGE_PASSIVE_ENTITIES

      public static final PlayerFlag DAMAGE_PASSIVE_ENTITIES
      Allows damaging passive entities (animals, villagers).
    • DAMAGE_HOSTILE_ENTITIES

      public static final PlayerFlag DAMAGE_HOSTILE_ENTITIES
      Allows damaging hostile entities (mobs, monsters).
    • TRADE_VILLAGERS

      public static final PlayerFlag TRADE_VILLAGERS
      Allows trading with villagers.
    • IGNITE

      public static final PlayerFlag IGNITE
      Allows igniting blocks.
    • VEHICLES

      public static final PlayerFlag VEHICLES
      Allows entering and controlling vehicles (boats, minecarts, horses).
    • TELEPORT_SPAWN

      public static final PlayerFlag TELEPORT_SPAWN
      Allows teleporting to the region's spawn point.
    • PASSTHROUGH

      public static final PlayerFlag PASSTHROUGH
      Allows passing through region borders without permission checks.
    • PVP

      public static final PlayerFlag PVP
      Allows PvP combat with other players in the region.
    • TAKE_FALL_DAMAGE

      public static final PlayerFlag TAKE_FALL_DAMAGE
      Allows taking fall damage in the region.
    • TELEPORT

      public static final PlayerFlag TELEPORT
      Allows teleporting in the region.
    • THROW_POTIONS

      public static final PlayerFlag THROW_POTIONS
      Allows throwing splash/lingering potions in the region.
    • PICKUP_ITEMS

      public static final PlayerFlag PICKUP_ITEMS
      Allows picking up items from the ground in the region.
    • SLEEP

      public static final PlayerFlag SLEEP
      Allows sleeping in beds in the region.
    • TRIGGER_RAID

      public static final PlayerFlag TRIGGER_RAID
      Allows triggering raid events in the region.
    • ELYTRA

      public static final PlayerFlag ELYTRA
      Allows using elytra for gliding in the region.
    • SPAWN_ENTITIES

      public static final PlayerFlag SPAWN_ENTITIES
      Allows spawning entities in the region.
    • PUNCH_SULFUR_CUBES

      @Deprecated public static final PlayerFlag PUNCH_SULFUR_CUBES
      Deprecated.
      Due to heavy main-thread CPU overhead from constant raycasting and high vulnerability to client-side bypasses. Use INTERACT_ENTITIES instead.
      Allows punching sulfur cubes (custom gameplay mechanic).
    • THROW_EGGS

      public static final PlayerFlag THROW_EGGS
      Allows throwing eggs.
  • Method Details

    • values

      public static PlayerFlag[] 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 PlayerFlag 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
    • getFlags

      public static List<String> getFlags()
      Returns a sorted list of all player flag config names.
      Returns:
      list of flag names
    • parse

      public static long parse(String name)
      Parses a flag name and returns its bitmask value.
      Parameters:
      name - the config name of the flag (case-insensitive)
      Returns:
      the bitmask value, or 0 if not found
    • from

      public static String from(long flag)
      Returns the config name of a flag given its bitmask value.
      Parameters:
      flag - the bitmask value
      Returns:
      the config name, or null if not found
    • getSet

      public static List<String> getSet(long flags)
      Returns a list of flag names that are set (enabled) in the given bitmask.
      Parameters:
      flags - the combined bitmask of flags
      Returns:
      list of enabled flag names
    • getUnset

      public static List<String> getUnset(long flags)
      Returns a list of flag names that are not set (disabled) in the given bitmask.
      Parameters:
      flags - the combined bitmask of flags
      Returns:
      list of disabled flag names
    • getBitmask

      public long getBitmask()
      Returns the bitmask value of this flag.
      Returns:
      the bitmask as a long value
    • getName

      public String getName()
      Returns the configuration name of this flag (lowercase with hyphens).
      Returns:
      the config name