2017-01-31 04:33:54 +00:00
|
|
|
From 08c2f8c625e0849d50e2016a01f0e918f514ce05 Mon Sep 17 00:00:00 2001
|
2016-04-30 00:04:12 +00: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
|
2017-01-31 04:33:54 +00:00
|
|
|
index b9d4d65a6..15e543368 100644
|
2016-04-30 00:04:12 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2017-01-31 04:33:54 +00:00
|
|
|
@@ -52,6 +52,7 @@ import co.aikar.timings.MinecraftTimings; // Paper
|
2016-04-30 00:04:12 +00:00
|
|
|
|
|
|
|
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;
|
2017-01-31 04:33:54 +00:00
|
|
|
@@ -123,6 +124,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
|
|
|
// Spigot end
|
2016-04-30 00:04:12 +00:00
|
|
|
|
|
|
|
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;
|
2016-11-17 02:23:38 +00:00
|
|
|
this.V = yggdrasilauthenticationservice;
|
2017-01-31 04:33:54 +00:00
|
|
|
@@ -1634,7 +1636,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
2016-04-30 00:04:12 +00: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 02:43:32 +00:00
|
|
|
}
|
2016-04-30 00:04:12 +00:00
|
|
|
--
|
2017-01-31 04:33:54 +00:00
|
|
|
2.11.0.windows.3
|
2016-04-30 00:04:12 +00:00
|
|
|
|