2019-01-06 18:15:21 +01:00
|
|
|
From 90af54dc5fdbc87a6926de923a351e5d2bb8d48c 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
|
2019-01-06 18:15:21 +01:00
|
|
|
index 6841fc2bd..d54a112e5 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
|
2019-01-01 04:15:55 +01:00
|
|
|
@@ -68,6 +68,7 @@ import co.aikar.timings.MinecraftTimings; // Paper
|
2016-04-30 02:04:12 +02:00
|
|
|
|
2018-07-16 17:34:55 +02:00
|
|
|
public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStatistics, ICommandListener, Runnable {
|
2016-04-30 02:04:12 +02:00
|
|
|
|
|
|
|
+ private static MinecraftServer SERVER; // Paper
|
|
|
|
public static final Logger LOGGER = LogManager.getLogger();
|
|
|
|
public static final File a = new File("usercache.json");
|
|
|
|
public Convertable convertable;
|
2019-01-01 04:15:55 +01:00
|
|
|
@@ -157,6 +158,8 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
2017-01-31 05:33:54 +01:00
|
|
|
// Spigot end
|
2016-04-30 02:04:12 +02:00
|
|
|
|
2018-07-16 17:34:55 +02:00
|
|
|
public MinecraftServer(OptionSet options, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) {
|
2016-04-30 02:04:12 +02:00
|
|
|
+ SERVER = this; // Paper - better singleton
|
2018-07-21 22:03:10 +02:00
|
|
|
+ this.commandDispatcher = commanddispatcher; // CraftBukkit
|
2018-07-16 17:34:55 +02:00
|
|
|
this.ac = new ResourceManager(EnumResourcePackType.SERVER_DATA);
|
2019-01-01 04:15:55 +01:00
|
|
|
this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new);
|
2018-07-21 22:03:10 +02:00
|
|
|
this.ag = new CraftingManager();
|
2019-01-06 18:15:21 +01:00
|
|
|
@@ -1824,7 +1827,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
2016-04-30 02:04:12 +02:00
|
|
|
// CraftBukkit start
|
|
|
|
@Deprecated
|
|
|
|
public static MinecraftServer getServer() {
|
|
|
|
- return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null;
|
|
|
|
+ return SERVER;
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2016-06-10 04:43:32 +02:00
|
|
|
}
|
2016-04-30 02:04:12 +02:00
|
|
|
--
|
2019-01-01 04:15:55 +01:00
|
|
|
2.20.1
|
2016-04-30 02:04:12 +02:00
|
|
|
|