2020-05-06 11:48:49 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2016-04-30 02:04:12 +02:00
From: Aikar <aikar@aikar.co>
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
2020-11-03 03:22:15 +01:00
index 3a16c0387fbd611680ccd2e125aef26f7cb7c9ce..d1fe6c006776b221fe817a06c22c675108f38b2f 100644
2016-04-30 02:04:12 +02:00
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
2020-06-25 16:09:55 +02:00
@@ -70,6 +70,7 @@ import org.spigotmc.SlackActivityAccountant; // Spigot
2016-04-30 02:04:12 +02:00
2020-06-25 13:00:35 +02:00
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable {
2016-04-30 02:04:12 +02:00
+ private static MinecraftServer SERVER; // Paper
public static final Logger LOGGER = LogManager.getLogger();
2019-04-27 05:05:36 +02:00
public static final File b = new File("usercache.json");
2020-06-25 13:00:35 +02:00
public static final WorldSettings c = new WorldSettings("Demo World", EnumGamemode.SURVIVAL, false, EnumDifficulty.NORMAL, false, new GameRules(), DataPackConfiguration.a);
2020-06-26 18:20:03 +02:00
@@ -176,6 +177,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
2020-06-25 13:00:35 +02:00
2020-08-25 04:22:08 +02:00
public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
2019-04-27 05:05:36 +02:00
super("Server");
2016-04-30 02:04:12 +02:00
+ SERVER = this; // Paper - better singleton
2020-11-03 03:22:15 +01:00
this.m = new GameProfilerSwitcher(SystemUtils.a, this::ai);
2020-06-25 13:00:35 +02:00
this.methodProfiler = GameProfilerDisabled.a;
this.serverPing = new ServerPing();
2020-11-03 03:22:15 +01:00
@@ -2042,7 +2044,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
2019-04-27 05:05:36 +02:00
2016-04-30 02:04:12 +02:00
@Deprecated
public static MinecraftServer getServer() {
- return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null;
2019-04-27 05:05:36 +02:00
+ return SERVER; // Paper
2016-04-30 02:04:12 +02:00
}
// CraftBukkit end
2020-06-25 13:00:35 +02:00