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.
This commit is contained in:
parent
ed364a7ef7
commit
94daac860a
@ -3,6 +3,7 @@ package org.bukkit.command.defaults;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.BlockCommandSender;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.util.StringUtil;
|
import org.bukkit.util.StringUtil;
|
||||||
@ -61,6 +62,8 @@ public class GameRuleCommand extends VanillaCommand {
|
|||||||
if (world != null) {
|
if (world != null) {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
} else if (sender instanceof BlockCommandSender) {
|
||||||
|
return ((BlockCommandSender) sender).getBlock().getWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Bukkit.getWorlds().get(0);
|
return Bukkit.getWorlds().get(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user