2018-07-04 15:55:24 +08:00
|
|
|
From ce05afd0428918d9eab5599842bc9f2a485120f9 Mon Sep 17 00:00:00 2001
|
2016-04-30 08:04:12 +08: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
|
2018-01-18 14:00:51 +08:00
|
|
|
index b6c4d98fd..45d3dbde2 100644
|
2016-04-30 08:04:12 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2017-08-03 22:36:06 +08:00
|
|
|
@@ -53,6 +53,7 @@ import co.aikar.timings.MinecraftTimings; // Paper
|
2016-04-30 08:04:12 +08:00
|
|
|
|
2017-05-15 02:05:01 +08:00
|
|
|
public abstract class MinecraftServer implements ICommandListener, Runnable, IAsyncTaskHandler, IMojangStatistics {
|
2016-04-30 08:04:12 +08: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;
|
2017-08-03 22:36:06 +08:00
|
|
|
@@ -124,6 +125,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
|
2017-01-31 12:33:54 +08:00
|
|
|
// Spigot end
|
2016-04-30 08:04:12 +08: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 10:23:38 +08:00
|
|
|
this.V = yggdrasilauthenticationservice;
|
2017-08-03 22:36:06 +08:00
|
|
|
@@ -1636,7 +1638,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
|
2016-04-30 08:04:12 +08: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 10:43:32 +08:00
|
|
|
}
|
2016-04-30 08:04:12 +08:00
|
|
|
--
|
2018-07-04 15:55:24 +08:00
|
|
|
2.18.0
|
2016-04-30 08:04:12 +08:00
|
|
|
|