From 9206b1ea140ac0e9a47165c81cae6b8074a327bc Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 14 Jun 2024 13:07:50 +0200 Subject: [PATCH] Fix a few compile errors --- .../paper/registry/keys/DamageTypeKeys.java | 2 - .../paper/registry/keys/EnchantmentKeys.java | 4 - .../paper/registry/keys/MobEffectKeys.java | 8 -- .../paper/registry/keys/StructureKeys.java | 2 - .../paper/registry/keys/TrimPatternKeys.java | 3 - .../Add-missing-wind-charge-damage-type.patch | 2 - ...PI-additions-for-quantity-flags-lore.patch | 2 +- .../api/ItemStack-getMaxItemUseDuration.patch | 18 ++- ...add-missing-Experimental-annotations.patch | 135 +----------------- .../server/Add-PlayerArmorChangeEvent.patch | 2 +- patches/server/Chunk-Save-Reattempt.patch | 4 +- .../ItemStack-getMaxItemUseDuration.patch | 30 +++- ...-data-to-disk-if-it-serializes-witho.patch | 6 +- .../PlayerDeathEvent-getItemsToKeep.patch | 2 +- ...egionFileCache-and-make-configurable.patch | 2 +- 15 files changed, 55 insertions(+), 167 deletions(-) diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/DamageTypeKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/DamageTypeKeys.java index ed52d2393e..b9931bda8f 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/DamageTypeKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/DamageTypeKeys.java @@ -333,8 +333,6 @@ public final class DamageTypeKeys { * * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ - @ApiStatus.Experimental - @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) public static final TypedKey WIND_CHARGE = create(key("wind_charge")); /** diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/EnchantmentKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/EnchantmentKeys.java index 3c64bc0790..0acf663315 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/EnchantmentKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/EnchantmentKeys.java @@ -61,7 +61,6 @@ public final class EnchantmentKeys { * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ @ApiStatus.Experimental - @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) public static final TypedKey BREACH = create(key("breach")); /** @@ -77,7 +76,6 @@ public final class EnchantmentKeys { * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ @ApiStatus.Experimental - @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) public static final TypedKey DENSITY = create(key("density")); /** @@ -323,8 +321,6 @@ public final class EnchantmentKeys { * * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ - @ApiStatus.Experimental - @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) public static final TypedKey WIND_BURST = create(key("wind_burst")); private EnchantmentKeys() { diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/MobEffectKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/MobEffectKeys.java index 83835bd7ff..5f3525a4da 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/MobEffectKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/MobEffectKeys.java @@ -117,7 +117,6 @@ public final class MobEffectKeys { * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ @ApiStatus.Experimental - @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) public static final TypedKey INFESTED = create(key("infested")); /** @@ -188,8 +187,6 @@ public final class MobEffectKeys { * * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ - @ApiStatus.Experimental - @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) public static final TypedKey OOZING = create(key("oozing")); /** @@ -204,8 +201,6 @@ public final class MobEffectKeys { * * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ - @ApiStatus.Experimental - @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) public static final TypedKey RAID_OMEN = create(key("raid_omen")); /** @@ -263,7 +258,6 @@ public final class MobEffectKeys { * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ @ApiStatus.Experimental - @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) public static final TypedKey TRIAL_OMEN = create(key("trial_omen")); /** @@ -293,7 +287,6 @@ public final class MobEffectKeys { * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ @ApiStatus.Experimental - @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) public static final TypedKey WEAVING = create(key("weaving")); /** @@ -302,7 +295,6 @@ public final class MobEffectKeys { * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ @ApiStatus.Experimental - @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) public static final TypedKey WIND_CHARGED = create(key("wind_charged")); /** diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/StructureKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/StructureKeys.java index 22d644aa24..4fc0d8f198 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/StructureKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/StructureKeys.java @@ -228,8 +228,6 @@ public final class StructureKeys { * * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ - @ApiStatus.Experimental - @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) public static final TypedKey TRIAL_CHAMBERS = create(key("trial_chambers")); /** diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/TrimPatternKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/TrimPatternKeys.java index b3e92fbbe2..ec8930239a 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/TrimPatternKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/TrimPatternKeys.java @@ -33,7 +33,6 @@ public final class TrimPatternKeys { * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ @ApiStatus.Experimental - @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) public static final TypedKey BOLT = create(key("bolt")); /** @@ -62,8 +61,6 @@ public final class TrimPatternKeys { * * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ - @ApiStatus.Experimental - @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) public static final TypedKey FLOW = create(key("flow")); /** diff --git a/patches/api/Add-missing-wind-charge-damage-type.patch b/patches/api/Add-missing-wind-charge-damage-type.patch index af70afa6af..908e0b7b00 100644 --- a/patches/api/Add-missing-wind-charge-damage-type.patch +++ b/patches/api/Add-missing-wind-charge-damage-type.patch @@ -13,8 +13,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static final DamageType OUTSIDE_BORDER = getDamageType("outside_border"); public static final DamageType GENERIC_KILL = getDamageType("generic_kill"); + // Paper start -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) -+ @ApiStatus.Experimental + @org.jetbrains.annotations.Nullable + DamageType WIND_CHARGE = getExperimentalDamageType("wind_charge"); + // Paper end diff --git a/patches/api/ItemStack-API-additions-for-quantity-flags-lore.patch b/patches/api/ItemStack-API-additions-for-quantity-flags-lore.patch index 758f8221e9..15deb95148 100644 --- a/patches/api/ItemStack-API-additions-for-quantity-flags-lore.patch +++ b/patches/api/ItemStack-API-additions-for-quantity-flags-lore.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/inventory/ItemStack.java @@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat // Requires access to NMS - return ensureServerConversions().getMaxItemUseDuration(); + return ensureServerConversions().getMaxItemUseDuration(entity); } + + /** diff --git a/patches/api/ItemStack-getMaxItemUseDuration.patch b/patches/api/ItemStack-getMaxItemUseDuration.patch index 49d8c076a3..dbea6152a9 100644 --- a/patches/api/ItemStack-getMaxItemUseDuration.patch +++ b/patches/api/ItemStack-getMaxItemUseDuration.patch @@ -9,17 +9,33 @@ diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/o index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -0,0 +0,0 @@ import org.bukkit.Translatable; + import org.bukkit.Utility; + import org.bukkit.configuration.serialization.ConfigurationSerializable; + import org.bukkit.enchantments.Enchantment; ++import org.bukkit.entity.LivingEntity; + import org.bukkit.inventory.meta.Damageable; + import org.bukkit.inventory.meta.ItemMeta; + import org.bukkit.material.MaterialData; @@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public String getI18NDisplayName() { return Bukkit.getServer().getItemFactory().getI18NDisplayName(this); } + ++ /** ++ * @deprecated use {@link #getMaxItemUseDuration(LivingEntity)}; crossbows, later possibly more items require an entity parameter ++ */ ++ @Deprecated(forRemoval = true) + public int getMaxItemUseDuration() { ++ return getMaxItemUseDuration(null); ++ } ++ ++ public int getMaxItemUseDuration(@NotNull final LivingEntity entity) { + if (type == null || type == Material.AIR || !type.isItem()) { + return 0; + } + // Requires access to NMS -+ return ensureServerConversions().getMaxItemUseDuration(); ++ return ensureServerConversions().getMaxItemUseDuration(entity); + } // Paper end } diff --git a/patches/api/add-missing-Experimental-annotations.patch b/patches/api/add-missing-Experimental-annotations.patch index 4c0b56ed30..f8847a7749 100644 --- a/patches/api/add-missing-Experimental-annotations.patch +++ b/patches/api/add-missing-Experimental-annotations.patch @@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 EGG(21603, 16), COMPASS(24139), RECOVERY_COMPASS(12710), -+ @MinecraftExperimental(Requires.BUNDLE) // Paper - add missing annotation ++ @MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.BUNDLE) // Paper - add missing annotation + @ApiStatus.Experimental // Paper - add missing annotation BUNDLE(16835, 1), FISHING_ROD(4167, 1, 64), @@ -60,63 +60,14 @@ diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/Tag.java +++ b/src/main/java/org/bukkit/Tag.java -@@ -0,0 +0,0 @@ public interface Tag extends Keyed { - /** - * Vanilla block tag representing all blocks which block wind charge explosions. - */ -+ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Tag BLOCKS_WIND_CHARGE_EXPLOSIONS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("blocks_wind_charge_explosions"), Material.class); - /** - * Vanilla block tag representing solid blocks which do not block hopper operation. -@@ -0,0 +0,0 @@ public interface Tag extends Keyed { - /** - * Vanilla item tag representing all items enchantable with mace enchantments. - */ -+ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Tag ITEMS_ENCHANTABLE_MACE = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/mace"), Material.class); - /** - * Vanilla item tag representing all items that confer freeze immunity on -@@ -0,0 +0,0 @@ public interface Tag extends Keyed { - /** - * Vanilla tag representing entities which deflect projectiles. - */ -+ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Tag ENTITY_TYPES_DEFLECTS_PROJECTILES = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("deflects_projectiles"), EntityType.class); - /** - * Vanilla tag representing entities which deflect arrows. @@ -0,0 +0,0 @@ public interface Tag extends Keyed { /** * Vanilla tag representing entities which can turn in boats. */ -+ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation + @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation Tag ENTITY_TYPES_CAN_TURN_IN_BOATS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("can_turn_in_boats"), EntityType.class); /** * Vanilla tag representing all entities sensitive to illager enchantments. -@@ -0,0 +0,0 @@ public interface Tag extends Keyed { - /** - * Vanilla tag representing all entities which do not receive anger from wind charges. - */ -+ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Tag ENTITY_TYPES_NO_ANGER_FROM_WIND_CHARGE = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("no_anger_from_wind_charge"), EntityType.class); - /** - * Vanilla tag representing all entities which are immune from the oozing effect. - */ -+ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Tag ENTITY_TYPES_IMMUNE_TO_OOZING = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("immune_to_oozing"), EntityType.class); - /** - * Vanilla tag representing all entities which are immune from the infested effect. - */ -+ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Tag ENTITY_TYPES_IMMUNE_TO_INFESTED = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("immune_to_infested"), EntityType.class); - /** - * Vanilla tag representing all projectiles which can be punched back. diff --git a/src/main/java/org/bukkit/inventory/meta/BundleMeta.java b/src/main/java/org/bukkit/inventory/meta/BundleMeta.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/meta/BundleMeta.java @@ -129,38 +80,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @ApiStatus.Experimental public interface BundleMeta extends ItemMeta { -diff --git a/src/main/java/org/bukkit/inventory/meta/OminousBottleMeta.java b/src/main/java/org/bukkit/inventory/meta/OminousBottleMeta.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/meta/OminousBottleMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/OminousBottleMeta.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - /** - * Represents an ominous bottle with an amplifier of the bad omen effect. - */ -+@org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+@org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public interface OminousBottleMeta extends ItemMeta { - - /** -diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java -+++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java -@@ -0,0 +0,0 @@ public interface TrimPattern extends Keyed, Translatable { - /** - * {@link Material#FLOW_ARMOR_TRIM_SMITHING_TEMPLATE}. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final TrimPattern FLOW = Registry.TRIM_PATTERN.get(NamespacedKey.minecraft("flow")); - /** - * {@link Material#BOLT_ARMOR_TRIM_SMITHING_TEMPLATE}. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final TrimPattern BOLT = Registry.TRIM_PATTERN.get(NamespacedKey.minecraft("bolt")); - - // Paper start - adventure diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/map/MapCursor.java @@ -188,58 +107,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation JUNGLE_TEMPLE(32, "jungle_temple"), + @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation SWAMP_HUT(33, "swamp_hut"), -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation TRIAL_CHAMBERS(34, "trial_chambers") ; - -diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/potion/PotionEffectType.java -+++ b/src/main/java/org/bukkit/potion/PotionEffectType.java -@@ -0,0 +0,0 @@ public abstract class PotionEffectType implements Keyed, Translatable, net.kyori - /** - * Causes trial spawners to become ominous. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final PotionEffectType TRIAL_OMEN = getPotionEffectType(34, "trial_omen"); - - /** - * Triggers a raid when a player enters a village. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final PotionEffectType RAID_OMEN = getPotionEffectType(35, "raid_omen"); - - /** - * Emits a wind burst upon death. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final PotionEffectType WIND_CHARGED = getPotionEffectType(36, "wind_charged"); - - /** - * Creates cobwebs upon death. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final PotionEffectType WEAVING = getPotionEffectType(37, "weaving"); - - /** - * Causes slimes to spawn upon death. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final PotionEffectType OOZING = getPotionEffectType(38, "oozing"); - - /** - * Chance of spawning silverfish when hurt. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final PotionEffectType INFESTED = getPotionEffectType(39, "infested"); - - @NotNull diff --git a/patches/server/Add-PlayerArmorChangeEvent.patch b/patches/server/Add-PlayerArmorChangeEvent.patch index 1f2f296246..ef8ffc9dd5 100644 --- a/patches/server/Add-PlayerArmorChangeEvent.patch +++ b/patches/server/Add-PlayerArmorChangeEvent.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.equipmentHasChanged(itemstack1, itemstack2)) { + // Paper start - PlayerArmorChangeEvent -+ if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.ARMOR) { ++ if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) { + final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack1); + final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack2); + new com.destroystokyo.paper.event.player.PlayerArmorChangeEvent((Player) this.getBukkitEntity(), com.destroystokyo.paper.event.player.PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); diff --git a/patches/server/Chunk-Save-Reattempt.patch b/patches/server/Chunk-Save-Reattempt.patch index e5e83cdecd..1a538b88d2 100644 --- a/patches/server/Chunk-Save-Reattempt.patch +++ b/patches/server/Chunk-Save-Reattempt.patch @@ -22,7 +22,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSto index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable { +@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable { protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException { RegionFile regionfile = this.getRegionFile(pos, false); // CraftBukkit @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (nbt == null) { regionfile.clear(pos); -@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable { +@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable { dataoutputstream.close(); } } diff --git a/patches/server/ItemStack-getMaxItemUseDuration.patch b/patches/server/ItemStack-getMaxItemUseDuration.patch index daa6a1125b..8d80b80f80 100644 --- a/patches/server/ItemStack-getMaxItemUseDuration.patch +++ b/patches/server/ItemStack-getMaxItemUseDuration.patch @@ -9,14 +9,40 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +@@ -0,0 +0,0 @@ import net.minecraft.core.Holder; + import net.minecraft.core.component.DataComponentPatch; + import net.minecraft.core.component.DataComponents; + import net.minecraft.world.item.Item; ++import net.minecraft.world.item.Items; + import net.minecraft.world.item.enchantment.EnchantmentHelper; + import net.minecraft.world.item.enchantment.ItemEnchantments; + import org.bukkit.Material; + import org.bukkit.configuration.serialization.DelegateDeserialization; + import org.bukkit.craftbukkit.enchantments.CraftEnchantment; ++import org.bukkit.craftbukkit.entity.CraftLivingEntity; + import org.bukkit.craftbukkit.util.CraftLegacy; + import org.bukkit.craftbukkit.util.CraftMagicNumbers; + import org.bukkit.enchantments.Enchantment; ++import org.bukkit.entity.LivingEntity; + import org.bukkit.inventory.ItemStack; + import org.bukkit.inventory.meta.ItemMeta; + import org.bukkit.material.MaterialData; @@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack { return (this.handle == null) ? Material.AIR.getMaxStackSize() : this.handle.getMaxStackSize(); } + // Paper start + @Override -+ public int getMaxItemUseDuration() { -+ return handle == null ? 0 : handle.getUseDuration(); ++ public int getMaxItemUseDuration(final LivingEntity entity) { ++ if (handle == null) { ++ return 0; ++ } ++ ++ // Make sure plugins calling the old method don't blow up ++ if (entity == null && handle.is(Items.CROSSBOW)) { ++ throw new UnsupportedOperationException("This item requires an entity to determine the max use duration"); ++ } ++ return handle.getUseDuration(((CraftLivingEntity) entity).getHandle()); + } + // Paper end + diff --git a/patches/server/Only-write-chunk-data-to-disk-if-it-serializes-witho.patch b/patches/server/Only-write-chunk-data-to-disk-if-it-serializes-witho.patch index 123e55847e..1c1103b17a 100644 --- a/patches/server/Only-write-chunk-data-to-disk-if-it-serializes-witho.patch +++ b/patches/server/Only-write-chunk-data-to-disk-if-it-serializes-witho.patch @@ -47,7 +47,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSto index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable { +@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable { try { NbtIo.write(nbt, (DataOutput) dataoutputstream); @@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } catch (Throwable throwable1) { throwable.addSuppressed(throwable1); } -@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable { +@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable { throw throwable; } @@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Paper start - Chunk save reattempt return; -@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable { +@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable { public RegionStorageInfo info() { return this.info; } diff --git a/patches/server/PlayerDeathEvent-getItemsToKeep.patch b/patches/server/PlayerDeathEvent-getItemsToKeep.patch index 5bc8cf6009..87acd74087 100644 --- a/patches/server/PlayerDeathEvent-getItemsToKeep.patch +++ b/patches/server/PlayerDeathEvent-getItemsToKeep.patch @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + for (int i = 0; i < inv.size(); ++i) { + ItemStack item = inv.get(i); -+ if (EnchantmentHelper.hasVanishingCurse(item) || itemsToKeep.isEmpty() || item.isEmpty()) { ++ if (EnchantmentHelper.has(item, EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP) || itemsToKeep.isEmpty() || item.isEmpty()) { + inv.set(i, ItemStack.EMPTY); + continue; + } diff --git a/patches/server/Sanitise-RegionFileCache-and-make-configurable.patch b/patches/server/Sanitise-RegionFileCache-and-make-configurable.patch index e2f67f1959..2e96ad8b88 100644 --- a/patches/server/Sanitise-RegionFileCache-and-make-configurable.patch +++ b/patches/server/Sanitise-RegionFileCache-and-make-configurable.patch @@ -14,7 +14,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSto index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable { +@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable { if (regionfile != null) { return regionfile; } else {