aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches-Unmapped/0577-Fix-Not-a-string-Map-Conversion-spam.patch
diff options
context:
space:
mode:
Diffstat (limited to 'Spigot-Server-Patches-Unmapped/0577-Fix-Not-a-string-Map-Conversion-spam.patch')
-rw-r--r--Spigot-Server-Patches-Unmapped/0577-Fix-Not-a-string-Map-Conversion-spam.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/Spigot-Server-Patches-Unmapped/0577-Fix-Not-a-string-Map-Conversion-spam.patch b/Spigot-Server-Patches-Unmapped/0577-Fix-Not-a-string-Map-Conversion-spam.patch
new file mode 100644
index 0000000000..26697d6feb
--- /dev/null
+++ b/Spigot-Server-Patches-Unmapped/0577-Fix-Not-a-string-Map-Conversion-spam.patch
@@ -0,0 +1,54 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Aikar <[email protected]>
+Date: Thu, 8 Oct 2020 00:00:25 -0400
+Subject: [PATCH] Fix "Not a string" Map Conversion spam
+
+The maps did convert successfully, but had noisy logs due to Spigot
+implementing this logic incorrectly.
+
+This stops the spam by converting the old format to new before
+requesting the world.
+
+diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java b/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java
+index d470af1814af332595c1c0beb1cdc552e186a6bb..1f9b710f2af3c5067b3c2b73bebb11f8e22c403e 100644
+--- a/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java
++++ b/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java
+@@ -11,8 +11,10 @@ import javax.annotation.Nullable;
+ import net.minecraft.core.BlockPosition;
+ import net.minecraft.nbt.DynamicOpsNBT;
+ import net.minecraft.nbt.NBTBase;
++import net.minecraft.nbt.NBTNumber;
+ import net.minecraft.nbt.NBTTagCompound;
+ import net.minecraft.nbt.NBTTagList;
++import net.minecraft.nbt.NBTTagString;
+ import net.minecraft.network.chat.IChatBaseComponent;
+ import net.minecraft.network.protocol.Packet;
+ import net.minecraft.network.protocol.game.PacketPlayOutMap;
+@@ -94,7 +96,26 @@ public class WorldMap extends PersistentBase {
+
+ @Override
+ public void a(NBTTagCompound nbttagcompound) {
+- DataResult<ResourceKey<World>> dataresult = DimensionManager.a(new Dynamic(DynamicOpsNBT.a, nbttagcompound.get("dimension"))); // CraftBukkit - decompile error
++ // Paper start - fix "Not a string" spam
++ NBTBase dimension = nbttagcompound.get("dimension");
++ if (dimension instanceof NBTNumber && ((NBTNumber) dimension).asInt() >= CraftWorld.CUSTOM_DIMENSION_OFFSET) {
++ long least = nbttagcompound.getLong("UUIDLeast");
++ long most = nbttagcompound.getLong("UUIDMost");
++
++ if (least != 0L && most != 0L) {
++ this.uniqueId = new UUID(most, least);
++ CraftWorld world = (CraftWorld) server.getWorld(this.uniqueId);
++ if (world != null) {
++ dimension = NBTTagString.create("minecraft:" + world.getName().toLowerCase(java.util.Locale.ENGLISH));
++ } else {
++ dimension = NBTTagString.create("bukkit:_invalidworld_");
++ }
++ } else {
++ dimension = NBTTagString.create("bukkit:_invalidworld_");
++ }
++ }
++ DataResult<ResourceKey<World>> dataresult = DimensionManager.a(new Dynamic(DynamicOpsNBT.a, dimension)); // CraftBukkit - decompile error
++ // Paper end - fix "Not a string" spam
+ Logger logger = WorldMap.LOGGER;
+
+ logger.getClass();