Paper/Spigot-Server-Patches/0578-Fix-Not-a-string-Map-Conversion-spam.patch
Riley Park 4e958e229f
We're going on an Adventure! (#4842)
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
2021-02-21 20:45:33 +01:00

44 lines
2.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java
index 7251793423e5413dacc1e031ed75d41fc35cd32e..f24741ab831b620c3b3d306596a58fda7abea0d3 100644
--- a/src/main/java/net/minecraft/server/WorldMap.java
+++ b/src/main/java/net/minecraft/server/WorldMap.java
@@ -74,7 +74,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("minecaft:" + 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();