13
0
geforkt von Mirrors/Paper

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.

Track spigot issue to see when fixed: https://hub.spigotmc.org/jira/browse/SPIGOT-6181
Dieser Commit ist enthalten in:
Aikar 2020-10-08 00:00:25 -04:00
Ursprung 870ed90a9a
Commit 397d058748

Datei anzeigen

@ -43,12 +43,31 @@
}
public static MapItemSavedData createFresh(double centerX, double centerZ, byte scale, boolean showDecorations, boolean unlimitedTracking, ResourceKey<Level> dimension) {
@@ -101,12 +123,30 @@
@@ -101,12 +123,49 @@
}
public static MapItemSavedData load(CompoundTag nbt, HolderLookup.Provider registries) {
- DataResult dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, nbt.get("dimension")));
+ DataResult<ResourceKey<Level>> dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, nbt.get("dimension"))); // CraftBukkit - decompile error
+ // Paper start - fix "Not a string" spam
+ Tag dimension = nbt.get("dimension");
+ if (dimension instanceof final net.minecraft.nbt.NumericTag numericTag && numericTag.getAsInt() >= CraftWorld.CUSTOM_DIMENSION_OFFSET) {
+ long least = nbt.getLong("UUIDLeast");
+ long most = nbt.getLong("UUIDMost");
+
+ if (least != 0L && most != 0L) {
+ UUID uuid = new UUID(most, least);
+ CraftWorld world = (CraftWorld) Bukkit.getWorld(uuid);
+ if (world != null) {
+ dimension = net.minecraft.nbt.StringTag.valueOf("minecraft:" + world.getName().toLowerCase(java.util.Locale.ENGLISH));
+ } else {
+ dimension = net.minecraft.nbt.StringTag.valueOf("bukkit:_invalidworld_");
+ }
+ } else {
+ dimension = net.minecraft.nbt.StringTag.valueOf("bukkit:_invalidworld_");
+ }
+ }
+ DataResult<ResourceKey<Level>> dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, dimension)); // CraftBukkit - decompile error
+ // Paper end - fix "Not a string" spam
Logger logger = MapItemSavedData.LOGGER;
Objects.requireNonNull(logger);
@ -77,7 +96,7 @@
});
int i = nbt.getInt("xCenter");
int j = nbt.getInt("zCenter");
@@ -131,7 +171,8 @@
@@ -131,7 +190,8 @@
MapBanner mapiconbanner = (MapBanner) iterator.next();
worldmap.bannerMarkers.put(mapiconbanner.getId(), mapiconbanner);
@ -87,7 +106,7 @@
}
ListTag nbttaglist = nbt.getList("frames", 10);
@@ -150,13 +191,32 @@
@@ -150,13 +210,32 @@
@Override
public CompoundTag save(CompoundTag nbt, HolderLookup.Provider registries) {
@ -121,7 +140,7 @@
nbt.putInt("xCenter", this.centerX);
nbt.putInt("zCenter", this.centerZ);
nbt.putByte("scale", this.scale);
@@ -443,7 +503,7 @@
@@ -443,7 +522,7 @@
if (!this.isTrackedCountOverLimit(256)) {
this.bannerMarkers.put(mapiconbanner.getId(), mapiconbanner);
@ -130,7 +149,7 @@
return true;
}
}
@@ -554,7 +614,7 @@
@@ -554,7 +633,7 @@
this.player = entityhuman;
}
@ -139,7 +158,7 @@
int i = this.minDirtyX;
int j = this.minDirtyY;
int k = this.maxDirtyX + 1 - this.minDirtyX;
@@ -563,7 +623,7 @@
@@ -563,7 +642,7 @@
for (int i1 = 0; i1 < k; ++i1) {
for (int j1 = 0; j1 < l; ++j1) {
@ -148,7 +167,7 @@
}
}
@@ -573,19 +633,29 @@
@@ -573,19 +652,29 @@
@Nullable
Packet<?> nextUpdatePacket(MapId mapId) {
MapItemSavedData.MapPatch worldmap_c;