From b7f7c3ffb575725127f0cac602357fa7d81b1e4a Mon Sep 17 00:00:00 2001 From: Dinnerbone Date: Mon, 3 Jan 2011 19:41:23 +0000 Subject: [PATCH] Fixed NPE on Player related methods in CraftServer --- .../java/net/minecraft/server/MinecraftServer.java | 2 -- .../minecraft/server/ServerConfigurationManager.java | 1 + .../java/org/bukkit/craftbukkit/CraftServer.java | 12 +++++------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 90553cdb19..333e00900f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -90,8 +90,6 @@ implements ICommandListener, Runnable { a.warning("To change this, set \"online-mode\" to \"true\" in the server.settings file."); } - server = new CraftServer(this, "1.1"); // CraftBukkit - f = new ServerConfigurationManager(this); k = new EntityTracker(this); String s1 = d.a("level-name", "world"); diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index e16504711e..26cff10b2d 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -28,6 +28,7 @@ public class ServerConfigurationManager { private CraftServer server; // Craftbukkit public ServerConfigurationManager(MinecraftServer minecraftserver) { + minecraftserver.server = new CraftServer(minecraftserver, this); // CraftBukkit server = minecraftserver.server; // Craftbukkit b = new ArrayList(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 811b31435e..e575805136 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -15,17 +15,15 @@ import org.bukkit.plugin.java.JavaPluginLoader; public final class CraftServer implements Server { private final String serverName = "Craftbukkit"; - private final String serverVersion; + private final String serverVersion = "1.1"; private final PluginManager pluginManager = new SimplePluginManager(this); protected final MinecraftServer console; protected final ServerConfigurationManager server; - public CraftServer(MinecraftServer instance, String ver) { - serverVersion = ver; - - console = instance; - server = console.f; + public CraftServer(MinecraftServer console, ServerConfigurationManager server) { + this.console = console; + this.server = server; pluginManager.RegisterInterface(JavaPluginLoader.class); @@ -55,7 +53,7 @@ public final class CraftServer implements Server { } public Player[] getOnlinePlayers() { - List online = server.b; + List online = server.b; Player[] players = new Player[online.size()]; for (int i = 0; i < players.length; i++) {