mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 00:07:56 +01:00
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 <rikingcoding@gmail.com>
This commit is contained in:
parent
c648e5402c
commit
4389f8eaaf
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user