Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
eb71c5fa3b
Move oversleep and all task execution back into the timed area...
40 Zeilen
2.2 KiB
Diff
40 Zeilen
2.2 KiB
Diff
From 9feee69060416cf7b59158ec4323bc80e2b2f4eb 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 f82be54cc..54b4172e6 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -68,6 +68,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");
|
|
private static final CompletableFuture<Unit> i = CompletableFuture.completedFuture(Unit.INSTANCE);
|
|
@@ -178,6 +179,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");
|
|
this.ae = new ResourceManager(EnumResourcePackType.SERVER_DATA, this.serverThread);
|
|
+ SERVER = this; // Paper - better singleton
|
|
this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new);
|
|
this.craftingManager = new CraftingManager();
|
|
this.tagRegistry = new TagRegistry();
|
|
@@ -2184,7 +2186,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.26.0
|
|
|