mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-07 11:20:01 +01:00
d26051ef63
Fixes GH-383
40 lines
1.9 KiB
Diff
40 lines
1.9 KiB
Diff
From 4acc11dbab4d03e506392d6457501c23d5c11b81 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 544d601..4f7269b 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -49,6 +49,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;
|
|
@@ -116,6 +117,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
|
// 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;
|
|
@@ -1610,7 +1612,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.10.0.windows.1
|
|
|