From 4389f8eaaf51ae78a8f4920fda7eecd2fbb99303 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sat, 10 Aug 2013 10:37:35 -0700 Subject: [PATCH] Use command block's world for /gamerule. Fixes BUKKIT-3274 In vanilla, gamerules are global, across all worlds. Maps created for vanilla that use command blocks expect this behavior, which is broken when they are placed on a world that is not the default world (world #0). This commit changes that by using the command block's current world when executing the command, forcing the game rules executed to be executed in the world the command block is currently in. By: Kane York --- .../main/java/org/bukkit/command/defaults/GameRuleCommand.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/command/defaults/GameRuleCommand.java b/paper-api/src/main/java/org/bukkit/command/defaults/GameRuleCommand.java index e1de4afc49..40c531b447 100644 --- a/paper-api/src/main/java/org/bukkit/command/defaults/GameRuleCommand.java +++ b/paper-api/src/main/java/org/bukkit/command/defaults/GameRuleCommand.java @@ -3,6 +3,7 @@ package org.bukkit.command.defaults; import com.google.common.collect.ImmutableList; import org.apache.commons.lang.Validate; import org.bukkit.ChatColor; +import org.bukkit.command.BlockCommandSender; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.util.StringUtil; @@ -61,6 +62,8 @@ public class GameRuleCommand extends VanillaCommand { if (world != null) { return world; } + } else if (sender instanceof BlockCommandSender) { + return ((BlockCommandSender) sender).getBlock().getWorld(); } return Bukkit.getWorlds().get(0);