2019-05-14 23:54:32 +02:00
|
|
|
From 31bc897990cb6ff4b075db19b5d0ea01c1fff72c Mon Sep 17 00:00:00 2001
|
2019-04-22 21:20:22 +02:00
|
|
|
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-14 23:54:32 +02:00
|
|
|
index 050bf3eb48..56e8a613e9 100644
|
2019-04-22 21:20:22 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2019-05-14 04:20:58 +02:00
|
|
|
@@ -997,7 +997,12 @@ public final class CraftServer implements Server {
|
2019-05-06 04:58:04 +02:00
|
|
|
}
|
2019-04-22 21:20:22 +02:00
|
|
|
|
2019-05-05 19:19:34 +02:00
|
|
|
DimensionManager actualDimension = DimensionManager.a(creator.environment().getId());
|
2019-05-14 04:20:58 +02:00
|
|
|
- DimensionManager internalDimension = DimensionManager.register(name, new DimensionManager(dimension, actualDimension.getSuffix(), actualDimension.folder, (w, manager) -> actualDimension.providerFactory.apply(w, manager), actualDimension.hasSkyLight(), actualDimension));
|
|
|
|
+ DimensionManager internalDimension = DimensionManager.register(name, new DimensionManager(dimension, actualDimension.getSuffix(), actualDimension.folder, (w, manager) -> actualDimension.providerFactory.apply(w, manager), actualDimension.hasSkyLight(), actualDimension) {
|
2019-04-22 21:20:22 +02:00
|
|
|
+ @Override
|
|
|
|
+ public String toString() {
|
|
|
|
+ return name;
|
|
|
|
+ }
|
2019-05-14 04:20:58 +02:00
|
|
|
+ });
|
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);
|
2019-04-22 21:20:22 +02:00
|
|
|
|
|
|
|
if (!(worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) {
|
|
|
|
--
|
|
|
|
2.21.0
|
|
|
|
|