13
0
geforkt von Mirrors/Paper

Fix conversion for deserializing raw nbt itemstacks - Fixes #3424

Dieser Commit ist enthalten in:
Aikar 2020-05-22 01:08:18 -04:00
Ursprung 4d38ee111f
Commit 83fadad7da
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 401ADFC9891FAAFE

Datei anzeigen

@ -50,7 +50,7 @@ index 2322c0c8c5aacebb6317eab8ce4245554f6d9d55..3e6f878cdbbf5ebfa7fb390745ead135
DataOutputStream dataoutputstream = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(outputstream)));
Throwable throwable = null;
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 770375ed4207920e71d2d0799c611c4b3cdbe6f7..549ba4d8068763f41c2307a9c88f0b3f304b17e9 100644
index 770375ed4207920e71d2d0799c611c4b3cdbe6f7..b58f2ef5ce5f3047bf8fcfc8d80a4aa9774ff711 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -313,6 +313,46 @@ public final class CraftMagicNumbers implements UnsafeValues {
@ -90,7 +90,7 @@ index 770375ed4207920e71d2d0799c611c4b3cdbe6f7..549ba4d8068763f41c2307a9c88f0b3f
+ int dataVersion = compound.getInt("DataVersion");
+
+ Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!");
+ Dynamic<NBTBase> converted = DataConverterRegistry.getDataFixer().update(DataConverterTypes.ITEM_STACK, new Dynamic<NBTBase>(DynamicOpsNBT.a, compound), -1, getDataVersion());
+ Dynamic<NBTBase> converted = DataConverterRegistry.getDataFixer().update(DataConverterTypes.ITEM_STACK, new Dynamic<NBTBase>(DynamicOpsNBT.a, compound), dataVersion, getDataVersion());
+ return CraftItemStack.asCraftMirror(net.minecraft.server.ItemStack.fromCompound((NBTTagCompound) converted.getValue()));
+ } catch (IOException ex) {
+ com.destroystokyo.paper.util.SneakyThrow.sneaky(ex);