diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-09-24 23:14:13 +0100 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-09-24 23:14:13 +0100 |
commit | 44136f2e7dc2720bbd88234a7e3e4b232d4f500d (patch) | |
tree | b6c2de60d42a69d8b7680e3cf6664c79d474edd1 /src | |
parent | 0118a20d6a4d5637504b26998bfd96c7a65ddbe1 (diff) | |
download | craftbukkit-44136f2e7dc2720bbd88234a7e3e4b232d4f500d.tar craftbukkit-44136f2e7dc2720bbd88234a7e3e4b232d4f500d.tar.gz craftbukkit-44136f2e7dc2720bbd88234a7e3e4b232d4f500d.tar.lz craftbukkit-44136f2e7dc2720bbd88234a7e3e4b232d4f500d.tar.xz craftbukkit-44136f2e7dc2720bbd88234a7e3e4b232d4f500d.zip |
Blocked access to ColouredConsoleSenders constructor, implemented getConsoleSender
Diffstat (limited to 'src')
6 files changed, 25 insertions, 4 deletions
diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java index 012205d0..91b9efd8 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 cff20b59..58e03167 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<WorldServer> worlds = new ArrayList<WorldServer>(); 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 16c85b31..016c3025 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 c077d03d..fcc3fd82 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 9129b58e..482405c9 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 4dabe6f0..28f252e1 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<ChatColor, String> replacements = new EnumMap<ChatColor, String>(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()); + } + } } |