[Bleeding] Instantiate logger earlier in CraftServer. Fixes BUKKIT-4253.

Previously, if an error occurred during CraftServer initialization before the
logger was instantiated, it would cause an NPE and the server would never
finish loading properly. By instantiating the logger before attempting to
load anything else in CraftServer, we ensure that a logger will always be
available in the case of any errors.
This commit is contained in:
GJ 2014-01-21 10:47:18 -08:00 committed by Nate Mortensen
parent 19521b7f1c
commit 855b5f8ae3

View File

@ -148,6 +148,7 @@ public final class CraftServer implements Server {
private final String serverName = "CraftBukkit";
private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft");
private final ServicesManager servicesManager = new SimpleServicesManager();
private final CraftScheduler scheduler = new CraftScheduler();
private final SimpleCommandMap commandMap = new SimpleCommandMap(this);
@ -176,7 +177,6 @@ public final class CraftServer implements Server {
public CraftScoreboardManager scoreboardManager;
public boolean playerCommandState;
private boolean printSaveWarning;
private Logger logger;
private CraftIconCache icon;
private final class BooleanWrapper {
@ -189,7 +189,6 @@ public final class CraftServer implements Server {
}
public CraftServer(MinecraftServer console, PlayerList playerList) {
this.logger = Logger.getLogger("Minecraft");
this.console = console;
this.playerList = (DedicatedPlayerList) playerList;
this.serverVersion = CraftServer.class.getPackage().getImplementationVersion();