summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKane York <rikingcoding@gmail.com>2013-08-10 10:37:35 -0700
committerTravis Ralston <travpc@gmail.com>2013-08-21 00:08:50 -0600
commit94daac860a0a1314652df34567e6c80c5127ef9f (patch)
tree43aacbc5b62fa2a760b58b78c5de16e9d79d9635 /src
parented364a7ef7c093ed26e41f9695a23d20778160af (diff)
downloadbukkit-94daac860a0a1314652df34567e6c80c5127ef9f.tar
bukkit-94daac860a0a1314652df34567e6c80c5127ef9f.tar.gz
bukkit-94daac860a0a1314652df34567e6c80c5127ef9f.tar.lz
bukkit-94daac860a0a1314652df34567e6c80c5127ef9f.tar.xz
bukkit-94daac860a0a1314652df34567e6c80c5127ef9f.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/command/defaults/GameRuleCommand.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/command/defaults/GameRuleCommand.java b/src/main/java/org/bukkit/command/defaults/GameRuleCommand.java
index e1de4afc..40c531b4 100644
--- a/src/main/java/org/bukkit/command/defaults/GameRuleCommand.java
+++ b/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);