mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-07 19:30:34 +01:00
6048122e23
This patch appears to be causing some issues with 1.14.3 entity AI
40 lines
2.2 KiB
Diff
40 lines
2.2 KiB
Diff
From 961fbdba0788ff2d563f2cdc35159670061a1ab4 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 ccfe1b4c3e..1dda1fee9f 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -59,6 +59,7 @@ import org.spigotmc.SlackActivityAccountant; // Spigot
|
|
|
|
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable, Runnable {
|
|
|
|
+ private static MinecraftServer SERVER; // Paper
|
|
public static final Logger LOGGER = LogManager.getLogger();
|
|
public static final File b = new File("usercache.json");
|
|
public static final WorldSettings c = (new WorldSettings((long) "North Carolina".hashCode(), EnumGamemode.SURVIVAL, true, false, WorldType.NORMAL)).a();
|
|
@@ -164,6 +165,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
|
|
public MinecraftServer(OptionSet options, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory, String s) {
|
|
super("Server");
|
|
+ SERVER = this; // Paper - better singleton
|
|
this.ad = new ResourceManager(EnumResourcePackType.SERVER_DATA, this.serverThread);
|
|
this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new);
|
|
this.ah = new CraftingManager();
|
|
@@ -1911,7 +1913,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
|
|
@Deprecated
|
|
public static MinecraftServer getServer() {
|
|
- return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null;
|
|
+ return SERVER; // Paper
|
|
}
|
|
// CraftBukkit end
|
|
}
|
|
--
|
|
2.22.0
|
|
|