diff options
author | Shane Freeder <[email protected]> | 2019-04-22 20:20:22 +0100 |
---|---|---|
committer | Shane Freeder <[email protected]> | 2019-04-22 20:20:22 +0100 |
commit | 10d58504f7d079381d1b0b189a1a8328a8e6ef51 (patch) | |
tree | 1be94b91c8179ca1f7c2bfe7f97f3b7762d8083c | |
parent | faf59c3242c251b74ac4f5fd733c8e45d2a8efc2 (diff) | |
download | Paper-10d58504f7d079381d1b0b189a1a8328a8e6ef51.tar.gz Paper-10d58504f7d079381d1b0b189a1a8328a8e6ef51.zip |
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.
-rw-r--r-- | Spigot-Server-Patches/0441-don-t-NPE-on-dimensionmanager-toString.patch | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0441-don-t-NPE-on-dimensionmanager-toString.patch b/Spigot-Server-Patches/0441-don-t-NPE-on-dimensionmanager-toString.patch new file mode 100644 index 0000000000..86c250352f --- /dev/null +++ b/Spigot-Server-Patches/0441-don-t-NPE-on-dimensionmanager-toString.patch @@ -0,0 +1,38 @@ +From a3806a6b05952622de26ba33ebafd06929523f4c Mon Sep 17 00:00:00 2001 +From: Shane Freeder <[email protected]> +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 +index 9c5b79920f..e5242f9f87 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -999,7 +999,14 @@ public final class CraftServer implements Server { + } + worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end) + +- DimensionManager internalDimension = new DimensionManager(dimension, name, name, () -> DimensionManager.a(creator.environment().getId()).e()); ++ // Paper start - override toString ++ DimensionManager internalDimension = new DimensionManager(dimension, name, name, () -> DimensionManager.a(creator.environment().getId()).e()) { ++ @Override ++ public String toString() { ++ return name; ++ } ++ }; ++ // Paper end + WorldServer internal = (WorldServer) new WorldServer(console, sdm, persistentcollection, worlddata, internalDimension, console.methodProfiler, creator.environment(), generator).i_(); + + if (!(worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) { +-- +2.21.0 + |