diff options
author | md_5 <git@md-5.net> | 2018-03-29 20:34:46 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-03-29 20:34:46 +1100 |
commit | 2e210288dea12e3d3fa2d41111bb22e256973c89 (patch) | |
tree | 91d127d44661cf4130a0c2ba656b89f110ae5bba | |
parent | 9f49ad60e7650d6e0b5ba11a6b9d465e64c1acc5 (diff) | |
download | craftbukkit-2e210288dea12e3d3fa2d41111bb22e256973c89.tar craftbukkit-2e210288dea12e3d3fa2d41111bb22e256973c89.tar.gz craftbukkit-2e210288dea12e3d3fa2d41111bb22e256973c89.tar.lz craftbukkit-2e210288dea12e3d3fa2d41111bb22e256973c89.tar.xz craftbukkit-2e210288dea12e3d3fa2d41111bb22e256973c89.zip |
SPIGOT-3875: Book selectors not resolving
-rw-r--r-- | nms-patches/ItemWrittenBook.patch | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/nms-patches/ItemWrittenBook.patch b/nms-patches/ItemWrittenBook.patch new file mode 100644 index 00000000..3a4e4761 --- /dev/null +++ b/nms-patches/ItemWrittenBook.patch @@ -0,0 +1,34 @@ +--- a/net/minecraft/server/ItemWrittenBook.java ++++ b/net/minecraft/server/ItemWrittenBook.java +@@ -61,6 +61,23 @@ + + Object object; + ++ // CraftBukkit start ++ // Some commands use the worldserver variable but we leave it full of null values, ++ // so we must temporarily populate it with the world of the commandsender ++ WorldServer[] prev = MinecraftServer.getServer().worldServer; ++ MinecraftServer server = MinecraftServer.getServer(); ++ server.worldServer = new WorldServer[server.worlds.size()]; ++ server.worldServer[0] = (WorldServer) entityhuman.getWorld(); ++ int bpos = 0; ++ for (int pos = 1; pos < server.worldServer.length; pos++) { ++ WorldServer world = server.worlds.get(bpos++); ++ if (server.worldServer[0] == world) { ++ pos--; ++ continue; ++ } ++ server.worldServer[pos] = world; ++ } ++ // CraftBukkit end + try { + IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.b(s); + +@@ -68,6 +85,7 @@ + } catch (Exception exception) { + object = new ChatComponentText(s); + } ++ finally { MinecraftServer.getServer().worldServer = prev; } // CraftBukkit + + nbttaglist.a(i, new NBTTagString(IChatBaseComponent.ChatSerializer.a((IChatBaseComponent) object))); + } |