diff --git a/patches/api/Fix-upstream-javadocs.patch b/patches/api/Fix-upstream-javadocs.patch index 4cf16da6c1..b920b411ba 100644 --- a/patches/api/Fix-upstream-javadocs.patch +++ b/patches/api/Fix-upstream-javadocs.patch @@ -1548,21 +1548,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 */ void addChargedProjectile(@NotNull ItemStack item); } -diff --git a/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java b/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java -@@ -0,0 +0,0 @@ public interface FireworkMeta extends ItemMeta { - * Sets the approximate power of the firework. Each level of power is half - * a second of flight time. - * -- * @param power the power of the firework, from 0-127 -- * @throws IllegalArgumentException if {@literal height<0 or height>127} -+ * @param power the power of the firework, from 0-255 -+ * @throws IllegalArgumentException if {@literal power < 0 or power > 255} - */ - void setPower(int power) throws IllegalArgumentException; - diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java diff --git a/patches/api/General-ItemMeta-fixes.patch b/patches/api/General-ItemMeta-fixes.patch index f3f14bcb22..94d37494b5 100644 --- a/patches/api/General-ItemMeta-fixes.patch +++ b/patches/api/General-ItemMeta-fixes.patch @@ -92,6 +92,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** * Checks to see if this item has a maximum amount of damage. * +diff --git a/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java b/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java ++++ b/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java +@@ -0,0 +0,0 @@ public interface FireworkMeta extends ItemMeta { + */ + boolean hasEffects(); + ++ // Paper start - add hasPower ++ /** ++ * Checks if power is defined on this meta. ++ * ++ * @return true if there is a power specified ++ */ ++ boolean hasPower(); ++ // Paper end - add hasPower ++ + /** + * Gets the approximate height the firework will fly. + * + * @return approximate flight height of the firework. ++ * @see #hasPower() + */ + int getPower(); + diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java diff --git a/patches/server/General-ItemMeta-fixes.patch b/patches/server/General-ItemMeta-fixes.patch index 7f007b78b9..3a48dfc053 100644 --- a/patches/server/General-ItemMeta-fixes.patch +++ b/patches/server/General-ItemMeta-fixes.patch @@ -671,6 +671,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.effects = new ArrayList<>(that.effects); } } +@@ -0,0 +0,0 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { + } + + Iterable effects = SerializableMeta.getObject(Iterable.class, map, CraftMetaFirework.EXPLOSIONS.BUKKIT, true); +- this.safelyAddEffects(effects); ++ this.safelyAddEffects(effects, false); // Paper - limit firework effects + } + + static FireworkEffect getEffect(FireworkExplosion explosion) { @@ -0,0 +0,0 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { .with(CraftMetaFirework.getEffectType(explosion.shape())); @@ -694,15 +703,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } return effect.build(); -@@ -0,0 +0,0 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { - } - - Iterable effects = SerializableMeta.getObject(Iterable.class, map, CraftMetaFirework.EXPLOSIONS.BUKKIT, true); -- this.safelyAddEffects(effects); -+ this.safelyAddEffects(effects, false); // Paper - limit firework effects - } - - @Override @@ -0,0 +0,0 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { return !(this.effects == null || this.effects.isEmpty()); } @@ -736,11 +736,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return !(this.effects != null || this.hasPower()); // Paper - empty effects list should stay on the item } - boolean hasPower() { +- boolean hasPower() { ++ public boolean hasPower() { // Paper - add hasPower to API + return this.power != null; + } + @@ -0,0 +0,0 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { if (meta instanceof CraftMetaFirework that) { - return (this.hasPower() ? that.hasPower() && this.power == that.power : !that.hasPower()) + return (Objects.equals(this.power, that.power)) - && (this.hasEffects() ? that.hasEffects() && this.effects.equals(that.effects) : !that.hasEffects()); + && (this.effects != null ? that.effects != null && this.effects.equals(that.effects) : that.effects == null); // Paper } @@ -793,14 +797,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override @@ -0,0 +0,0 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { + @Override - public void setPower(int power) { - Preconditions.checkArgument(power >= 0, "power cannot be less than zero: %s", power); -- Preconditions.checkArgument(power < 0x80, "power cannot be more than 127: %s", power); -+ Preconditions.checkArgument(power <= 0xFF, "power cannot be more than 255: %s", power); // Paper - set correct limit - this.power = power; + public int getPower() { +- return this.hasPower() ? this.power : 1; ++ return this.hasPower() ? this.power : 0; // Paper - 0 is correct } - } + + @Override diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -1857,19 +1861,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 itemMeta.applyToItem(compound); assertEquals(itemMeta, new CraftMetaItem(compound.build(), null)); // Paper -diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -@@ -0,0 +0,0 @@ import org.junit.jupiter.api.Test; - - public class ItemMetaTest extends AbstractTestingBase { - -- static final int MAX_FIREWORK_POWER = 127; // Please update ItemStackFireworkTest if/when this gets changed. -+ static final int MAX_FIREWORK_POWER = 255; // Please update ItemStackFireworkTest if/when this gets changed. // Paper - it changed - - @Test - public void testPowerLimitExact() { diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContainerTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContainerTest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContainerTest.java diff --git a/patches/server/More-Teleport-API.patch b/patches/server/More-Teleport-API.patch index 0032ec1cf0..a67a68612a 100644 --- a/patches/server/More-Teleport-API.patch +++ b/patches/server/More-Teleport-API.patch @@ -23,8 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.cserver.getPluginManager().callEvent(event); if (event.isCancelled() || !to.equals(event.getTo())) { -- set.clear(); // Can't relative teleport -+ // set.clear(); // Can't relative teleport // Paper - Teleport API; Now you can! +- set = Collections.emptySet(); // Can't relative teleport ++ // set = Collections.emptySet(); // Can't relative teleport // Paper - Teleport API; Now you can! to = event.isCancelled() ? event.getFrom() : event.getTo(); d0 = to.getX(); d1 = to.getY(); diff --git a/work/Bukkit b/work/Bukkit index facd52d216..4068c6aa92 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit facd52d216243e2b7f90a9f4d5cc54a8f4bbcbf7 +Subproject commit 4068c6aa92024936b8d21a56d83048784d700864 diff --git a/work/CraftBukkit b/work/CraftBukkit index b95736b13f..7548afcf24 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit b95736b13f776ba47322313f482c0520630c3533 +Subproject commit 7548afcf2470885065171982aa1c813196e98b09 diff --git a/work/Spigot b/work/Spigot index 5a6439b9ec..ca581228b6 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 5a6439b9eca2e28522873a0488e142cfc089c0fe +Subproject commit ca581228b6f5c2b4ee8236f604d5ea288f970c24