mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-15 07:01:36 +08:00
05466e3b47
Upstream has released updates that appear to apply compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing. Bukkit Changes: d2834556 SPIGOT-4219: Event for PigZombies angering. CraftBukkit Changes:a9c796f1
SPIGOT-4184: Fix furnaces not matching Vanilla smelt or animations195f071e
SPIGOT-4219: Event for PigZombies angering.5e3082c7
SPIGOT-4230: Improve legacy block types
41 lines
2.0 KiB
Diff
41 lines
2.0 KiB
Diff
From f45a5c9addc227e73e61f4afd6fe88ff3bf4f92c 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 67c60be6f7..b41e7badff 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -68,6 +68,7 @@ import co.aikar.timings.MinecraftTimings; // Paper
|
|
|
|
public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStatistics, ICommandListener, Runnable {
|
|
|
|
+ private static MinecraftServer SERVER; // Paper
|
|
public static final Logger LOGGER = LogManager.getLogger();
|
|
public static final File a = new File("usercache.json");
|
|
public Convertable convertable;
|
|
@@ -154,6 +155,8 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
|
// Spigot end
|
|
|
|
public MinecraftServer(OptionSet options, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) {
|
|
+ SERVER = this; // Paper - better singleton
|
|
+ this.commandDispatcher = commanddispatcher; // CraftBukkit
|
|
this.ac = new ResourceManager(EnumResourcePackType.SERVER_DATA);
|
|
this.resourcePackRepository = new ResourcePackRepository(ResourcePackLoader::new);
|
|
this.ag = new CraftingManager();
|
|
@@ -1811,7 +1814,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
|
// CraftBukkit start
|
|
@Deprecated
|
|
public static MinecraftServer getServer() {
|
|
- return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null;
|
|
+ return SERVER;
|
|
}
|
|
// CraftBukkit end
|
|
}
|
|
--
|
|
2.18.0
|
|
|