Don't run command blocks in empty worlds. Fixes BUKKIT-3094

This commit is contained in:
Travis Watkins 2012-12-05 13:36:47 -06:00
parent 09684ba9d7
commit 1af83da760

View File

@ -25,7 +25,7 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
MinecraftServer minecraftserver = MinecraftServer.getServer();
if (minecraftserver != null && minecraftserver.getEnableCommandBlock()) {
// CraftBukkit start - handle command block as console TODO: add new CommandSender for this
// CraftBukkit start - handle command block as console
org.bukkit.command.SimpleCommandMap commandMap = minecraftserver.server.getCommandMap();
Joiner joiner = Joiner.on(" ");
String command = this.a;
@ -47,6 +47,11 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
return;
}
// if the world has no players don't run
if (this.world.players.isEmpty()) {
return;
}
commands.add(args);
// find positions of command block syntax, if any