diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java index 012205d07d..91b9efd865 100644 --- a/src/main/java/net/minecraft/server/BlockSapling.java +++ b/src/main/java/net/minecraft/server/BlockSapling.java @@ -81,6 +81,10 @@ public class BlockSapling extends BlockFlower { public int getTypeId(int x, int y, int z) { return this.world.getTypeId(x, y, z); } + + public int getHeight() { + return world.height; + } } // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index cff20b5983..58e03167fb 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -19,9 +19,9 @@ import java.net.UnknownHostException; import jline.ConsoleReader; import joptsimple.OptionSet; import org.bukkit.World.Environment; +import org.bukkit.command.ConsoleCommandSender; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.LoggerOutputStream; -import org.bukkit.craftbukkit.command.ColouredConsoleSender; import org.bukkit.craftbukkit.scheduler.CraftScheduler; import org.bukkit.craftbukkit.util.ServerShutdownThread; import org.bukkit.event.server.ServerCommandEvent; @@ -59,7 +59,7 @@ public class MinecraftServer implements Runnable, ICommandListener { public List worlds = new ArrayList(); public CraftServer server; public OptionSet options; - public ColouredConsoleSender console; + public ConsoleCommandSender console; public ConsoleReader reader; public static int currentTick; // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index 16c85b314d..016c302577 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -50,7 +50,7 @@ public class ServerConfigurationManager { public ServerConfigurationManager(MinecraftServer minecraftserver) { minecraftserver.server = new CraftServer(minecraftserver, this); - minecraftserver.console = new ColouredConsoleSender(minecraftserver.server); + minecraftserver.console = ColouredConsoleSender.getInstance(); this.cserver = minecraftserver.server; // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index c077d03d31..fcc3fd8212 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -32,6 +32,10 @@ public class WorldServer extends World implements BlockChangeDelegate { this.manager = new PlayerManager(minecraftserver, this.dimension, minecraftserver.propertyManager.getInt("view-distance", 10)); } + public int getHeight() { + return height; + } + public final int dimension; public EntityTracker tracker; public PlayerManager manager; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 9129b58e6f..482405c9af 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -839,4 +839,8 @@ public final class CraftServer implements Server { ((CraftWorld)world).getHandle().worldData.setGameType(mode.getValue()); } } + + public ConsoleCommandSender getConsoleSender() { + return console.console; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java index 4dabe6f03f..28f252e11a 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java @@ -5,6 +5,7 @@ import java.util.Map; import jline.ANSIBuffer.ANSICodes; import jline.ConsoleReader; import jline.Terminal; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.craftbukkit.CraftServer; @@ -15,7 +16,7 @@ public class ColouredConsoleSender extends ConsoleCommandSender { private final Map replacements = new EnumMap(ChatColor.class); private final ChatColor[] colors = ChatColor.values(); - public ColouredConsoleSender(CraftServer server) { + protected ColouredConsoleSender(CraftServer server) { super(server); this.reader = server.getReader(); this.terminal = reader.getTerminal(); @@ -55,4 +56,12 @@ public class ColouredConsoleSender extends ConsoleCommandSender { super.sendMessage(message); } } + + public static ConsoleCommandSender getInstance() { + if (Bukkit.getConsoleSender() != null) { + return Bukkit.getConsoleSender(); + } else { + return new ColouredConsoleSender((CraftServer)Bukkit.getServer()); + } + } }