mirror of
https://github.com/SparklyPower/SparklyPaper.git
synced 2026-01-06 15:51:42 +00:00
Update to 1.21.1
This commit is contained in:
37
patches/server/0021-Allow-item-version-downgrades.patch
Normal file
37
patches/server/0021-Allow-item-version-downgrades.patch
Normal file
@@ -0,0 +1,37 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrPowerGamerBR <git@mrpowergamerbr.com>
|
||||
Date: Fri, 21 Jun 2024 18:07:25 -0300
|
||||
Subject: [PATCH] Allow item version downgrades
|
||||
|
||||
The server WON'T convert the item data from a newer version to an older version, so proceed with caution
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 28dbe30a98a6730839949bc9a6a90b78619ff84d..48e0c6fec6f847ce030ec79655d866be47364c73 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -75,6 +75,7 @@ import org.bukkit.potion.PotionType;
|
||||
public final class CraftMagicNumbers implements UnsafeValues {
|
||||
public static final UnsafeValues INSTANCE = new CraftMagicNumbers();
|
||||
public static final boolean DISABLE_OLD_API_SUPPORT = Boolean.getBoolean("paper.disableOldApiSupport"); // Paper
|
||||
+ private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("sparklypaper.ignoreItemDataVersion"); // SparklyPaper - allow item downgrades
|
||||
|
||||
private CraftMagicNumbers() {}
|
||||
|
||||
@@ -236,7 +237,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@Override
|
||||
public Material getMaterial(String material, int version) {
|
||||
Preconditions.checkArgument(material != null, "material == null");
|
||||
- Preconditions.checkArgument(version <= this.getDataVersion(), "Newer version! Server downgrades are not supported!");
|
||||
+ Preconditions.checkArgument(JUST_CORRUPT_IT || version <= this.getDataVersion(), "Newer version! Server downgrades are not supported!"); // SparklyPaper - allow item downgrades
|
||||
|
||||
// Fastpath up to date materials
|
||||
if (version == this.getDataVersion()) {
|
||||
@@ -559,7 +560,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
int dataVersion = compound.getInt("DataVersion");
|
||||
- Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!");
|
||||
+ Preconditions.checkArgument(JUST_CORRUPT_IT || dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!"); // SparklyPaper - allow item downgrades
|
||||
return compound;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user