GameRules 5.47.0
The game rules a world supports (Bedrock names and defaults), see World::getGameRule() and /gamerule. Each world saves its rules in its level.dat (Bedrock worlds), like the vanilla game.
The rules only set the default outcome: events (PlayerDeathEvent, EntityDamageEvent, BlockBreakEvent, EntityExplodeEvent...) are still called, so plugins can change the result.
Constants
COMMAND_BLOCKS_ENABLED
public const COMMAND_BLOCKS_ENABLED = "commandblocksenabled"COMMAND_BLOCK_OUTPUT
public const COMMAND_BLOCK_OUTPUT = "commandblockoutput"DO_DAYLIGHT_CYCLE
public const DO_DAYLIGHT_CYCLE = "dodaylightcycle"DO_ENTITY_DROPS
public const DO_ENTITY_DROPS = "doentitydrops"DO_FIRE_TICK
public const DO_FIRE_TICK = "dofiretick"DO_IMMEDIATE_RESPAWN
public const DO_IMMEDIATE_RESPAWN = "doimmediaterespawn"DO_INSOMNIA
public const DO_INSOMNIA = "doinsomnia"DO_LIMITED_CRAFTING
public const DO_LIMITED_CRAFTING = "dolimitedcrafting"DO_MOB_LOOT
public const DO_MOB_LOOT = "domobloot"DO_MOB_SPAWNING
public const DO_MOB_SPAWNING = "domobspawning"DO_PATROL_SPAWNING
public const DO_PATROL_SPAWNING = "dopatrolspawning"DO_TILE_DROPS
public const DO_TILE_DROPS = "dotiledrops"DO_TRADER_SPAWNING
public const DO_TRADER_SPAWNING = "dotraderspawning"DO_WEATHER_CYCLE
public const DO_WEATHER_CYCLE = "doweathercycle"DROWNING_DAMAGE
public const DROWNING_DAMAGE = "drowningdamage"FALL_DAMAGE
public const FALL_DAMAGE = "falldamage"FIRE_DAMAGE
public const FIRE_DAMAGE = "firedamage"FREEZE_DAMAGE
public const FREEZE_DAMAGE = "freezedamage"FUNCTION_COMMAND_LIMIT
public const FUNCTION_COMMAND_LIMIT = "functioncommandlimit"KEEP_INVENTORY
public const KEEP_INVENTORY = "keepinventory"LOCATOR_BAR
public const LOCATOR_BAR = "locatorbar"MAX_COMMAND_CHAIN_LENGTH
public const MAX_COMMAND_CHAIN_LENGTH = "maxcommandchainlength"MOB_GRIEFING
public const MOB_GRIEFING = "mobgriefing"NATURAL_REGENERATION
public const NATURAL_REGENERATION = "naturalregeneration"PLAYERS_SLEEPING_PERCENTAGE
public const PLAYERS_SLEEPING_PERCENTAGE = "playerssleepingpercentage"PROJECTILES_CAN_BREAK_BLOCKS
public const PROJECTILES_CAN_BREAK_BLOCKS = "projectilescanbreakblocks"PVP
public const PVP = "pvp"RANDOM_TICK_SPEED
public const RANDOM_TICK_SPEED = "randomtickspeed"RECIPES_UNLOCK
public const RECIPES_UNLOCK = "recipesunlock"RESPAWN_BLOCKS_EXPLODE
public const RESPAWN_BLOCKS_EXPLODE = "respawnblocksexplode"SEND_COMMAND_FEEDBACK
public const SEND_COMMAND_FEEDBACK = "sendcommandfeedback"SHOW_BORDER_EFFECT
public const SHOW_BORDER_EFFECT = "showbordereffect"SHOW_COORDINATES
public const SHOW_COORDINATES = "showcoordinates"SHOW_DAYS_PLAYED
public const SHOW_DAYS_PLAYED = "showdaysplayed"SHOW_DEATH_MESSAGES
public const SHOW_DEATH_MESSAGES = "showdeathmessages"SHOW_RECIPE_MESSAGES
public const SHOW_RECIPE_MESSAGES = "showrecipemessages"SHOW_TAGS
public const SHOW_TAGS = "showtags"SPAWN_RADIUS
public const SPAWN_RADIUS = "spawnradius"TNT_EXPLODES
public const TNT_EXPLODES = "tntexplodes"TNT_EXPLOSION_DROP_DECAY
public const TNT_EXPLOSION_DROP_DECAY = "tntexplosiondropdecay"Methods
allowsEntityDrops()
public static function allowsEntityDrops(\pocketmine\world\World $world) : boolWhether non-living entities (boats, minecarts, armor stands, paintings, leash knots) drop their item when they are broken (doentitydrops).
allowsExplosionGriefing()
public static function allowsExplosionGriefing(\pocketmine\world\World $world, object $cause) : boolWhether an explosion caused by this entity may destroy blocks (mobgriefing; TNT and TNT minecarts are not mobs: vanilla tnt_minecart.json has no destroy_affected_by_griefing).
allowsMobGriefing()
public static function allowsMobGriefing(\pocketmine\world\World $world) : boolWhether mobs may change blocks (sheep eating grass, villagers farming, ravagers breaking leaves, snow golem trails...) and pick up items (mobgriefing).
allowsPlayerDamage()
public static function allowsPlayerDamage(\pocketmine\world\World $world, \pocketmine\event\entity\EntityDamageEvent $source) : boolWhether the world's rules let this damage happen to a player (falldamage, firedamage, drowningdamage, freezedamage, pvp). Only players are protected, like in vanilla.
allowsProjectileBlockBreaking()
public static function allowsProjectileBlockBreaking(\pocketmine\world\World $world) : boolWhether projectiles may break the blocks they hit (decorated pots, chorus flowers, pointed dripstone...) (projectilescanbreakblocks).
allowsRespawnBlockExplosions()
public static function allowsRespawnBlockExplosions(\pocketmine\world\World $world) : boolWhether beds used outside the Overworld and respawn anchors used outside the Nether explode (respawnblocksexplode). When they don't, using them just fails.
getDefault()
public static function getDefault(string $name) : bool|intgetNames()
public static function getNames() : arrayisBool()
public static function isBool(string $name) : boolisSentToClients()
public static function isSentToClients(string $name) : boolnormalizeName()
public static function normalizeName(string $name) : ?stringReturns the rule's name in lowercase if the rule exists (names are case-insensitive), null otherwise.
validate()
public static function validate(string $name, mixed $value) : bool|int|nullReturns the value if it has the rule's type, null otherwise (e.g. a corrupted level.dat entry).
