Paper/Spigot-Server-Patches/0109-remove-null-possibility-for-getServer-singleton.patch
Shane Freeder f4e3b4e439
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
5b680f0b Note maximum objective score length in documentation

CraftBukkit Changes:
5932f8a7 Load default world spawn areas in consistent order
3a5dc78f Fix confusing migration message appearing on fresh server
516a408f Remove redundant CraftBukkit change for secondary world data
73a2c749 Process conversation input on the main thread.
100c3f07 Cap Objective Score Length
6e842759 Cross World Entity Teleportation
7deba1c6 Check for blank OfflinePlayer Names
f2746a5e Descriptive kick reasons instead of Nope!
b0212308 Cap Channel Registrations
a610dcd8 Identify CraftScheduler threads with useful names

Spigot Changes:
19c3c5a5 Rebuild patches
2019-01-06 17:15:21 +00:00

41 lines
2.0 KiB
Diff

From 90af54dc5fdbc87a6926de923a351e5d2bb8d48c 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 6841fc2bd..d54a112e5 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;
@@ -157,6 +158,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();
@@ -1824,7 +1827,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.20.1