geforkt von Mirrors/Paper
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11284)
Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 4068c6aa PR-1053: Change docs for max power in FireworkMeta 6b3c241b SPIGOT-7783, SPIGOT-7784, PR-1051: Add Trial Vault & Spawner event API 5fe300ec PR-1052: Fix broken links and minor improvement for checkstyle.xml CraftBukkit Changes: 7548afcf2 SPIGOT-7872: Fix crash with event-modified teleports 93480d5d6 SPIGOT-7868, PR-1463: Fix default and max power in FireworkMeta 5060d1a84 SPIGOT-7783, SPIGOT-7784, PR-1460: Add Trial Vault & Spawner event API 11dfcae71 PR-1462: Fix broken links and minor improvement for checkstyle.xml Spigot Changes: ca581228 Rebuild patches
Dieser Commit ist enthalten in:
Ursprung
da11f251cd
Commit
c10949d863
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit facd52d216243e2b7f90a9f4d5cc54a8f4bbcbf7
|
||||
Subproject commit 4068c6aa92024936b8d21a56d83048784d700864
|
@ -1 +1 @@
|
||||
Subproject commit b95736b13f776ba47322313f482c0520630c3533
|
||||
Subproject commit 7548afcf2470885065171982aa1c813196e98b09
|
@ -1 +1 @@
|
||||
Subproject commit 5a6439b9eca2e28522873a0488e142cfc089c0fe
|
||||
Subproject commit ca581228b6f5c2b4ee8236f604d5ea288f970c24
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren