3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 04:20:08 +01:00
Paper/nms-patches/ItemWrittenBook.patch

35 Zeilen
1.7 KiB
Diff

--- a/net/minecraft/server/ItemWrittenBook.java
+++ b/net/minecraft/server/ItemWrittenBook.java
2018-07-15 02:00:00 +02:00
@@ -62,6 +62,23 @@
2018-07-15 02:00:00 +02:00
Object object;
2018-07-15 02:00:00 +02:00
+ // 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;
+ }
2018-07-15 02:00:00 +02:00
+ server.worldServer[pos] = world;
+ }
+ // CraftBukkit end
try {
IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.b(s);
2018-07-15 02:00:00 +02:00
@@ -69,6 +86,7 @@
} catch (Exception exception) {
object = new ChatComponentText(s);
}
2018-07-15 02:00:00 +02:00
+ finally { MinecraftServer.getServer().worldServer = prev; } // CraftBukkit
nbttaglist.set(i, (NBTBase) (new NBTTagString(IChatBaseComponent.ChatSerializer.a((IChatBaseComponent) object))));
}