Class XGameRule<T>
- Type Parameters:
T- The type of the value that this game rule requires. Usually onlyIntegerorBoolean(rarelyString)
The Bukkit
GameRule class itself was added around Minecraft v1.13
so it's recommended to use the getValue(World) and setValue(World, Object)
of this class instead of interacting with GameRule object directly or the methods
provided in World as they've been changed.- Author:
- Almighty-Satan
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionWhether the daylight cycle and moon phases progress.Whether weather cycles (rain, thunder) progress naturally.Whether players can enter the Nether using portals.Deprecated.Whether blocks drop items when broken (not by explosions or creative mode).Whether block explosion drops have decay (chance to not drop based on distance).Whether command blocks should notify admins when they perform commands.Whether command blocks are enabled and can execute commands.Deprecated.Whether players take drowning damage.Whether the server checks for elytra flight cheating (speed/movement validation).Whether ender pearls disappear when the player dies.Whether non-mob entities (like boats, minecarts, items from item frames) drop items when broken.Whether players take fall damage.Whether players take fire/lava damage.Radius around players where fire spreads faster or is allowed.Whether angered neutral mobs forgive players who die and respawn.Whether players take freeze damage in powder snow.Deprecated.Whether certain sound events are heard globally by all players.Whether players respawn immediately without the death screen.Whether players keep their inventory and experience after death.Whether lava source blocks convert to flowing lava under certain conditions.Whether crafting recipes require the exact arrangement as discovered in the recipe book.Whether the locator bar (on maps?)Whether admin commands (like /give, /tp) are logged to the server log.Maximum number of block modifications allowed in a single command (anti-grief).Maximum number of command forks allowed.Maximum length of a command chain (function or command block chain).Maximum number of entities that can be crammed in one block before taking suffocation damage.Maximum speed of minecarts.Maximum height snow can accumulate in a single block.Whether mobs drop their loot (items and experience) when killed.Whether mob (creeper/ghast) explosion drops have decay.Whether mobs can grief the world (e.g., creepers explode blocks, endermen pick up blocks).Whether players naturally regenerate health when hunger is full.Whether the server performs player movement validation checks.Delay (in ticks) for players in creative mode entering Nether portals.Default delay (in ticks) for players entering Nether portals in survival/adventure.Percentage of players that must sleep to skip the night.Whether projectiles (arrows, tridents, etc.) can break certain blocks.Whether PvP (player vs player damage) is enabled.Whether raids can occur (inverted: true disables raids).Controls the rate of random block ticks (crop growth, leaf decay, etc.).Whether reduced debug screen info is shown (hides coordinates, etc.).The radius around world spawn where players respawn if no bed.Whether command feedback (success/failure messages) is sent to the player.Whether advancement completion messages are announced in chat.Whether death messages are shown in chat.Deprecated.Whether mobs spawn naturally.Whether hostile monsters spawn naturally.Whether pillager patrols spawn naturally.Whether phantoms spawn from insomnia.Whether wandering traders spawn naturally.Whether wardens spawn naturally in ancient cities.Whether monster spawners work and spawn mobs.Whether spectators generate new chunks when moving around.Whether vines spread to adjacent blocks.Whether primed TNT explodes.Whether TNT explosion drops have decay.Whether angered neutral mobs attack any nearby player (universal anger).Whether water source blocks convert to flowing water under certain conditions. -
Method Summary
Modifier and TypeMethodDescription@NotNull Class<?> getType()getValue(@NotNull org.bukkit.World world) Returns the value of this game rule.static @NotNull @Unmodifiable Collection<XGameRule<?>> booleanChecks if this sound is supported in the current Minecraft version.static <T> @NotNull XGameRule<T> of(@NotNull org.bukkit.GameRule<T> bukkit) voidSet a game rule's valueMethods inherited from interface XBase
friendlyName, getMetadata, or
-
Field Details
-
COMMAND_BLOCK_OUTPUT
-
ADVANCE_TIME
-
ENTITY_DROPS
-
MOB_DROPS
-
SPAWN_MOBS
-
BLOCK_DROPS
-
KEEP_INVENTORY
-
LOG_ADMIN_COMMANDS
-
MOB_GRIEFING
-
NATURAL_HEALTH_REGENERATION
-
REDUCED_DEBUG_INFO
-
SEND_COMMAND_FEEDBACK
-
SHOW_DEATH_MESSAGES
-
RANDOM_TICK_SPEED
-
SPECTATORS_GENERATE_CHUNKS
-
ELYTRA_MOVEMENT_CHECK
-
RESPAWN_RADIUS
-
ADVANCE_WEATHER
-
MAX_ENTITY_CRAMMING
-
LIMITED_CRAFTING
-
SHOW_ADVANCEMENT_MESSAGES
-
MAX_COMMAND_SEQUENCE_LENGTH
-
GAME_LOOP_FUNCTION
@XInfo(since="1.12", removedSince="1.13") @Deprecated public static final XGameRule<String> GAME_LOOP_FUNCTIONDeprecated.The function that runs every game tick. -
RAIDS
-
SPAWN_PHANTOMS
-
IMMEDIATE_RESPAWN
-
DROWNING_DAMAGE
-
FALL_DAMAGE
-
FIRE_DAMAGE
-
SPAWN_PATROLS
-
SPAWN_WANDERING_TRADERS
-
FORGIVE_DEAD_PLAYERS
-
UNIVERSAL_ANGER
-
FREEZE_DAMAGE
-
PLAYERS_SLEEPING_PERCENTAGE
-
SPAWN_WARDENS
-
BLOCK_EXPLOSION_DROP_DECAY
-
MOB_EXPLOSION_DROP_DECAY
-
TNT_EXPLOSION_DROP_DECAY
-
WATER_SOURCE_CONVERSION
-
LAVA_SOURCE_CONVERSION
-
GLOBAL_SOUND_EVENTS
-
MAX_SNOW_ACCUMULATION_HEIGHT
-
SPREAD_VINES
-
MAX_BLOCK_MODIFICATIONS
-
ENDER_PEARLS_VANISH_ON_DEATH
-
PROJECTILES_CAN_BREAK_BLOCKS
-
MAX_COMMAND_FORKS
-
PLAYERS_NETHER_PORTAL_DEFAULT_DELAY
-
PLAYERS_NETHER_PORTAL_CREATIVE_DELAY
-
SPAWN_CHUNK_RADIUS
@XInfo(since="1.20.5", removedSince="1.21.9") @Deprecated public static final XGameRule<Integer> SPAWN_CHUNK_RADIUSDeprecated.Radius of spawn chunks that are always loaded. -
PLAYER_MOVEMENT_CHECK
-
MAX_MINECART_SPEED
-
TNT_EXPLODES
-
ALLOW_FIRE_TICKS_AWAY_FROM_PLAYER
@XInfo(since="1.21.5", removedSince="1.21.11") @Deprecated public static final XGameRule<Boolean> ALLOW_FIRE_TICKS_AWAY_FROM_PLAYERDeprecated.Whether fire continues to tick/update when far from players. -
LOCATOR_BAR
-
PVP
-
ALLOW_ENTERING_NETHER_USING_PORTALS
-
SPAWN_MONSTERS
-
COMMAND_BLOCKS_WORK
-
SPAWNER_BLOCKS_WORK
-
FIRE_SPREAD_RADIUS_AROUND_PLAYER
-
DO_FIRE_TICK
@XInfo(since="", removedSince="1.21.11") @Deprecated public static final XGameRule<Boolean> DO_FIRE_TICKDeprecated.Legacy rule: Whether fire spreads and burns blocks. Removed and replaced in 1.21.11 by newer fire rules.- See Also:
-
-
Method Details
-
isSupported
public boolean isSupported()Description copied from interface:XBaseChecks if this sound is supported in the current Minecraft version.An invocation of this method yields exactly the same result as the expression:
XBase.get()!= null- Returns:
- true if the current version has this sound, otherwise false.
-
getType
-
getValue
Returns the value of this game rule.- Parameters:
world- The world from which the value should be fetched- Returns:
- The value of this game rule
- Throws:
UnsupportedOperationException- ifisSupported()isfalse
-
setValue
@Contract(mutates="param1") public void setValue(@NotNull @NotNull org.bukkit.World world, @NotNull T value) Set a game rule's value- Parameters:
world- The world in which this game rule should be updatedvalue- The new value- Throws:
UnsupportedOperationException- IfisSupported()isfalseIllegalArgumentException- Ifvalueparameter is not an instance ofgetType()
-
of
@NotNull @Contract(pure=true) public static <T> @NotNull XGameRule<T> of(@NotNull @NotNull org.bukkit.GameRule<T> bukkit) -
of
-
getValues
@NotNull @Contract(pure=true) public static @NotNull @Unmodifiable Collection<XGameRule<?>> getValues()
-