PaperMC/Spigot-Server-Patches/0440-don-t-NPE-on-dimensionmanager-toString.patch
Shane Freeder fb25dc17c6 Updated Upstream (Bukkit/CraftBukkit)
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:
da08d022 SPIGOT-4700: Add PlayerFishEvent.State.REEL_IN
0cef14e4 Remove draft API from selectEntities

CraftBukkit Changes:
a46fdbc6 Remove outdated build delay.
3697519b SPIGOT-4708: Fix ExactChoice recipes neglecting material
9ead7009 SPIGOT-4677: Add minecraft.admin.command_feedback permission
c3749a23 Remove the Damage tag from items when it is 0.
f74c7b95 SPIGOT-4706: Can't interact with active item
494eef45 Mention requirement of JIRA ticket for bug fixes
51d62dec SPIGOT-4702: Exception when middle clicking certain slots
be557e69 SPIGOT-4700: Add PlayerFishEvent.State.REEL_IN
2019-04-22 22:36:14 +01:00

38 lines
2 KiB
Diff

From 77a1e11685c6e91533e16f35ae3f0fe4fefbffc1 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
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