3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00
Dieser Commit ist enthalten in:
Lulu13022002 2024-10-26 19:11:37 +02:00
Ursprung 20507b45cf
Commit 7162ff0404
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 491C8F0B8ACDEB01
4 geänderte Dateien mit 90 neuen und 25 gelöschten Zeilen

Datei anzeigen

@ -1845,6 +1845,19 @@ index 32055a8890425e0b819930f3059da5ea9dfca553..26a336dade83baee97d20eb39a058925
+ //@Deprecated // Paper + //@Deprecated // Paper
int getMapId(); int getMapId();
/**
diff --git a/src/main/java/org/bukkit/inventory/meta/components/EquippableComponent.java b/src/main/java/org/bukkit/inventory/meta/components/EquippableComponent.java
index c56e81eb71bccc03378aea71096fdf66b4bfa784..16713c9d4cfaed5ad509b4075121e44c55a8cc76 100644
--- a/src/main/java/org/bukkit/inventory/meta/components/EquippableComponent.java
+++ b/src/main/java/org/bukkit/inventory/meta/components/EquippableComponent.java
@@ -37,7 +37,7 @@ public interface EquippableComponent extends ConfigurationSerializable {
*
* @return the sound
*/
- @Nullable
+ @NotNull // Paper
Sound getEquipSound();
/** /**
diff --git a/src/main/java/org/bukkit/map/MapCanvas.java b/src/main/java/org/bukkit/map/MapCanvas.java diff --git a/src/main/java/org/bukkit/map/MapCanvas.java b/src/main/java/org/bukkit/map/MapCanvas.java
index edef478786bb7456af29ca960009873095830050..e8ac449e6280827beb6d2699df75b1d52a922c9b 100644 index edef478786bb7456af29ca960009873095830050..e8ac449e6280827beb6d2699df75b1d52a922c9b 100644

Datei anzeigen

@ -1049,7 +1049,7 @@ index 566d893a413fd04b99e83dc2da8fe958a48492a8..a944803771d514572f94b4e98a6d4435
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411fcb433c8c 100644 index 13b19adc21ece31476b2980c5bc01a50f15df634..a6e2281bfac94f1e19836d9c8415d8270387b16d 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -199,9 +199,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -199,9 +199,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@ -1177,7 +1177,33 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
if (lore == null) { if (lore == null) {
this.lore = null; this.lore = null;
} else { } else {
@@ -1692,7 +1699,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1596,6 +1603,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Override
public void setUseRemainder(ItemStack useRemainder) {
+ Preconditions.checkArgument(useRemainder == null || !useRemainder.isEmpty(), "Item cannot be empty"); // Paper
this.useRemainder = useRemainder;
}
@@ -1606,7 +1614,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Override
public UseCooldownComponent getUseCooldown() {
- return (this.hasUseCooldown()) ? new CraftUseCooldownComponent(this.useCooldown) : new CraftUseCooldownComponent(new UseCooldown(0));
+ return (this.hasUseCooldown()) ? new CraftUseCooldownComponent(this.useCooldown) : new CraftUseCooldownComponent(new UseCooldown(1.0F)); // Paper - Create a valid use_cooldown component
}
@Override
@@ -1656,7 +1664,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Override
public void setEquippable(EquippableComponent equippable) {
- this.equippable = (equippable == null) ? null : new CraftEquippableComponent((CraftEquippableComponent) this.equippable);
+ this.equippable = (equippable == null) ? null : new CraftEquippableComponent((CraftEquippableComponent) equippable); // Paper
}
@Override
@@ -1692,7 +1700,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Override @Override
public Multimap<Attribute, AttributeModifier> getAttributeModifiers(@Nullable EquipmentSlot slot) { public Multimap<Attribute, AttributeModifier> getAttributeModifiers(@Nullable EquipmentSlot slot) {
@ -1186,7 +1212,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
SetMultimap<Attribute, AttributeModifier> result = LinkedHashMultimap.create(); SetMultimap<Attribute, AttributeModifier> result = LinkedHashMultimap.create();
for (Map.Entry<Attribute, AttributeModifier> entry : this.attributeModifiers.entries()) { for (Map.Entry<Attribute, AttributeModifier> entry : this.attributeModifiers.entries()) {
if (entry.getValue().getSlot() == null || entry.getValue().getSlot() == slot) { if (entry.getValue().getSlot() == null || entry.getValue().getSlot() == slot) {
@@ -1705,6 +1712,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1705,6 +1713,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Override @Override
public Collection<AttributeModifier> getAttributeModifiers(@Nonnull Attribute attribute) { public Collection<AttributeModifier> getAttributeModifiers(@Nonnull Attribute attribute) {
Preconditions.checkNotNull(attribute, "Attribute cannot be null"); Preconditions.checkNotNull(attribute, "Attribute cannot be null");
@ -1194,7 +1220,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
return this.attributeModifiers.containsKey(attribute) ? ImmutableList.copyOf(this.attributeModifiers.get(attribute)) : null; return this.attributeModifiers.containsKey(attribute) ? ImmutableList.copyOf(this.attributeModifiers.get(attribute)) : null;
} }
@@ -1712,22 +1720,33 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1712,22 +1721,33 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
public boolean addAttributeModifier(@Nonnull Attribute attribute, @Nonnull AttributeModifier modifier) { public boolean addAttributeModifier(@Nonnull Attribute attribute, @Nonnull AttributeModifier modifier) {
Preconditions.checkNotNull(attribute, "Attribute cannot be null"); Preconditions.checkNotNull(attribute, "Attribute cannot be null");
Preconditions.checkNotNull(modifier, "AttributeModifier cannot be null"); Preconditions.checkNotNull(modifier, "AttributeModifier cannot be null");
@ -1232,7 +1258,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
Iterator<Map.Entry<Attribute, AttributeModifier>> iterator = attributeModifiers.entries().iterator(); Iterator<Map.Entry<Attribute, AttributeModifier>> iterator = attributeModifiers.entries().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1737,6 +1756,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1737,6 +1757,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
iterator.remove(); iterator.remove();
continue; continue;
} }
@ -1240,7 +1266,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
this.attributeModifiers.put(next.getKey(), next.getValue()); this.attributeModifiers.put(next.getKey(), next.getValue());
} }
} }
@@ -1744,13 +1764,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1744,13 +1765,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Override @Override
public boolean removeAttributeModifier(@Nonnull Attribute attribute) { public boolean removeAttributeModifier(@Nonnull Attribute attribute) {
Preconditions.checkNotNull(attribute, "Attribute cannot be null"); Preconditions.checkNotNull(attribute, "Attribute cannot be null");
@ -1256,7 +1282,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
int removed = 0; int removed = 0;
Iterator<Map.Entry<Attribute, AttributeModifier>> iter = this.attributeModifiers.entries().iterator(); Iterator<Map.Entry<Attribute, AttributeModifier>> iter = this.attributeModifiers.entries().iterator();
@@ -1770,7 +1790,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1770,7 +1791,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
public boolean removeAttributeModifier(@Nonnull Attribute attribute, @Nonnull AttributeModifier modifier) { public boolean removeAttributeModifier(@Nonnull Attribute attribute, @Nonnull AttributeModifier modifier) {
Preconditions.checkNotNull(attribute, "Attribute cannot be null"); Preconditions.checkNotNull(attribute, "Attribute cannot be null");
Preconditions.checkNotNull(modifier, "AttributeModifier cannot be null"); Preconditions.checkNotNull(modifier, "AttributeModifier cannot be null");
@ -1265,7 +1291,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
int removed = 0; int removed = 0;
Iterator<Map.Entry<Attribute, AttributeModifier>> iter = this.attributeModifiers.entries().iterator(); Iterator<Map.Entry<Attribute, AttributeModifier>> iter = this.attributeModifiers.entries().iterator();
@@ -1792,7 +1812,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1792,7 +1813,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Override @Override
public String getAsString() { public String getAsString() {
@ -1274,7 +1300,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
this.applyToItem(tag); this.applyToItem(tag);
DataComponentPatch patch = tag.build(); DataComponentPatch patch = tag.build();
net.minecraft.nbt.Tag nbt = DataComponentPatch.CODEC.encodeStart(MinecraftServer.getDefaultRegistryAccess().createSerializationContext(NbtOps.INSTANCE), patch).getOrThrow(); net.minecraft.nbt.Tag nbt = DataComponentPatch.CODEC.encodeStart(MinecraftServer.getDefaultRegistryAccess().createSerializationContext(NbtOps.INSTANCE), patch).getOrThrow();
@@ -1801,7 +1821,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1801,7 +1822,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Override @Override
public String getAsComponentString() { public String getAsComponentString() {
@ -1283,7 +1309,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
this.applyToItem(tag); this.applyToItem(tag);
DataComponentPatch patch = tag.build(); DataComponentPatch patch = tag.build();
@@ -1841,6 +1861,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1841,6 +1862,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
if (first == null || second == null) { if (first == null || second == null) {
return false; return false;
} }
@ -1291,7 +1317,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
for (Map.Entry<Attribute, AttributeModifier> entry : first.entries()) { for (Map.Entry<Attribute, AttributeModifier> entry : first.entries()) {
if (!second.containsEntry(entry.getKey(), entry.getValue())) { if (!second.containsEntry(entry.getKey(), entry.getValue())) {
return false; return false;
@@ -1856,19 +1877,33 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1856,19 +1878,33 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Override @Override
public boolean hasDamage() { public boolean hasDamage() {
@ -1327,7 +1353,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
@Override @Override
public boolean hasMaxDamage() { public boolean hasMaxDamage() {
return this.maxDamage != null; return this.maxDamage != null;
@@ -1882,6 +1917,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1882,6 +1918,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Override @Override
public void setMaxDamage(Integer maxDamage) { public void setMaxDamage(Integer maxDamage) {
@ -1335,7 +1361,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
this.maxDamage = maxDamage; this.maxDamage = maxDamage;
} }
@@ -1914,7 +1950,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1914,7 +1951,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
&& (this.hasEnchantable() ? that.hasEnchantable() && this.enchantableValue.equals(that.enchantableValue) : !that.hasEnchantable()) && (this.hasEnchantable() ? that.hasEnchantable() && this.enchantableValue.equals(that.enchantableValue) : !that.hasEnchantable())
&& (this.hasBlockData() ? that.hasBlockData() && this.blockData.equals(that.blockData) : !that.hasBlockData()) && (this.hasBlockData() ? that.hasBlockData() && this.blockData.equals(that.blockData) : !that.hasBlockData())
&& (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost()) && (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost())
@ -1344,7 +1370,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
&& (this.unhandledTags.equals(that.unhandledTags)) && (this.unhandledTags.equals(that.unhandledTags))
&& (this.removedTags.equals(that.removedTags)) && (this.removedTags.equals(that.removedTags))
&& (Objects.equals(this.customTag, that.customTag)) && (Objects.equals(this.customTag, that.customTag))
@@ -1935,7 +1971,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1935,7 +1972,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
&& (this.hasTool() ? that.hasTool() && this.tool.equals(that.tool) : !that.hasTool()) && (this.hasTool() ? that.hasTool() && this.tool.equals(that.tool) : !that.hasTool())
&& (this.hasEquippable() ? that.hasEquippable() && this.equippable.equals(that.equippable) : !that.hasEquippable()) && (this.hasEquippable() ? that.hasEquippable() && this.equippable.equals(that.equippable) : !that.hasEquippable())
&& (this.hasJukeboxPlayable() ? that.hasJukeboxPlayable() && this.jukebox.equals(that.jukebox) : !that.hasJukeboxPlayable()) && (this.hasJukeboxPlayable() ? that.hasJukeboxPlayable() && this.jukebox.equals(that.jukebox) : !that.hasJukeboxPlayable())
@ -1353,7 +1379,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
&& (this.hasMaxDamage() ? that.hasMaxDamage() && this.maxDamage.equals(that.maxDamage) : !that.hasMaxDamage()) && (this.hasMaxDamage() ? that.hasMaxDamage() && this.maxDamage.equals(that.maxDamage) : !that.hasMaxDamage())
&& (this.canPlaceOnPredicates != null ? that.canPlaceOnPredicates != null && this.canPlaceOnPredicates.equals(that.canPlaceOnPredicates) : that.canPlaceOnPredicates == null) // Paper && (this.canPlaceOnPredicates != null ? that.canPlaceOnPredicates != null && this.canPlaceOnPredicates.equals(that.canPlaceOnPredicates) : that.canPlaceOnPredicates == null) // Paper
&& (this.canBreakPredicates != null ? that.canBreakPredicates != null && this.canBreakPredicates.equals(that.canBreakPredicates) : that.canBreakPredicates == null) // Paper && (this.canBreakPredicates != null ? that.canBreakPredicates != null && this.canBreakPredicates.equals(that.canBreakPredicates) : that.canBreakPredicates == null) // Paper
@@ -1988,9 +2024,9 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1988,9 +2025,9 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
hash = 61 * hash + (this.hasTool() ? this.tool.hashCode() : 0); hash = 61 * hash + (this.hasTool() ? this.tool.hashCode() : 0);
hash = 61 * hash + (this.hasJukeboxPlayable() ? this.jukebox.hashCode() : 0); hash = 61 * hash + (this.hasJukeboxPlayable() ? this.jukebox.hashCode() : 0);
hash = 61 * hash + (this.hasEquippable() ? this.equippable.hashCode() : 0); hash = 61 * hash + (this.hasEquippable() ? this.equippable.hashCode() : 0);
@ -1366,7 +1392,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
hash = 61 * hash + (this.canPlaceOnPredicates != null ? this.canPlaceOnPredicates.hashCode() : 0); // Paper hash = 61 * hash + (this.canPlaceOnPredicates != null ? this.canPlaceOnPredicates.hashCode() : 0); // Paper
hash = 61 * hash + (this.canBreakPredicates != null ? this.canBreakPredicates.hashCode() : 0); // Paper hash = 61 * hash + (this.canBreakPredicates != null ? this.canBreakPredicates.hashCode() : 0); // Paper
hash = 61 * hash + this.version; hash = 61 * hash + this.version;
@@ -2011,7 +2047,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -2011,7 +2048,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
if (this.enchantments != null) { if (this.enchantments != null) {
clone.enchantments = new EnchantmentMap(this.enchantments); // Paper clone.enchantments = new EnchantmentMap(this.enchantments); // Paper
} }
@ -1375,7 +1401,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers); clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers);
} }
if (this.customTag != null) { if (this.customTag != null) {
@@ -2178,7 +2214,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -2178,7 +2215,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
builder.put(CraftMetaItem.JUKEBOX_PLAYABLE.BUKKIT, this.jukebox); builder.put(CraftMetaItem.JUKEBOX_PLAYABLE.BUKKIT, this.jukebox);
} }
@ -1384,7 +1410,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
builder.put(CraftMetaItem.DAMAGE.BUKKIT, this.damage); builder.put(CraftMetaItem.DAMAGE.BUKKIT, this.damage);
} }
@@ -2279,7 +2315,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -2279,7 +2316,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
} }
static void serializeModifiers(Multimap<Attribute, AttributeModifier> modifiers, ImmutableMap.Builder<String, Object> builder, ItemMetaKey key) { static void serializeModifiers(Multimap<Attribute, AttributeModifier> modifiers, ImmutableMap.Builder<String, Object> builder, ItemMetaKey key) {
@ -1393,7 +1419,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
return; return;
} }
@@ -2361,7 +2397,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -2361,7 +2398,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
// Paper start - improve checking handled tags // Paper start - improve checking handled tags
@org.jetbrains.annotations.VisibleForTesting @org.jetbrains.annotations.VisibleForTesting
public static final Map<Class<? extends CraftMetaItem>, Set<DataComponentType<?>>> HANDLED_DCTS_PER_TYPE = new HashMap<>(); public static final Map<Class<? extends CraftMetaItem>, Set<DataComponentType<?>>> HANDLED_DCTS_PER_TYPE = new HashMap<>();
@ -1402,7 +1428,7 @@ index 13b19adc21ece31476b2980c5bc01a50f15df634..63567251d101b5e50ffd7e2825b1411f
CraftMetaItem.NAME.TYPE, CraftMetaItem.NAME.TYPE,
CraftMetaItem.ITEM_NAME.TYPE, CraftMetaItem.ITEM_NAME.TYPE,
CraftMetaItem.LORE.TYPE, CraftMetaItem.LORE.TYPE,
@@ -2437,7 +2473,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -2437,7 +2474,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
// Paper end - improve checking handled data component types // Paper end - improve checking handled data component types
protected static <T> Optional<? extends T> getOrEmpty(DataComponentPatch tag, ItemMetaKeyType<T> type) { protected static <T> Optional<? extends T> getOrEmpty(DataComponentPatch tag, ItemMetaKeyType<T> type) {
@ -2027,6 +2053,19 @@ index e00b757d6059715e8697428008fcb3e6e7abbe2e..dcf02bd0f7f4c67f5ab98003cc932b96
+ } + }
+ // Paper end - General ItemMeta Fixes + // Paper end - General ItemMeta Fixes
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftEquippableComponent.java b/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftEquippableComponent.java
index 1f1589bcdb9e3abde7d25eac65326df1e7ed75ab..9b4c2502e45af4e7a58ff352f0f99c34d233f755 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftEquippableComponent.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftEquippableComponent.java
@@ -170,7 +170,7 @@ public final class CraftEquippableComponent implements EquippableComponent {
@Override
public void setAllowedEntities(Tag<EntityType> tag) {
- Preconditions.checkArgument(tag instanceof CraftEntityTag, "tag must be an entity tag");
+ Preconditions.checkArgument(tag == null || tag instanceof CraftEntityTag, "tag must be an entity tag"); // Paper
this.handle = new Equippable(this.handle.slot(), this.handle.equipSound(), this.handle.model(), this.handle.cameraOverlay(),
(tag != null) ? Optional.of(((CraftEntityTag) tag).getHandle()) : Optional.empty(),
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftToolComponent.java b/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftToolComponent.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftToolComponent.java b/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftToolComponent.java
index 9a4a1d903c22e9d2a0cbda95ceb8b1dcfb29112e..4f7914f96207feda67cd910213bb624df4802a06 100644 index 9a4a1d903c22e9d2a0cbda95ceb8b1dcfb29112e..4f7914f96207feda67cd910213bb624df4802a06 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftToolComponent.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftToolComponent.java
@ -2063,6 +2102,19 @@ index 9a4a1d903c22e9d2a0cbda95ceb8b1dcfb29112e..4f7914f96207feda67cd910213bb624d
this.handle = new Tool.Rule(this.handle.blocks(), Optional.ofNullable(speed), this.handle.correctForDrops()); this.handle = new Tool.Rule(this.handle.blocks(), Optional.ofNullable(speed), this.handle.correctForDrops());
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftUseCooldownComponent.java b/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftUseCooldownComponent.java
index 952e7fa022161d1d21ba1a4f43abe5ee221dee4b..0f86ff23cc6a2f617fc5ef67e576e1e3cb29034c 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftUseCooldownComponent.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftUseCooldownComponent.java
@@ -55,7 +55,7 @@ public final class CraftUseCooldownComponent implements UseCooldownComponent {
@Override
public void setCooldownSeconds(float eatSeconds) {
- Preconditions.checkArgument(eatSeconds >= 0, "eatSeconds cannot be less than 0");
+ Preconditions.checkArgument(eatSeconds > 0, "eatSeconds must be positive"); // Paper
this.handle = new UseCooldown(eatSeconds, this.handle.cooldownGroup());
}
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java
index 9cc1ef5c9221dd7d2069b280f0c91ce9439a995a..1c80fe7549d70ae16c7b755c22752549261f072a 100644 index 9cc1ef5c9221dd7d2069b280f0c91ce9439a995a..1c80fe7549d70ae16c7b755c22752549261f072a 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java --- a/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java

Datei anzeigen

@ -52,10 +52,10 @@ index e62baea16df017f1e394e3c706157e158066eb93..656c9a6d8cd42891141ee29ec91ab5d1
throw new IllegalArgumentException("Could not get slot " + slot + " - not a valid slot for PlayerInventory"); throw new IllegalArgumentException("Could not get slot " + slot + " - not a valid slot for PlayerInventory");
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 63567251d101b5e50ffd7e2825b1411fcb433c8c..450c5aa14b4195eb7123492c7a111ec6f40ce412 100644 index a6e2281bfac94f1e19836d9c8415d8270387b16d..a4d6c95e55722c9a0e381d7b84916787240cea8e 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -1702,7 +1702,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1703,7 +1703,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
if (this.attributeModifiers == null) return LinkedHashMultimap.create(); // Paper - don't change the components if (this.attributeModifiers == null) return LinkedHashMultimap.create(); // Paper - don't change the components
SetMultimap<Attribute, AttributeModifier> result = LinkedHashMultimap.create(); SetMultimap<Attribute, AttributeModifier> result = LinkedHashMultimap.create();
for (Map.Entry<Attribute, AttributeModifier> entry : this.attributeModifiers.entries()) { for (Map.Entry<Attribute, AttributeModifier> entry : this.attributeModifiers.entries()) {
@ -64,7 +64,7 @@ index 63567251d101b5e50ffd7e2825b1411fcb433c8c..450c5aa14b4195eb7123492c7a111ec6
result.put(entry.getKey(), entry.getValue()); result.put(entry.getKey(), entry.getValue());
} }
} }
@@ -1776,9 +1776,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1777,9 +1777,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
while (iter.hasNext()) { while (iter.hasNext()) {
Map.Entry<Attribute, AttributeModifier> entry = iter.next(); Map.Entry<Attribute, AttributeModifier> entry = iter.next();

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add API for CanPlaceOn and CanDestroy NBT values
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 450c5aa14b4195eb7123492c7a111ec6f40ce412..3b3c15c8bd8591aa173343251d7a504c6004e9d2 100644 index a4d6c95e55722c9a0e381d7b84916787240cea8e..188684a480c8ae2b761ed12ca0b1d256cef67538 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -2498,4 +2498,119 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -2499,4 +2499,119 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
} }
// Paper end // Paper end