diff options
Diffstat (limited to 'Spigot-Server-Patches/0124-remove-null-possibility-for-getServer-singleton.patch')
-rw-r--r-- | Spigot-Server-Patches/0124-remove-null-possibility-for-getServer-singleton.patch | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0124-remove-null-possibility-for-getServer-singleton.patch b/Spigot-Server-Patches/0124-remove-null-possibility-for-getServer-singleton.patch new file mode 100644 index 0000000000..598e8fc384 --- /dev/null +++ b/Spigot-Server-Patches/0124-remove-null-possibility-for-getServer-singleton.patch @@ -0,0 +1,39 @@ +From 0beac52797d106b00aae3d72abf1377f736dbff9 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +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 430168d21..83b62da55 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -52,6 +52,7 @@ import co.aikar.timings.MinecraftTimings; // Paper + + public abstract class MinecraftServer implements Runnable, ICommandListener, IAsyncTaskHandler, IMojangStatistics { + ++ private static MinecraftServer SERVER; // Paper + public static final Logger LOGGER = LogManager.getLogger(); + public static final File a = new File("usercache.json"); + public Convertable convertable; +@@ -123,6 +124,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + // Spigot end + + public MinecraftServer(OptionSet options, Proxy proxy, DataConverterManager dataconvertermanager, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) { ++ SERVER = this; // Paper - better singleton + io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable + this.e = proxy; + this.V = yggdrasilauthenticationservice; +@@ -1634,7 +1636,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + // CraftBukkit start + @Deprecated + public static MinecraftServer getServer() { +- return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null; ++ return SERVER; + } + // CraftBukkit end + } +-- +2.12.2 + |