From 1af83da7605ee0897c8235caa0f402449e7cd6a5 Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Wed, 5 Dec 2012 13:36:47 -0600 Subject: Don't run command blocks in empty worlds. Fixes BUKKIT-3094 --- src/main/java/net/minecraft/server/TileEntityCommand.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/main/java/net') diff --git a/src/main/java/net/minecraft/server/TileEntityCommand.java b/src/main/java/net/minecraft/server/TileEntityCommand.java index 82b189bc..357c5836 100644 --- a/src/main/java/net/minecraft/server/TileEntityCommand.java +++ b/src/main/java/net/minecraft/server/TileEntityCommand.java @@ -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 -- cgit v1.2.3