Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
89d51d5f29
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable. It should be noted that this decision does not promise all future exploits will be configurable.
36 Zeilen
2.2 KiB
Diff
36 Zeilen
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
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 e13146b71552ab3f9ae867110650fe3977563dfb..2c3b9f76067088efdc2250cdb5070df86e2dc0f5 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
|
|
@@ -49,7 +49,14 @@ 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));
|
|
}
|
|
}
|
|
@@ -80,7 +87,7 @@ 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);
|
|
}
|
|
}
|