From 0f7498850794986ad7a04b20636469f81c9f63ba Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Tue, 19 Dec 2023 13:31:49 -0800 Subject: [PATCH] properly read and store sus effect duration (#10050) --- ...y-read-and-store-sus-effect-duration.patch | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 patches/server/properly-read-and-store-sus-effect-duration.patch diff --git a/patches/server/properly-read-and-store-sus-effect-duration.patch b/patches/server/properly-read-and-store-sus-effect-duration.patch new file mode 100644 index 0000000000..9d7cea9e93 --- /dev/null +++ b/patches/server/properly-read-and-store-sus-effect-duration.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Mon, 18 Dec 2023 20:05:50 -0800 +Subject: [PATCH] properly read and store sus effect duration + + +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java +@@ -0,0 +0,0 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious + if (type == null) { + continue; + } +- int duration = effect.getInt(CraftMetaSuspiciousStew.DURATION.NBT); ++ // Paper start - default duration is 160 ++ final int duration; ++ if (effect.contains(CraftMetaSuspiciousStew.DURATION.NBT)) { ++ duration = effect.getInt(CraftMetaSuspiciousStew.DURATION.NBT); ++ } else { ++ duration = net.minecraft.world.item.SuspiciousStewItem.DEFAULT_DURATION; ++ } ++ // Paper end start - default duration is 160 + this.customEffects.add(new PotionEffect(type, duration, 0)); + } + } +@@ -0,0 +0,0 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious + for (PotionEffect effect : this.customEffects) { + CompoundTag effectData = new CompoundTag(); + effectData.putString(CraftMetaSuspiciousStew.ID.NBT, effect.getType().getKey().toString()); +- effectData.putInt(CraftMetaSuspiciousStew.DURATION.NBT, effect.getDuration()); ++ if (effect.getDuration() != net.minecraft.world.item.SuspiciousStewItem.DEFAULT_DURATION) effectData.putInt(CraftMetaSuspiciousStew.DURATION.NBT, effect.getDuration()); // Paper - don't save duration if it's the default value + effectList.add(effectData); + } + }