From 39ae9b75e9876b4091c21f98a886e31d6d3bb2db Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Mon, 12 Sep 2022 13:31:45 +0200 Subject: [PATCH] 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: 9ae3f10f SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API 48c0c547 PR-786: Add methods to get sounds from entities CraftBukkit Changes: 5cc9c022a SPIGOT-7152: Handle hand item changing during air interact event 4ffa1acf6 SPIGOT-7154: Players get kicked when interacting with a conversation 4daa21123 SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API e5d6a9bbf PR-1100: Add methods to get sounds from entities b7e9f1c8b SPIGOT-7146: Reduce use of Material switch in ItemMeta Spigot Changes: 4c157bb4 Rebuild patches --- patches/api/Fireworks-API-s.patch | 7 ++- patches/api/Left-handed-API.patch | 4 +- patches/api/Missing-Entity-Behavior-API.patch | 4 +- patches/api/Mob-Pathfinding-API.patch | 4 +- patches/api/More-Projectile-API.patch | 44 ++++++++++++++++++- patches/server/Add-ArmorStand-Item-Meta.patch | 4 +- patches/server/Add-missing-spawn-eggs.patch | 22 +++++----- patches/server/Adventure.patch | 12 ----- patches/server/Firework-API-s.patch | 8 +--- ...or-when-player-hand-set-to-empty-typ.patch | 23 ---------- patches/server/LivingEntity-setKiller.patch | 10 +---- .../server/Missing-Entity-Behavior-API.patch | 4 +- patches/server/More-Projectile-API.patch | 2 +- work/Bukkit | 2 +- work/CraftBukkit | 2 +- work/Spigot | 2 +- 16 files changed, 75 insertions(+), 79 deletions(-) delete mode 100644 patches/server/Fix-AssertionError-when-player-hand-set-to-empty-typ.patch diff --git a/patches/api/Fireworks-API-s.patch b/patches/api/Fireworks-API-s.patch index 13f1350920..0900780bc8 100644 --- a/patches/api/Fireworks-API-s.patch +++ b/patches/api/Fireworks-API-s.patch @@ -20,9 +20,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public java.util.UUID getSpawningEntity(); + /** + * If this firework is boosting an entity, return it ++ * @deprecated use {@link #getAttachedTo()} ++ * @see #setAttachedTo(LivingEntity) + * @return The entity being boosted + */ + @org.jetbrains.annotations.Nullable -+ public LivingEntity getBoostedEntity(); ++ @Deprecated ++ default LivingEntity getBoostedEntity() { ++ return getAttachedTo(); ++ } + // Paper end } diff --git a/patches/api/Left-handed-API.patch b/patches/api/Left-handed-API.patch index 00369aeadb..b1a1f49a27 100644 --- a/patches/api/Left-handed-API.patch +++ b/patches/api/Left-handed-API.patch @@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/Mob.java +++ b/src/main/java/org/bukkit/entity/Mob.java @@ -0,0 +0,0 @@ public interface Mob extends LivingEntity, Lootable { - * @return whether the mob is aware */ - public boolean isAware(); + @Nullable + public Sound getAmbientSound(); + + // Paper start + /** diff --git a/patches/api/Missing-Entity-Behavior-API.patch b/patches/api/Missing-Entity-Behavior-API.patch index 07e8cdbc87..0ae3bb2adb 100644 --- a/patches/api/Missing-Entity-Behavior-API.patch +++ b/patches/api/Missing-Entity-Behavior-API.patch @@ -424,9 +424,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/Raider.java +++ b/src/main/java/org/bukkit/entity/Raider.java @@ -0,0 +0,0 @@ public interface Raider extends Monster { - * @param join CanJoinRaid status */ - void setCanJoinRaid(boolean join); + @NotNull + Sound getCelebrationSound(); + + // Paper start + /** diff --git a/patches/api/Mob-Pathfinding-API.patch b/patches/api/Mob-Pathfinding-API.patch index 04b182c193..879218e116 100644 --- a/patches/api/Mob-Pathfinding-API.patch +++ b/patches/api/Mob-Pathfinding-API.patch @@ -233,9 +233,9 @@ diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Mob.java +++ b/src/main/java/org/bukkit/entity/Mob.java -@@ -0,0 +0,0 @@ - package org.bukkit.entity; +@@ -0,0 +0,0 @@ package org.bukkit.entity; + import org.bukkit.Sound; import org.bukkit.loot.Lootable; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/patches/api/More-Projectile-API.patch b/patches/api/More-Projectile-API.patch index 4048632d3f..65a655abcf 100644 --- a/patches/api/More-Projectile-API.patch +++ b/patches/api/More-Projectile-API.patch @@ -19,8 +19,48 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 * @param meta The FireworkMeta to apply */ @@ -0,0 +0,0 @@ public interface Firework extends Projectile { - @org.jetbrains.annotations.Nullable - public LivingEntity getBoostedEntity(); + * {@link #getMaxLife()}, the firework will detonate. + * + * @param ticks the ticks to set. Must be greater than or equal to 0 ++ * @deprecated use {@link #setTicksFlown(int)} + * @return true if the life was set, false if this firework has already detonated + */ ++ @Deprecated(forRemoval = true) // Paper + boolean setLife(int ticks); + + /** + * Get the ticks that this firework has been alive. When this value reaches + * {@link #getMaxLife()}, the firework will detonate. + * ++ * @deprecated use {@link #getTicksFlown()} + * @return the life ticks + */ ++ @Deprecated(forRemoval = true) // Paper + int getLife(); + + /** + * Set the time in ticks this firework will exist until it is detonated. + * + * @param ticks the ticks to set. Must be greater than 0 ++ * @deprecated use {@link #setTicksToDetonate(int)} + * @return true if the time was set, false if this firework has already detonated + */ ++ @Deprecated(forRemoval = true) // Paper + boolean setMaxLife(int ticks); + + /** + * Get the time in ticks this firework will exist until it is detonated. + * ++ * @deprecated use {@link #getTicksToDetonate()} + * @return the maximum life in ticks + */ ++ @Deprecated(forRemoval = true) // Paper + int getMaxLife(); + + /** +@@ -0,0 +0,0 @@ public interface Firework extends Projectile { + return getAttachedTo(); + } // Paper end + + // Paper start - Firework API diff --git a/patches/server/Add-ArmorStand-Item-Meta.patch b/patches/server/Add-ArmorStand-Item-Meta.patch index fa3812760c..b47c60952e 100644 --- a/patches/server/Add-ArmorStand-Item-Meta.patch +++ b/patches/server/Add-ArmorStand-Item-Meta.patch @@ -16,8 +16,8 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand. index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java -@@ -0,0 +0,0 @@ import org.bukkit.configuration.serialization.DelegateDeserialization; - import org.bukkit.craftbukkit.inventory.CraftMetaItem.ItemMetaKey; +@@ -0,0 +0,0 @@ import org.bukkit.Material; + import org.bukkit.configuration.serialization.DelegateDeserialization; @DelegateDeserialization(CraftMetaItem.SerializableMeta.class) -public class CraftMetaArmorStand extends CraftMetaItem { diff --git a/patches/server/Add-missing-spawn-eggs.patch b/patches/server/Add-missing-spawn-eggs.patch index 543f7ce1f4..73e9df7233 100644 --- a/patches/server/Add-missing-spawn-eggs.patch +++ b/patches/server/Add-missing-spawn-eggs.patch @@ -42,16 +42,16 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java -@@ -0,0 +0,0 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta { - case ZOMBIE_SPAWN_EGG: - case ZOMBIE_VILLAGER_SPAWN_EGG: - case ZOMBIFIED_PIGLIN_SPAWN_EGG: +@@ -0,0 +0,0 @@ import org.bukkit.material.MaterialData; + public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta { + + private static final Set SPAWN_EGG_MATERIALS = Sets.newHashSet( + // Paper start -+ case ALLAY_SPAWN_EGG: -+ case FROG_SPAWN_EGG: -+ case TADPOLE_SPAWN_EGG: -+ case WARDEN_SPAWN_EGG: ++ Material. ALLAY_SPAWN_EGG, ++ Material. FROG_SPAWN_EGG, ++ Material. TADPOLE_SPAWN_EGG, ++ Material. WARDEN_SPAWN_EGG, + // Paper end - return true; - default: - return false; + Material.AXOLOTL_SPAWN_EGG, + Material.BAT_SPAWN_EGG, + Material.BEE_SPAWN_EGG, diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index 1f973f573d..b0b67849eb 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -3848,18 +3848,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.util.ArrayList; import java.util.Arrays; import java.util.List; -@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.CraftChatMessage; - import org.bukkit.craftbukkit.util.CraftMagicNumbers; - import org.bukkit.inventory.meta.BookMeta; - import org.bukkit.inventory.meta.BookMeta.Generation; -+import org.checkerframework.checker.nullness.qual.NonNull; - - // Spigot start - import static org.spigotmc.ValidateUtils.*; -+ - import java.util.AbstractList; - import net.md_5.bungee.api.chat.BaseComponent; - import net.md_5.bungee.chat.ComponentSerializer; @@ -0,0 +0,0 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { this.generation = (generation == null) ? null : generation.ordinal(); } diff --git a/patches/server/Firework-API-s.patch b/patches/server/Firework-API-s.patch index 4fac7af404..326cc9a171 100644 --- a/patches/server/Firework-API-s.patch +++ b/patches/server/Firework-API-s.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { public int lifetime; @Nullable - public LivingEntity attachedToEntity; + public LivingEntity attachedToEntity; // PAIL private -> public + public java.util.UUID spawningEntity; // Paper public FireworkRocketEntity(EntityType type, Level world) { @@ -87,11 +87,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public java.util.UUID getSpawningEntity() { + return getHandle().spawningEntity; + } -+ -+ @Override -+ public org.bukkit.entity.LivingEntity getBoostedEntity() { -+ net.minecraft.world.entity.LivingEntity boostedEntity = getHandle().attachedToEntity; -+ return boostedEntity != null ? (org.bukkit.entity.LivingEntity) boostedEntity.getBukkitEntity() : null; -+ } + // Paper end } diff --git a/patches/server/Fix-AssertionError-when-player-hand-set-to-empty-typ.patch b/patches/server/Fix-AssertionError-when-player-hand-set-to-empty-typ.patch deleted file mode 100644 index 5948828b86..0000000000 --- a/patches/server/Fix-AssertionError-when-player-hand-set-to-empty-typ.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lukasz Derlatka -Date: Mon, 11 Nov 2019 16:08:13 +0100 -Subject: [PATCH] Fix AssertionError when player hand set to empty type - -Fixes an AssertionError when setting the player's item in hand to null or a new ItemStack of Air in PlayerInteractEvent -Fixes GH-2718 - -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524 - return; - } -+ // Paper start -+ itemstack = this.player.getItemInHand(enumhand); -+ if (itemstack.isEmpty()) return; -+ // Paper end - InteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand); - - if (enuminteractionresult.shouldSwing()) { diff --git a/patches/server/LivingEntity-setKiller.patch b/patches/server/LivingEntity-setKiller.patch index 38028d9151..18df3fabf1 100644 --- a/patches/server/LivingEntity-setKiller.patch +++ b/patches/server/LivingEntity-setKiller.patch @@ -8,14 +8,6 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -0,0 +0,0 @@ import java.util.Iterator; - import java.util.List; - import java.util.Set; - import java.util.UUID; -+import net.minecraft.server.level.ServerPlayer; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.effect.MobEffect; @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return this.getHandle().lastHurtByPlayer == null ? null : (Player) this.getHandle().lastHurtByPlayer.getBukkitEntity(); } @@ -23,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + @Override + public void setKiller(Player killer) { -+ ServerPlayer entityPlayer = killer == null ? null : ((CraftPlayer) killer).getHandle(); ++ net.minecraft.server.level.ServerPlayer entityPlayer = killer == null ? null : ((CraftPlayer) killer).getHandle(); + getHandle().lastHurtByPlayer = entityPlayer; + getHandle().lastHurtByMob = entityPlayer; + getHandle().lastHurtByPlayerTime = entityPlayer == null ? 0 : 100; // 100 value taken from EntityLiving#damageEntity diff --git a/patches/server/Missing-Entity-Behavior-API.patch b/patches/server/Missing-Entity-Behavior-API.patch index 34ff9d3ee9..ce853bfdef 100644 --- a/patches/server/Missing-Entity-Behavior-API.patch +++ b/patches/server/Missing-Entity-Behavior-API.patch @@ -451,8 +451,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java @@ -0,0 +0,0 @@ public abstract class CraftRaider extends CraftMonster implements Raider { - public void setCanJoinRaid(boolean join) { - this.getHandle().setCanJoinRaid(join); + public Sound getCelebrationSound() { + return CraftSound.getBukkit(this.getHandle().getCelebrateSound()); } + + // Paper start diff --git a/patches/server/More-Projectile-API.patch b/patches/server/More-Projectile-API.patch index f876925cb7..199fb4e7ec 100644 --- a/patches/server/More-Projectile-API.patch +++ b/patches/server/More-Projectile-API.patch @@ -91,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Copied from EntityFireworks constructor, update firework lifetime/power this.getHandle().lifetime = 10 * (1 + meta.getPower()) + this.random.nextInt(6) + this.random.nextInt(7); @@ -0,0 +0,0 @@ public class CraftFirework extends CraftProjectile implements Firework { - return boostedEntity != null ? (org.bukkit.entity.LivingEntity) boostedEntity.getBukkitEntity() : null; + return getHandle().spawningEntity; } // Paper end + // Paper start - Expose firework item directly + manually setting flight diff --git a/work/Bukkit b/work/Bukkit index 2683d76602..9ae3f10f8f 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 2683d766020628844637e800d4ec12fd19cc674a +Subproject commit 9ae3f10f8fa50a825af823131c468c36da3be880 diff --git a/work/CraftBukkit b/work/CraftBukkit index 5901d580a4..5cc9c022a0 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 5901d580a4902919b10fc23a07d40eda50497634 +Subproject commit 5cc9c022a0bd297f348d3c7e24e06227dca40c23 diff --git a/work/Spigot b/work/Spigot index e53686f7e0..4c157bb49a 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit e53686f7e0406156c8fa91a6e7748fbfed19c3a4 +Subproject commit 4c157bb49aa5705967b066e9c2dec5520f720b22