2016-09-15 23:36:57 +02:00
|
|
|
From a47d239dfc2f8dcf30bf36ef6d228b20fb8f78b6 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
|
2016-09-15 23:36:57 +02:00
|
|
|
index a5ebb17..6fbe9e6 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
|
2016-07-16 00:36:53 +02:00
|
|
|
@@ -49,6 +49,7 @@ import co.aikar.timings.MinecraftTimings; // Paper
|
2016-04-30 02:04:12 +02: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;
|
2016-07-16 00:36:53 +02:00
|
|
|
@@ -116,6 +117,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
2016-04-30 02:04:12 +02:00
|
|
|
// CraftBukkit 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.U = yggdrasilauthenticationservice;
|
2016-09-15 23:36:57 +02:00
|
|
|
@@ -1605,7 +1607,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
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
|
|
|
--
|
2016-09-11 04:42:47 +02:00
|
|
|
2.10.0.windows.1
|
2016-04-30 02:04:12 +02:00
|
|
|
|