From 547f09dfa05da0c7b56d89cd27f8f2e47a953416 Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Fri, 14 Jun 2024 16:01:00 +0200 Subject: [PATCH] Some work on the ItemMend events --- ...4-Ability-to-apply-mending-to-XP-API.patch | 13 +++-- .../0177-Player.setPlayerProfile-API.patch | 12 ++--- ...82-Flag-to-disable-the-channel-limit.patch | 4 +- .../0209-InventoryCloseEvent-Reason-API.patch | 2 +- ...e-attack-cooldown-methods-for-Player.patch | 4 +- .../server/0244-Improve-death-events.patch | 4 +- ...-Replace-OfflinePlayer-getLastPlayed.patch | 8 +-- ...r-remove-if-the-handle-is-a-custom-p.patch | 2 +- ...-Implement-Player-Client-Options-API.patch | 2 +- patches/server/0396-Brand-support.patch | 4 +- ...r-spawnParticle-x-y-z-precision-loss.patch | 4 +- patches/server/0475-Add-sendOpLevel-API.patch | 2 +- ...537-Expand-PlayerGameModeChangeEvent.patch | 2 +- .../0549-Add-PlayerKickEvent-causes.patch | 2 +- .../server/0577-Add-PlayerSetSpawnEvent.patch | 2 +- ...ulti-Block-Change-API-Implementation.patch | 2 +- patches/server/0728-More-Teleport-API.patch | 2 +- ...stom-Chat-Completion-Suggestions-API.patch | 2 +- .../0759-Elder-Guardian-appearance-API.patch | 4 +- .../0772-Add-Player-Warden-Warning-API.patch | 4 +- patches/server/0785-fix-Instruments.patch | 2 +- patches/server/0795-Flying-Fall-Damage.patch | 4 +- patches/server/0800-Win-Screen-API.patch | 2 +- .../0825-Expand-PlayerItemMendEvent.patch | 54 +++++++++---------- ...0840-Call-missing-BlockDispenseEvent.patch | 2 +- patches/server/0845-Fix-BanList-API.patch | 2 +- ...enceOrb-should-call-EntitySpawnEvent.patch | 2 +- .../server/0864-Bandaid-fix-for-Effect.patch | 2 +- .../0872-Add-Listing-API-for-Player.patch | 6 +-- ...74-Add-BlockFace-to-BlockDamageEvent.patch | 2 +- ...-Implement-OfflinePlayer-isConnected.patch | 2 +- ...-titleOverride-to-InventoryOpenEvent.patch | 2 +- .../0902-Add-player-idle-duration-API.patch | 4 +- ...stack-for-Player-sendEquipmentChange.patch | 2 +- ...estore-vanilla-entity-drops-behavior.patch | 2 +- .../0925-Add-experience-points-API.patch | 4 +- .../0926-Add-drops-to-shear-events.patch | 2 +- .../server/0952-Fix-DamageSource-API.patch | 2 +- ...met-damage-reduction-inconsistencies.patch | 2 +- ...d-API-to-get-player-ha-proxy-address.patch | 2 +- 40 files changed, 91 insertions(+), 92 deletions(-) diff --git a/patches/server/0164-Ability-to-apply-mending-to-XP-API.patch b/patches/server/0164-Ability-to-apply-mending-to-XP-API.patch index 7a804ad0bd..fd8b647890 100644 --- a/patches/server/0164-Ability-to-apply-mending-to-XP-API.patch +++ b/patches/server/0164-Ability-to-apply-mending-to-XP-API.patch @@ -14,10 +14,10 @@ public net.minecraft.world.entity.ExperienceOrb durabilityToXp(I)I public net.minecraft.world.entity.ExperienceOrb xpToDurability(I)I diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 9eddc3ac16645e0a01cc5c2decc8e53f08e7e3dc..44529bfbf7ee1b03bc1f35c0f536fa36dd72b5d4 100644 +index 9eddc3ac16645e0a01cc5c2decc8e53f08e7e3dc..aaef5693b044141d2aa8108b74b240903c64e6e6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1637,7 +1637,38 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1637,7 +1637,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } @Override @@ -36,12 +36,15 @@ index 9eddc3ac16645e0a01cc5c2decc8e53f08e7e3dc..44529bfbf7ee1b03bc1f35c0f536fa36 + orb.spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM; + orb.setPosRaw(handle.getX(), handle.getY(), handle.getZ()); + -+ int i = Math.min(orb.xpToDurability(amount), itemstack.getDamageValue()); -+ org.bukkit.event.player.PlayerItemMendEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemMendEvent(handle, orb, itemstack, stackEntry.getKey(), i); ++ final int possibleDurabilityFromXp = net.minecraft.world.item.enchantment.EnchantmentHelper.modifyDurabilityToRepairFromXp( ++ handle.serverLevel(), itemstack, amount ++ ); ++ int i = Math.min(possibleDurabilityFromXp, itemstack.getDamageValue()); ++ org.bukkit.event.player.PlayerItemMendEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemMendEvent(handle, orb, itemstack, stackEntry.get().inSlot(), i); + i = event.getRepairAmount(); + orb.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); + if (!event.isCancelled()) { -+ amount -= orb.durabilityToXp(i); ++ amount -= i * amount / possibleDurabilityFromXp; + itemstack.setDamageValue(itemstack.getDamageValue() - i); + } + } diff --git a/patches/server/0177-Player.setPlayerProfile-API.patch b/patches/server/0177-Player.setPlayerProfile-API.patch index ffb458d18e..aae29e9a5f 100644 --- a/patches/server/0177-Player.setPlayerProfile-API.patch +++ b/patches/server/0177-Player.setPlayerProfile-API.patch @@ -77,7 +77,7 @@ index 818df09e9245b5d89b4180b1eaa51470b7539341..461656e1cb095243bfe7a9ee2906e5b0 public Server getServer() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 44529bfbf7ee1b03bc1f35c0f536fa36dd72b5d4..4220223a7282ab5588234497ef2d34128107676a 100644 +index aaef5693b044141d2aa8108b74b240903c64e6e6..a6567aa9a3ec9dd17689e907131e5cca05da7c9d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -249,11 +249,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -92,7 +92,7 @@ index 44529bfbf7ee1b03bc1f35c0f536fa36dd72b5d4..4220223a7282ab5588234497ef2d3412 @Override public InetSocketAddress getAddress() { if (this.getHandle().connection.protocol() == null) return null; -@@ -1788,8 +1783,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1791,8 +1786,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { private void untrackAndHideEntity(org.bukkit.entity.Entity entity) { // Remove this entity from the hidden player's EntityTrackerEntry @@ -109,7 +109,7 @@ index 44529bfbf7ee1b03bc1f35c0f536fa36dd72b5d4..4220223a7282ab5588234497ef2d3412 ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId()); if (entry != null) { entry.removePlayer(this.getHandle()); -@@ -1802,8 +1804,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1805,8 +1807,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().connection.send(new ClientboundPlayerInfoRemovePacket(List.of(otherPlayer.getUUID()))); } } @@ -118,7 +118,7 @@ index 44529bfbf7ee1b03bc1f35c0f536fa36dd72b5d4..4220223a7282ab5588234497ef2d3412 } void resetAndHideEntity(org.bukkit.entity.Entity entity) { -@@ -1868,12 +1868,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1871,12 +1871,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } private void trackAndShowEntity(org.bukkit.entity.Entity entity) { @@ -144,7 +144,7 @@ index 44529bfbf7ee1b03bc1f35c0f536fa36dd72b5d4..4220223a7282ab5588234497ef2d3412 } ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId()); -@@ -1883,6 +1896,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1886,6 +1899,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity)); } @@ -184,7 +184,7 @@ index 44529bfbf7ee1b03bc1f35c0f536fa36dd72b5d4..4220223a7282ab5588234497ef2d3412 void resetAndShowEntity(org.bukkit.entity.Entity entity) { // SPIGOT-7312: Can't show/hide self -@@ -1894,6 +1940,34 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1897,6 +1943,34 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.trackAndShowEntity(entity); } } diff --git a/patches/server/0182-Flag-to-disable-the-channel-limit.patch b/patches/server/0182-Flag-to-disable-the-channel-limit.patch index c1e62974c3..eb219a5de1 100644 --- a/patches/server/0182-Flag-to-disable-the-channel-limit.patch +++ b/patches/server/0182-Flag-to-disable-the-channel-limit.patch @@ -9,7 +9,7 @@ e.g. servers which allow and support the usage of mod packs. provide an optional flag to disable this check, at your own risk. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 4220223a7282ab5588234497ef2d34128107676a..0c182241125d9583a4956eb5f05969243aa35acb 100644 +index a6567aa9a3ec9dd17689e907131e5cca05da7c9d..27298cd0558b1ff2ab2ca341d62da2922507414b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -209,6 +209,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -20,7 +20,7 @@ index 4220223a7282ab5588234497ef2d34128107676a..0c182241125d9583a4956eb5f0596924 public CraftPlayer(CraftServer server, ServerPlayer entity) { super(server, entity); -@@ -2265,7 +2266,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2268,7 +2269,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void addChannel(String channel) { diff --git a/patches/server/0209-InventoryCloseEvent-Reason-API.patch b/patches/server/0209-InventoryCloseEvent-Reason-API.patch index 9113d05db6..838f24a751 100644 --- a/patches/server/0209-InventoryCloseEvent-Reason-API.patch +++ b/patches/server/0209-InventoryCloseEvent-Reason-API.patch @@ -165,7 +165,7 @@ index dd3377a4f69e5ac10905e52d0eecc2427e72d856..c79607a2f45b7a487a95cf98b9b0eb6b @Override public boolean isBlocking() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 0c182241125d9583a4956eb5f05969243aa35acb..a02bae1c51bd6583dfb2bdb07cc589827e3092ac 100644 +index 27298cd0558b1ff2ab2ca341d62da2922507414b..38bc1747d2010b9233c64de81eb1c042bd1357b5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1273,7 +1273,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0243-Expose-attack-cooldown-methods-for-Player.patch b/patches/server/0243-Expose-attack-cooldown-methods-for-Player.patch index e170e19ee3..36c48b1dd1 100644 --- a/patches/server/0243-Expose-attack-cooldown-methods-for-Player.patch +++ b/patches/server/0243-Expose-attack-cooldown-methods-for-Player.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose attack cooldown methods for Player diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a02bae1c51bd6583dfb2bdb07cc589827e3092ac..55ccca419524fa74e8978962371d695b42b50d51 100644 +index 38bc1747d2010b9233c64de81eb1c042bd1357b5..c0b92358c03d1724e8c134563f9ca98e69081c6a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2976,6 +2976,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2979,6 +2979,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return this.adventure$pointers; } diff --git a/patches/server/0244-Improve-death-events.patch b/patches/server/0244-Improve-death-events.patch index 5eacc67caa..a2242da65c 100644 --- a/patches/server/0244-Improve-death-events.patch +++ b/patches/server/0244-Improve-death-events.patch @@ -423,10 +423,10 @@ index ee3902cbada46ffb78c42dbf6f00c859546c76e1..92bb0c63330ad3a4cb13b2dc65502071 // CraftBukkit end this.gameEvent(GameEvent.ENTITY_DIE); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 55ccca419524fa74e8978962371d695b42b50d51..0fb6c7b63ac15db4921e7c52f98c9070f403e4f3 100644 +index c0b92358c03d1724e8c134563f9ca98e69081c6a..a33fc9288165ec013cef6b90d72871f0058c0857 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2513,7 +2513,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2516,7 +2516,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void sendHealthUpdate() { FoodData foodData = this.getHandle().getFoodData(); diff --git a/patches/server/0273-Replace-OfflinePlayer-getLastPlayed.patch b/patches/server/0273-Replace-OfflinePlayer-getLastPlayed.patch index e59fe138f2..65dd0a1d0f 100644 --- a/patches/server/0273-Replace-OfflinePlayer-getLastPlayed.patch +++ b/patches/server/0273-Replace-OfflinePlayer-getLastPlayed.patch @@ -106,7 +106,7 @@ index 461656e1cb095243bfe7a9ee2906e5b00574ae78..411b280ac3e27e72091db813c0c9b69b public Location getLastDeathLocation() { if (this.getData().contains("LastDeathLocation", 10)) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 0fb6c7b63ac15db4921e7c52f98c9070f403e4f3..e5a3d0aa6e800007caea6b0c2ceffa473a40d080 100644 +index a33fc9288165ec013cef6b90d72871f0058c0857..d649fd886faf0d4d989362c4ef0e9c50247c280f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -210,6 +210,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -117,7 +117,7 @@ index 0fb6c7b63ac15db4921e7c52f98c9070f403e4f3..e5a3d0aa6e800007caea6b0c2ceffa47 public CraftPlayer(CraftServer server, ServerPlayer entity) { super(server, entity); -@@ -2045,6 +2046,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2048,6 +2049,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.firstPlayed = firstPlayed; } @@ -136,7 +136,7 @@ index 0fb6c7b63ac15db4921e7c52f98c9070f403e4f3..e5a3d0aa6e800007caea6b0c2ceffa47 public void readExtraData(CompoundTag nbttagcompound) { this.hasPlayedBefore = true; if (nbttagcompound.contains("bukkit")) { -@@ -2067,6 +2080,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2070,6 +2083,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void setExtraData(CompoundTag nbttagcompound) { @@ -145,7 +145,7 @@ index 0fb6c7b63ac15db4921e7c52f98c9070f403e4f3..e5a3d0aa6e800007caea6b0c2ceffa47 if (!nbttagcompound.contains("bukkit")) { nbttagcompound.put("bukkit", new CompoundTag()); } -@@ -2081,6 +2096,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2084,6 +2099,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { data.putLong("firstPlayed", this.getFirstPlayed()); data.putLong("lastPlayed", System.currentTimeMillis()); data.putString("lastKnownName", handle.getScoreboardName()); diff --git a/patches/server/0275-Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch b/patches/server/0275-Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch index 9efe57e203..7dd2139e2c 100644 --- a/patches/server/0275-Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch +++ b/patches/server/0275-Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch @@ -8,7 +8,7 @@ We just add a check to ensure that the CraftPlayer's handle is a ServerPlayer diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e5a3d0aa6e800007caea6b0c2ceffa473a40d080..70b1acee956247e80f7afdbe7cb91ff01a00af81 100644 +index d649fd886faf0d4d989362c4ef0e9c50247c280f..a32a3e8aa5108f28f7bda637c50627afb59f7598 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -224,8 +224,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0344-Implement-Player-Client-Options-API.patch b/patches/server/0344-Implement-Player-Client-Options-API.patch index ee28bb7991..9f6f9f80b8 100644 --- a/patches/server/0344-Implement-Player-Client-Options-API.patch +++ b/patches/server/0344-Implement-Player-Client-Options-API.patch @@ -136,7 +136,7 @@ index a5291e17ab08d1ceeca0bb73f4c8fe433fcbd536..8110cdcdcf9513a71caae38abd235b69 this.adventure$locale = java.util.Objects.requireNonNullElse(net.kyori.adventure.translation.Translator.parseLocale(this.language), java.util.Locale.US); // Paper this.requestedViewDistance = clientOptions.viewDistance(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 70b1acee956247e80f7afdbe7cb91ff01a00af81..490724ddb5fda7c7f0e1ba10d9be1457e3c51a53 100644 +index a32a3e8aa5108f28f7bda637c50627afb59f7598..8865dabc729af78fcc306d48e754c54f80dfb2e4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -653,6 +653,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0396-Brand-support.patch b/patches/server/0396-Brand-support.patch index 383881834a..7b80e9b402 100644 --- a/patches/server/0396-Brand-support.patch +++ b/patches/server/0396-Brand-support.patch @@ -57,10 +57,10 @@ index 2d1fad00ee084841618f0da8113c7aac8c0e2b0d..a3c67bdc2c08b3550534f37d15b0db90 } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 490724ddb5fda7c7f0e1ba10d9be1457e3c51a53..cbcca58a88b383435b949e0ee3e284635afcb5f1 100644 +index 8865dabc729af78fcc306d48e754c54f80dfb2e4..74e40e74f95d366b508d6e746f3ed2710ab0613a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -3135,6 +3135,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3138,6 +3138,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // Paper end }; diff --git a/patches/server/0438-Fix-Player-spawnParticle-x-y-z-precision-loss.patch b/patches/server/0438-Fix-Player-spawnParticle-x-y-z-precision-loss.patch index 64b4f85775..bb0bf54468 100644 --- a/patches/server/0438-Fix-Player-spawnParticle-x-y-z-precision-loss.patch +++ b/patches/server/0438-Fix-Player-spawnParticle-x-y-z-precision-loss.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix Player spawnParticle x/y/z precision loss diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index cbcca58a88b383435b949e0ee3e284635afcb5f1..057206959ba3f05bb4baad5ab5b1bd420dcf607b 100644 +index 74e40e74f95d366b508d6e746f3ed2710ab0613a..803a1d9350276c44eef622436cc4026460436ae7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2703,7 +2703,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2706,7 +2706,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) { diff --git a/patches/server/0475-Add-sendOpLevel-API.patch b/patches/server/0475-Add-sendOpLevel-API.patch index bae2137a16..c97ae56aab 100644 --- a/patches/server/0475-Add-sendOpLevel-API.patch +++ b/patches/server/0475-Add-sendOpLevel-API.patch @@ -32,7 +32,7 @@ index 5a709e301b336ee2fc62b422a2f3d878b81f9743..f9ecdb537b7cbf4a97888a88a61686d9 public boolean isWhiteListed(GameProfile profile) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 057206959ba3f05bb4baad5ab5b1bd420dcf607b..f74a2808699824a4911363b9ab07eb4a93d8d111 100644 +index 803a1d9350276c44eef622436cc4026460436ae7..6924bf3fad82cd055523af835a83aa0ca3490625 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -677,6 +677,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0537-Expand-PlayerGameModeChangeEvent.patch b/patches/server/0537-Expand-PlayerGameModeChangeEvent.patch index 82712c2770..dfcacf1e1c 100644 --- a/patches/server/0537-Expand-PlayerGameModeChangeEvent.patch +++ b/patches/server/0537-Expand-PlayerGameModeChangeEvent.patch @@ -147,7 +147,7 @@ index 756be0985dad9cd52394ec0144be20d1d34f9d7a..644cf792a1d04b8674d54be627f1fafc } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index f74a2808699824a4911363b9ab07eb4a93d8d111..d1c224a21aa707f4e2876d2dd70dbab767cd3afd 100644 +index 6924bf3fad82cd055523af835a83aa0ca3490625..868c6f5ee5d67b92ad5834e05f9f1795cca879db 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1653,7 +1653,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0549-Add-PlayerKickEvent-causes.patch b/patches/server/0549-Add-PlayerKickEvent-causes.patch index eb487705f4..654ca5ee4e 100644 --- a/patches/server/0549-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0549-Add-PlayerKickEvent-causes.patch @@ -480,7 +480,7 @@ index f472dea0bd4f834c0c8f0aa59ae7cdae082b14af..2fa51c3a70f43cd23b8f494fc643d66c } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d1c224a21aa707f4e2876d2dd70dbab767cd3afd..9f9d6eb6f0d3f51b32a8232a16cd784268d2764a 100644 +index 868c6f5ee5d67b92ad5834e05f9f1795cca879db..c8a4677db69b0f4111d550ca457b9196e7acebdd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -635,7 +635,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0577-Add-PlayerSetSpawnEvent.patch b/patches/server/0577-Add-PlayerSetSpawnEvent.patch index 21164d6d40..7473661836 100644 --- a/patches/server/0577-Add-PlayerSetSpawnEvent.patch +++ b/patches/server/0577-Add-PlayerSetSpawnEvent.patch @@ -187,7 +187,7 @@ index ba22ad1e4253477572d10d71db6db0ebc14d6755..94d067e9eeee73183de25165d8c97043 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 9f9d6eb6f0d3f51b32a8232a16cd784268d2764a..fe22b3e26498cb08cac1e461b6cb23b181788fb9 100644 +index c8a4677db69b0f4111d550ca457b9196e7acebdd..d22990a2e7a1fcaf6e1f2d2f4856bd9b4b25aadb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1412,9 +1412,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0660-Multi-Block-Change-API-Implementation.patch b/patches/server/0660-Multi-Block-Change-API-Implementation.patch index 66c5449365..52d9d21721 100644 --- a/patches/server/0660-Multi-Block-Change-API-Implementation.patch +++ b/patches/server/0660-Multi-Block-Change-API-Implementation.patch @@ -24,7 +24,7 @@ index 926ff9be3d9e3f5d620e4c7ccb22b9f64865ff8c..1a37654aff9a9c86c9f7af10a1cf7213 buf.writeLong(this.sectionPos.asLong()); buf.writeVarInt(this.positions.length); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index fe22b3e26498cb08cac1e461b6cb23b181788fb9..f39c5c8e99671b6d36ffe118fa9d912eae72e7fc 100644 +index d22990a2e7a1fcaf6e1f2d2f4856bd9b4b25aadb..240b00ac76d299994129724372d899427c9604c7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -930,6 +930,32 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0728-More-Teleport-API.patch b/patches/server/0728-More-Teleport-API.patch index a25d78f96d..4fe9942d06 100644 --- a/patches/server/0728-More-Teleport-API.patch +++ b/patches/server/0728-More-Teleport-API.patch @@ -112,7 +112,7 @@ index 47f24e390efd8eb4cb7f62b5203825f4160772b7..243ac4253a1541dba52126bad96682e4 private final org.bukkit.entity.Entity.Spigot spigot = new org.bukkit.entity.Entity.Spigot() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index f39c5c8e99671b6d36ffe118fa9d912eae72e7fc..2951da226070e04b8bd28e1a2165db74321ebf87 100644 +index 240b00ac76d299994129724372d899427c9604c7..d0005af63d4ae0081a39797cb62c5ff3e2efa537 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1286,13 +1286,101 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0733-Custom-Chat-Completion-Suggestions-API.patch b/patches/server/0733-Custom-Chat-Completion-Suggestions-API.patch index 063aa866fb..839ee2255a 100644 --- a/patches/server/0733-Custom-Chat-Completion-Suggestions-API.patch +++ b/patches/server/0733-Custom-Chat-Completion-Suggestions-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Custom Chat Completion Suggestions API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 2951da226070e04b8bd28e1a2165db74321ebf87..4fe0a41729a07b3a36b81652f17f53e781850026 100644 +index d0005af63d4ae0081a39797cb62c5ff3e2efa537..bffb3c029e917ccfc4b092a5d213a4d0f7a42ce4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -691,6 +691,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0759-Elder-Guardian-appearance-API.patch b/patches/server/0759-Elder-Guardian-appearance-API.patch index 29219766fe..05ac7bf793 100644 --- a/patches/server/0759-Elder-Guardian-appearance-API.patch +++ b/patches/server/0759-Elder-Guardian-appearance-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Elder Guardian appearance API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 4fe0a41729a07b3a36b81652f17f53e781850026..27358c55ce2dcaeba41deac4b1bc1913ae95b8e3 100644 +index bffb3c029e917ccfc4b092a5d213a4d0f7a42ce4..daa4aad117a6cf5f1e4e6da245e5c346122ac324 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -3294,6 +3294,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3297,6 +3297,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } // Paper end diff --git a/patches/server/0772-Add-Player-Warden-Warning-API.patch b/patches/server/0772-Add-Player-Warden-Warning-API.patch index 2325910c59..48110ad056 100644 --- a/patches/server/0772-Add-Player-Warden-Warning-API.patch +++ b/patches/server/0772-Add-Player-Warden-Warning-API.patch @@ -10,10 +10,10 @@ public net.minecraft.world.entity.monster.warden.WardenSpawnTracker cooldownTick public net.minecraft.world.entity.monster.warden.WardenSpawnTracker increaseWarningLevel()V diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 27358c55ce2dcaeba41deac4b1bc1913ae95b8e3..688fd24b4b43117173d034d1bcf2ffa2e08e4d1c 100644 +index daa4aad117a6cf5f1e4e6da245e5c346122ac324..90ce5c386d46f10e14df67953938168c29d24c6a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -3299,6 +3299,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3302,6 +3302,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void showElderGuardian(boolean silent) { if (getHandle().connection != null) getHandle().connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.GUARDIAN_ELDER_EFFECT, silent ? 0F : 1F)); } diff --git a/patches/server/0785-fix-Instruments.patch b/patches/server/0785-fix-Instruments.patch index 60e0478cd1..a77e5ed5f6 100644 --- a/patches/server/0785-fix-Instruments.patch +++ b/patches/server/0785-fix-Instruments.patch @@ -6,7 +6,7 @@ Subject: [PATCH] fix Instruments properly handle Player#playNote diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 688fd24b4b43117173d034d1bcf2ffa2e08e4d1c..869377713260cbaccf8cbcc98ef225d62f381495 100644 +index 90ce5c386d46f10e14df67953938168c29d24c6a..6503bce4c0281619489adc01fa1da0c59b433875 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -768,7 +768,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0795-Flying-Fall-Damage.patch b/patches/server/0795-Flying-Fall-Damage.patch index b8509d547e..021a59a960 100644 --- a/patches/server/0795-Flying-Fall-Damage.patch +++ b/patches/server/0795-Flying-Fall-Damage.patch @@ -26,10 +26,10 @@ index 4ff41cc3e2ff69c6f0c3cd7be3e22d6948010599..9706b0df7d0c617a181ba9f78b010e2e } else { if (fallDistance >= 2.0F) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 869377713260cbaccf8cbcc98ef225d62f381495..38929c8a5e5304e9719c44fb7ac3353359a56602 100644 +index 6503bce4c0281619489adc01fa1da0c59b433875..207e72cad59a07c0750e9303dd21519c83ab2358 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2577,6 +2577,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2580,6 +2580,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().onUpdateAbilities(); } diff --git a/patches/server/0800-Win-Screen-API.patch b/patches/server/0800-Win-Screen-API.patch index de8f6cbf6f..6fb9c91a90 100644 --- a/patches/server/0800-Win-Screen-API.patch +++ b/patches/server/0800-Win-Screen-API.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Win Screen API public net.minecraft.server.level.ServerPlayer seenCredits diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 38929c8a5e5304e9719c44fb7ac3353359a56602..850994ea4e9eccb573ab7b6de1fac5edcbe8bbda 100644 +index 207e72cad59a07c0750e9303dd21519c83ab2358..ee5d93cd0c7ea7376e8488265d4e21610edeedc2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1305,6 +1305,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0825-Expand-PlayerItemMendEvent.patch b/patches/server/0825-Expand-PlayerItemMendEvent.patch index 3c890f081f..819c2181a8 100644 --- a/patches/server/0825-Expand-PlayerItemMendEvent.patch +++ b/patches/server/0825-Expand-PlayerItemMendEvent.patch @@ -5,55 +5,51 @@ Subject: [PATCH] Expand PlayerItemMendEvent diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index a758b2456acac23095fe4619ae10300a034cb460..8eacfbc45f68fb01926c3e6363641dfbfd3eb16f 100644 +index a758b2456acac23095fe4619ae10300a034cb460..15844971ce2cca8c679ad3aaa2dfe160e6d0b564 100644 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -@@ -351,19 +351,19 @@ public class ExperienceOrb extends Entity { - - if (optional.isPresent()) { - ItemStack itemstack = ((EnchantedItemInUse) optional.get()).itemStack(); -- int j = EnchantmentHelper.modifyDurabilityToRepairFromXp(player.serverLevel(), itemstack, amount); -- int k = Math.min(j, itemstack.getDamageValue()); -+ int j = EnchantmentHelper.modifyDurabilityToRepairFromXp(player.serverLevel(), itemstack, amount);; int xpTranslatedToDurability = j; // Paper - mending event - obfhelper -+ int k = Math.min(j, itemstack.getDamageValue()); int durabilityToAddBack = k; // Paper - mending event - obfhelper +@@ -354,7 +354,10 @@ public class ExperienceOrb extends Entity { + int j = EnchantmentHelper.modifyDurabilityToRepairFromXp(player.serverLevel(), itemstack, amount); + int k = Math.min(j, itemstack.getDamageValue()); // CraftBukkit start - org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(player, this, itemstack, optional.get().inSlot(), k); -- k = event.getRepairAmount(); -+ org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(player, this, itemstack, optional.get().inSlot(), durabilityToAddBack, d -> d * amount / xpTranslatedToDurability); // Paper - Expand PlayerItemMendEvent -+ durabilityToAddBack = event.getRepairAmount(); // Paper - mending event - obfhelper ++ // Paper start - mending event ++ final int consumedExperience = k * amount / j; ++ org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(player, this, itemstack, optional.get().inSlot(), k, consumedExperience); ++ // Paper end - mending event + k = event.getRepairAmount(); if (event.isCancelled()) { return amount; - } - // CraftBukkit end +@@ -363,7 +366,7 @@ public class ExperienceOrb extends Entity { -- itemstack.setDamageValue(itemstack.getDamageValue() - k); -+ itemstack.setDamageValue(itemstack.getDamageValue() - durabilityToAddBack); // Paper - mending event - obfhelper + itemstack.setDamageValue(itemstack.getDamageValue() - k); if (k > 0) { - int l = amount - k * amount / j; -+ int l = amount - event.getDurabilityToXpOperation().applyAsInt(durabilityToAddBack); // Paper - mending event - obfhelper ++ int l = amount - k * amount / j; // Paper - diff on change - expand PlayerMendEvents if (l > 0) { // this.value = l; // CraftBukkit - update exp value of orb for PlayerItemMendEvent calls // Paper - the value field should not be mutated here because it doesn't take "count" into account diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 850994ea4e9eccb573ab7b6de1fac5edcbe8bbda..ea1171ed7442feaea488a02a8cbe3e3019c409c0 100644 +index ee5d93cd0c7ea7376e8488265d4e21610edeedc2..e84337b01ec7e5c530a4c6042b9386385eb58446 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1849,11 +1849,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - orb.setPosRaw(handle.getX(), handle.getY(), handle.getZ()); - - int i = Math.min(orb.xpToDurability(amount), itemstack.getDamageValue()); -- org.bukkit.event.player.PlayerItemMendEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemMendEvent(handle, orb, itemstack, stackEntry.getKey(), i); -+ org.bukkit.event.player.PlayerItemMendEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemMendEvent(handle, orb, itemstack, stackEntry.get().inSlot(), i, orb::durabilityToXp); // Paper - Expand PlayerItemMendEvent +@@ -1852,11 +1852,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + handle.serverLevel(), itemstack, amount + ); + int i = Math.min(possibleDurabilityFromXp, itemstack.getDamageValue()); +- org.bukkit.event.player.PlayerItemMendEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemMendEvent(handle, orb, itemstack, stackEntry.get().inSlot(), i); ++ final int consumedExperience = i * amount / possibleDurabilityFromXp; // Paper - taken from ExperienceOrb#repairPlayerItems ++ org.bukkit.event.player.PlayerItemMendEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemMendEvent(handle, orb, itemstack, stackEntry.get().inSlot(), i, consumedExperience); i = event.getRepairAmount(); orb.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); if (!event.isCancelled()) { -- amount -= orb.durabilityToXp(i); -+ amount -= event.getDurabilityToXpOperation().applyAsInt(i); // Paper - Expand PlayerItemMendEvent +- amount -= i * amount / possibleDurabilityFromXp; ++ amount -= consumedExperience; // Use previously computed variable to reduce diff on change. itemstack.setDamageValue(itemstack.getDamageValue() - i); } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 7fa64d9081ce54d91eb7631c7d8623ed11d9954b..c59bb1811dba49571bbb82b17a75ab2363531996 100644 +index 7fa64d9081ce54d91eb7631c7d8623ed11d9954b..5a6f954e0d01253cf861ae16c6055744d07acdb9 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1265,10 +1265,10 @@ public class CraftEventFactory { @@ -61,11 +57,11 @@ index 7fa64d9081ce54d91eb7631c7d8623ed11d9954b..c59bb1811dba49571bbb82b17a75ab23 } - public static PlayerItemMendEvent callPlayerItemMendEvent(net.minecraft.world.entity.player.Player entity, net.minecraft.world.entity.ExperienceOrb orb, net.minecraft.world.item.ItemStack nmsMendedItem, net.minecraft.world.entity.EquipmentSlot slot, int repairAmount) { -+ public static PlayerItemMendEvent callPlayerItemMendEvent(net.minecraft.world.entity.player.Player entity, net.minecraft.world.entity.ExperienceOrb orb, net.minecraft.world.item.ItemStack nmsMendedItem, net.minecraft.world.entity.EquipmentSlot slot, int repairAmount, java.util.function.IntUnaryOperator durabilityToXpOp) { // Paper - Expand PlayerItemMendEvent ++ public static PlayerItemMendEvent callPlayerItemMendEvent(net.minecraft.world.entity.player.Player entity, net.minecraft.world.entity.ExperienceOrb orb, net.minecraft.world.item.ItemStack nmsMendedItem, net.minecraft.world.entity.EquipmentSlot slot, int repairAmount, int consumedExperience) { // Paper - Expand PlayerItemMendEvent Player player = (Player) entity.getBukkitEntity(); org.bukkit.inventory.ItemStack bukkitStack = CraftItemStack.asCraftMirror(nmsMendedItem); - PlayerItemMendEvent event = new PlayerItemMendEvent(player, bukkitStack, CraftEquipmentSlot.getSlot(slot), (ExperienceOrb) orb.getBukkitEntity(), repairAmount); -+ PlayerItemMendEvent event = new PlayerItemMendEvent(player, bukkitStack, CraftEquipmentSlot.getSlot(slot), (ExperienceOrb) orb.getBukkitEntity(), repairAmount, durabilityToXpOp); // Paper - Expand PlayerItemMendEvent ++ PlayerItemMendEvent event = new PlayerItemMendEvent(player, bukkitStack, CraftEquipmentSlot.getSlot(slot), (ExperienceOrb) orb.getBukkitEntity(), repairAmount, consumedExperience); // Paper - Expand PlayerItemMendEvent Bukkit.getPluginManager().callEvent(event); return event; } diff --git a/patches/server/0840-Call-missing-BlockDispenseEvent.patch b/patches/server/0840-Call-missing-BlockDispenseEvent.patch index da4b09af57..3554c7ea2c 100644 --- a/patches/server/0840-Call-missing-BlockDispenseEvent.patch +++ b/patches/server/0840-Call-missing-BlockDispenseEvent.patch @@ -50,7 +50,7 @@ index 96db0b1041a4c0f054d4f3f2bdced960b119664e..78951f50188528718cdb3dbbaabe3f9f for (int k = 0; k < 5; ++k) { worldserver.sendParticles(ParticleTypes.SPLASH, (double) blockposition.getX() + worldserver.random.nextDouble(), (double) (blockposition.getY() + 1), (double) blockposition.getZ() + worldserver.random.nextDouble(), 1, 0.0D, 0.0D, 0.0D, 1.0D); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index c59bb1811dba49571bbb82b17a75ab2363531996..30aa65060a8039d9b2f52c776bab27304dc97f8e 100644 +index 5a6f954e0d01253cf861ae16c6055744d07acdb9..370672a22ce1fdf7eb9708cce8d25e8d0687b07a 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -2127,6 +2127,32 @@ public class CraftEventFactory { diff --git a/patches/server/0845-Fix-BanList-API.patch b/patches/server/0845-Fix-BanList-API.patch index 9f158d149c..dcc17ccb44 100644 --- a/patches/server/0845-Fix-BanList-API.patch +++ b/patches/server/0845-Fix-BanList-API.patch @@ -208,7 +208,7 @@ index 172202accf4448a933fcf1ff820316c7910dd7f7..50ee7656580d386db473c054f5c5ec57 return null; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index ea1171ed7442feaea488a02a8cbe3e3019c409c0..7ab19653310daf43900ec34def0b1930d12ce542 100644 +index e84337b01ec7e5c530a4c6042b9386385eb58446..85f403c07ff146a0da232ac7bfc0551a2fa2601b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1746,23 +1746,23 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0849-ExperienceOrb-should-call-EntitySpawnEvent.patch b/patches/server/0849-ExperienceOrb-should-call-EntitySpawnEvent.patch index 000f4cb95b..b1aa9b3fb6 100644 --- a/patches/server/0849-ExperienceOrb-should-call-EntitySpawnEvent.patch +++ b/patches/server/0849-ExperienceOrb-should-call-EntitySpawnEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] ExperienceOrb should call EntitySpawnEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 30aa65060a8039d9b2f52c776bab27304dc97f8e..2f2b09b2b9bd8730b83ade4d7da996b3b6696e0a 100644 +index 370672a22ce1fdf7eb9708cce8d25e8d0687b07a..68541f68d884a2d4d35af6dd62dc9062c3758056 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -736,7 +736,8 @@ public class CraftEventFactory { diff --git a/patches/server/0864-Bandaid-fix-for-Effect.patch b/patches/server/0864-Bandaid-fix-for-Effect.patch index b05a66d209..cf863d7311 100644 --- a/patches/server/0864-Bandaid-fix-for-Effect.patch +++ b/patches/server/0864-Bandaid-fix-for-Effect.patch @@ -81,7 +81,7 @@ index 38a24517e30007d3077b48b8b0401c8c361710ca..7927b702f8ce1e170f96a8150c5a7641 // Special case: the axis is optional for ELECTRIC_SPARK Preconditions.checkArgument(effect.getData() == null || effect == Effect.ELECTRIC_SPARK, "Wrong kind of data for the %s effect", effect); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 7ab19653310daf43900ec34def0b1930d12ce542..62de0a48329d75855466cab5499b72ec09a872a6 100644 +index 85f403c07ff146a0da232ac7bfc0551a2fa2601b..296bb88ed34f499535ef0b9fdffa67b7de81c60b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -917,7 +917,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0872-Add-Listing-API-for-Player.patch b/patches/server/0872-Add-Listing-API-for-Player.patch index 4cdf0f279a..bf35caf426 100644 --- a/patches/server/0872-Add-Listing-API-for-Player.patch +++ b/patches/server/0872-Add-Listing-API-for-Player.patch @@ -119,7 +119,7 @@ index b2fab1e6a83b2603aeb8565b25022f9e99a61029..8ba99f6ef2b50ceb8e279ed559a375ad // Paper end - Use single player info update packet on join player.sentListPacket = true; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 62de0a48329d75855466cab5499b72ec09a872a6..1e660aa6039ed6065b2d5ccfe2c04930651e3b86 100644 +index 296bb88ed34f499535ef0b9fdffa67b7de81c60b..e4de4ed09b20ed224eadcbc6d650192897c4def5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -201,6 +201,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -130,7 +130,7 @@ index 62de0a48329d75855466cab5499b72ec09a872a6..1e660aa6039ed6065b2d5ccfe2c04930 private static final WeakHashMap> pluginWeakReferences = new WeakHashMap<>(); private int hash = 0; private double health = 20; -@@ -2087,7 +2088,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2091,7 +2092,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { otherPlayer.setUUID(uuidOverride); } // Paper end @@ -139,7 +139,7 @@ index 62de0a48329d75855466cab5499b72ec09a872a6..1e660aa6039ed6065b2d5ccfe2c04930 if (original != null) otherPlayer.setUUID(original); // Paper - uuid override } -@@ -2191,6 +2192,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2195,6 +2196,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return (entity != null) ? this.canSee(entity) : false; // If we can't find it, we can't see it } diff --git a/patches/server/0874-Add-BlockFace-to-BlockDamageEvent.patch b/patches/server/0874-Add-BlockFace-to-BlockDamageEvent.patch index efbc14f784..23d09a65d0 100644 --- a/patches/server/0874-Add-BlockFace-to-BlockDamageEvent.patch +++ b/patches/server/0874-Add-BlockFace-to-BlockDamageEvent.patch @@ -18,7 +18,7 @@ index c680f081ba548f84f07a968a46811090c53e57e3..d839f8df658c894f144ba4637d290ffb if (blockEvent.isCancelled()) { // Let the client know the block still exists diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 2f2b09b2b9bd8730b83ade4d7da996b3b6696e0a..69e191d4394e1b22fdf4ba817cb2ec0ae3805414 100644 +index 68541f68d884a2d4d35af6dd62dc9062c3758056..913e36497098aa8f6c17d7ec22b7780e6653f30c 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -651,13 +651,13 @@ public class CraftEventFactory { diff --git a/patches/server/0882-Implement-OfflinePlayer-isConnected.patch b/patches/server/0882-Implement-OfflinePlayer-isConnected.patch index abd75b44c5..f0ac88e8c8 100644 --- a/patches/server/0882-Implement-OfflinePlayer-isConnected.patch +++ b/patches/server/0882-Implement-OfflinePlayer-isConnected.patch @@ -23,7 +23,7 @@ index 4d654c4f0b6210a9841427789ba70ce5d1d308be..9d93130f23addb18b97d7f5ec013faef public String getName() { Player player = this.getPlayer(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 1e660aa6039ed6065b2d5ccfe2c04930651e3b86..7ad3a0605be9d89bf7618f2ed8767fdebf25a178 100644 +index e4de4ed09b20ed224eadcbc6d650192897c4def5..d5757fa3d4254535448eb040593c8c23995b7bc9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -256,6 +256,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0884-Add-titleOverride-to-InventoryOpenEvent.patch b/patches/server/0884-Add-titleOverride-to-InventoryOpenEvent.patch index f238f3db79..f333a3a97e 100644 --- a/patches/server/0884-Add-titleOverride-to-InventoryOpenEvent.patch +++ b/patches/server/0884-Add-titleOverride-to-InventoryOpenEvent.patch @@ -79,7 +79,7 @@ index 3d36d79a4e7f16f6face3465cdf54656984f3ebc..41f3cdec7deabf34358b8087df77169f if (!player.isImmobile()) player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper - Prevent opening inventories when frozen player.containerMenu = container; diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 69e191d4394e1b22fdf4ba817cb2ec0ae3805414..70f5a07206453124e7069bb013184038b4def654 100644 +index 913e36497098aa8f6c17d7ec22b7780e6653f30c..eee1261127e47ed0250ecb2d8b77993bb8730fc6 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1382,10 +1382,21 @@ public class CraftEventFactory { diff --git a/patches/server/0902-Add-player-idle-duration-API.patch b/patches/server/0902-Add-player-idle-duration-API.patch index 97ef3281a4..e9d6bf10c6 100644 --- a/patches/server/0902-Add-player-idle-duration-API.patch +++ b/patches/server/0902-Add-player-idle-duration-API.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add player idle duration API Implements API for getting and resetting a player's idle duration. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 7ad3a0605be9d89bf7618f2ed8767fdebf25a178..651d59330fdbdaf2bdeab5795808ceaabc3dbddb 100644 +index d5757fa3d4254535448eb040593c8c23995b7bc9..141b79346d6826a5fcea04f2d65506448cbed254 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -3414,6 +3414,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3418,6 +3418,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } // Paper end diff --git a/patches/server/0905-Allow-null-itemstack-for-Player-sendEquipmentChange.patch b/patches/server/0905-Allow-null-itemstack-for-Player-sendEquipmentChange.patch index 8bc6f2ccca..10e1013d26 100644 --- a/patches/server/0905-Allow-null-itemstack-for-Player-sendEquipmentChange.patch +++ b/patches/server/0905-Allow-null-itemstack-for-Player-sendEquipmentChange.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow null itemstack for Player#sendEquipmentChange diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 651d59330fdbdaf2bdeab5795808ceaabc3dbddb..bb2c41e56b6913c9564e0eac99182cc9c2ea4be4 100644 +index 141b79346d6826a5fcea04f2d65506448cbed254..c24f27206dea30b99f2c5b80d8e011b7bc2233e8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1127,7 +1127,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0920-Restore-vanilla-entity-drops-behavior.patch b/patches/server/0920-Restore-vanilla-entity-drops-behavior.patch index 258b8c23f3..05cd7d4c0b 100644 --- a/patches/server/0920-Restore-vanilla-entity-drops-behavior.patch +++ b/patches/server/0920-Restore-vanilla-entity-drops-behavior.patch @@ -165,7 +165,7 @@ index 5bcb9a53ebebeef4bd6ec2458df4b63002ebd804..2f398750bfee5758ad8b1367b6fc1436 } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 70f5a07206453124e7069bb013184038b4def654..54c9c19d773df01b0004da6587f7c7a388e61c21 100644 +index eee1261127e47ed0250ecb2d8b77993bb8730fc6..2821ad7116b4606a09eab86de63474b85dceaafe 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -965,18 +965,24 @@ public class CraftEventFactory { diff --git a/patches/server/0925-Add-experience-points-API.patch b/patches/server/0925-Add-experience-points-API.patch index c3e7bd7755..9844f2f32a 100644 --- a/patches/server/0925-Add-experience-points-API.patch +++ b/patches/server/0925-Add-experience-points-API.patch @@ -18,10 +18,10 @@ index 9706b0df7d0c617a181ba9f78b010e2e58c84454..a77c2847a3bc161f0bf25eb4c78305ce // Paper start - send while respecting visibility private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index bb2c41e56b6913c9564e0eac99182cc9c2ea4be4..ee937b6b6ee1e4b2fcedd7b200a749ded169eea4 100644 +index c24f27206dea30b99f2c5b80d8e011b7bc2233e8..4a886f11b10395143879e1c1795afc269eed109d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1916,6 +1916,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1920,6 +1920,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player { Preconditions.checkArgument(exp >= 0, "Total experience points must not be negative (%s)", exp); this.getHandle().totalExperience = exp; } diff --git a/patches/server/0926-Add-drops-to-shear-events.patch b/patches/server/0926-Add-drops-to-shear-events.patch index fad646e19c..d756f848f4 100644 --- a/patches/server/0926-Add-drops-to-shear-events.patch +++ b/patches/server/0926-Add-drops-to-shear-events.patch @@ -275,7 +275,7 @@ index 8420d75865b86e1d8afea2527b5521cac184e8b1..6e290d67b00c88ecd2cf2ce5f612f52e public boolean readyForShearing() { return !this.isSheared() && this.isAlive(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 54c9c19d773df01b0004da6587f7c7a388e61c21..a4ea5d942eb61ee733eb1b8b4a3c50fb93f037ea 100644 +index 2821ad7116b4606a09eab86de63474b85dceaafe..bab47ffad0ae43bfed2b1866a2b1a562f9503c9f 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1667,20 +1667,20 @@ public class CraftEventFactory { diff --git a/patches/server/0952-Fix-DamageSource-API.patch b/patches/server/0952-Fix-DamageSource-API.patch index 483d163cac..6720fac75d 100644 --- a/patches/server/0952-Fix-DamageSource-API.patch +++ b/patches/server/0952-Fix-DamageSource-API.patch @@ -197,7 +197,7 @@ index 4c6e15535fa40aad8cf1920f392589404f9ba79c..35eb95ef6fb6a0f7ea63351e90741c48 } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index a4ea5d942eb61ee733eb1b8b4a3c50fb93f037ea..0b1741cd68d5066114a35cc14ed08b57f4f08fb2 100644 +index bab47ffad0ae43bfed2b1866a2b1a562f9503c9f..867450afbdbcd43a9daa6894ae22d0479cd11714 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1085,7 +1085,7 @@ public class CraftEventFactory { diff --git a/patches/server/0968-Fix-helmet-damage-reduction-inconsistencies.patch b/patches/server/0968-Fix-helmet-damage-reduction-inconsistencies.patch index 1eecc61d78..8d0cdbdf72 100644 --- a/patches/server/0968-Fix-helmet-damage-reduction-inconsistencies.patch +++ b/patches/server/0968-Fix-helmet-damage-reduction-inconsistencies.patch @@ -7,7 +7,7 @@ Affect the falling stalactite damage type where the reduction is not applied like in Vanilla diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 0b1741cd68d5066114a35cc14ed08b57f4f08fb2..f769f249ada432ee400055deabdb5e4aeaa88c05 100644 +index 867450afbdbcd43a9daa6894ae22d0479cd11714..042f6ec4372121fcb755504a64a1746055eb667a 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1213,7 +1213,7 @@ public class CraftEventFactory { diff --git a/patches/server/0973-Added-API-to-get-player-ha-proxy-address.patch b/patches/server/0973-Added-API-to-get-player-ha-proxy-address.patch index b4ce94348c..5ef4bac68c 100644 --- a/patches/server/0973-Added-API-to-get-player-ha-proxy-address.patch +++ b/patches/server/0973-Added-API-to-get-player-ha-proxy-address.patch @@ -35,7 +35,7 @@ index 96355e1da8feb6687ea0069dda4a82fcd7e25e8a..1f696644b958538e9f5d568a2e4bba69 } else { super.channelRead(ctx, msg); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index ee937b6b6ee1e4b2fcedd7b200a749ded169eea4..7aa8da8be9007e2c5037a27f53d25037693ed45c 100644 +index 4a886f11b10395143879e1c1795afc269eed109d..67a715a812d700df912834874107078255d7c695 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -275,6 +275,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {