Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/Spigot-Server-Patches/0389-don-t-NPE-on-dimensionmanager-toString.patch

39 Zeilen
2.0 KiB
Diff

2019-05-06 21:30:27 +02:00
From bd56fb5c4a5eee6d61c68e569a6f758cb48bad78 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Mon, 22 Apr 2019 19:51:14 +0100
Subject: [PATCH] don't NPE on dimensionmanager toString
CraftBukkit uses vanillas DimensionManager, but does not actually
register its own dimension types, etc, due to vanilla
This causes issues because anything, e.g. command feedback, trying
to print information about the world will often attempt to print out
the dimension name, which ends up throwing an NPE due to the lack of
a registered type, we work around this by just returning the world name,
this is not super elegant, but is the only route that promises not to
break stuff.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2019-05-06 21:30:27 +02:00
index 982dce4800..d18a530a4d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2019-05-06 05:53:47 +02:00
@@ -997,7 +997,14 @@ public final class CraftServer implements Server {
2019-05-06 04:58:04 +02:00
}
2019-05-05 19:19:34 +02:00
DimensionManager actualDimension = DimensionManager.a(creator.environment().getId());
- DimensionManager internalDimension = new DimensionManager(dimension, name, name, (w, manager) -> actualDimension.getWorldProvider(w), actualDimension.hasSkyLight());
+ // Paper start - override toString
2019-05-05 19:19:34 +02:00
+ DimensionManager internalDimension = new DimensionManager(dimension, name, name, (w, manager) -> actualDimension.getWorldProvider(w), actualDimension.hasSkyLight()) {
+ @Override
+ public String toString() {
+ return name;
+ }
+ };
+ // Paper end
2019-05-05 19:19:34 +02:00
WorldServer internal = (WorldServer) new WorldServer(console, console.executorService, sdm, worlddata, internalDimension, console.getMethodProfiler(), getServer().worldLoadListenerFactory.create(11), creator.environment(), generator);
if (!(worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) {
--
2.21.0