From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 28 Apr 2016 00:57:27 -0400 Subject: [PATCH] remove null possibility for getServer singleton to stop IDE complaining about potential NPE diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index e4b92f63c9ac6f0c2bb52056645c91b86e9d8424..d6bbb462931fd1eb97d39fbbbf4b843aa0f17c2e 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -70,6 +70,7 @@ import org.spigotmc.SlackActivityAccountant; // Spigot public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable { + private static MinecraftServer SERVER; // Paper public static final Logger LOGGER = LogManager.getLogger(); public static final File b = new File("usercache.json"); public static final WorldSettings c = new WorldSettings("Demo World", EnumGamemode.SURVIVAL, false, EnumDifficulty.NORMAL, false, new GameRules(), DataPackConfiguration.a); @@ -176,6 +177,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) { super("Server"); + SERVER = this; // Paper - better singleton this.m = new GameProfilerSwitcher(SystemUtils.a, this::ag); this.methodProfiler = GameProfilerDisabled.a; this.serverPing = new ServerPing(); @@ -2035,7 +2037,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant