From 7be3024c75339c7a226060d9ae6f80221981c9d3 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Wed, 16 Jun 2021 15:57:49 -0700 Subject: [PATCH] update to Adventure 4.8.1 --- patches/api/0006-Adventure.patch | 4 ++-- patches/server/0010-Adventure.patch | 22 +++++++++++++++++-- ...e-attack-cooldown-methods-for-Player.patch | 4 ++-- ...-remove-from-being-called-on-Players.patch | 4 ++-- patches/server/0503-Brand-support.patch | 4 ++-- .../server/0626-Expose-Tracked-Players.patch | 4 ++-- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/patches/api/0006-Adventure.patch b/patches/api/0006-Adventure.patch index 5d255c4fc..2830f7dff 100644 --- a/patches/api/0006-Adventure.patch +++ b/patches/api/0006-Adventure.patch @@ -7,14 +7,14 @@ Co-authored-by: zml Co-authored-by: Jake Potrebic diff --git a/build.gradle.kts b/build.gradle.kts -index e4123d5f918a5f21b7f6fddba7084643f86ad5aa..176180570bf2705d975cf349faf08b5ba32cdab3 100644 +index e4123d5f918a5f21b7f6fddba7084643f86ad5aa..f4fc0aea0b965d786b7384dcb6634885527fd8da 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,6 +19,11 @@ dependencies { api("org.yaml:snakeyaml:1.29") api("com.googlecode.json-simple:json-simple:1.1.1") // Paper api("it.unimi.dsi:fastutil:8.2.2") -+ api(platform("net.kyori:adventure-bom:4.7.0")) ++ api(platform("net.kyori:adventure-bom:4.8.1")) + api("net.kyori:adventure-api") + api("net.kyori:adventure-text-serializer-gson") + api("net.kyori:adventure-text-serializer-legacy") diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index 2a66c5764..962d2c753 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -2038,7 +2038,7 @@ index d4ea706d5456e709b95e34be8220a0d39be2c8f4..2db149bf57c561d7f8f49341fbefafb5 player.initMenu(container); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 969d5071dbf3356b80da38526351d488ab936c08..e1e9319a67441bccf24b6a844036f3432c1cb86d 100644 +index 969d5071dbf3356b80da38526351d488ab936c08..2cb5427c441e50db23bb59da31654c4f2f218b85 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -244,14 +244,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2220,7 +2220,7 @@ index 969d5071dbf3356b80da38526351d488ab936c08..e1e9319a67441bccf24b6a844036f343 @Override public int getPing() { return this.getHandle().latency; -@@ -1727,6 +1798,138 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1727,6 +1798,156 @@ public class CraftPlayer extends CraftHumanEntity implements Player { getInventory().setItemInMainHand(hand); } @@ -2335,6 +2335,24 @@ index 969d5071dbf3356b80da38526351d488ab936c08..e1e9319a67441bccf24b6a844036f343 + } + + @Override ++ public void playSound(final net.kyori.adventure.sound.Sound sound, final net.kyori.adventure.sound.Sound.Emitter emitter) { ++ final Entity entity; ++ if (emitter == net.kyori.adventure.sound.Sound.Emitter.self()) { ++ entity = this.getHandle(); ++ } else if (emitter instanceof org.bukkit.entity.Entity) { ++ entity = ((CraftEntity) emitter).getHandle(); ++ } else { ++ throw new IllegalArgumentException("Sound emitter must be an Entity or self(), but was: " + emitter); ++ } ++ ++ final ResourceLocation name = io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.name()); ++ final java.util.Optional event = net.minecraft.core.Registry.SOUND_EVENT.getOptional(name); ++ if (event.isPresent()) { ++ this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSoundEntityPacket(event.get(), io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.source()), entity, sound.volume(), sound.pitch())); ++ } ++ } ++ ++ @Override + public void stopSound(final net.kyori.adventure.sound.SoundStop stop) { + this.getHandle().connection.send(new ClientboundStopSoundPacket( + io.papermc.paper.adventure.PaperAdventure.asVanillaNullable(stop.sound()), diff --git a/patches/server/0263-Expose-attack-cooldown-methods-for-Player.patch b/patches/server/0263-Expose-attack-cooldown-methods-for-Player.patch index 76adef714..049fbdf8c 100644 --- a/patches/server/0263-Expose-attack-cooldown-methods-for-Player.patch +++ b/patches/server/0263-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 b810ea97165d4a5e1f93cc6ca64c9bdbce740313..189e9ea6d40f560ec4e01c3c7cb71f7c2a89b442 100644 +index 63f3913815a49eb3e46e89382438cbc7826886ae..873852a77e5e62bd45912a73512edc6f02130349 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2212,6 +2212,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2230,6 +2230,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { connection.send(new net.minecraft.network.protocol.game.ClientboundOpenBookPacket(net.minecraft.world.InteractionHand.MAIN_HAND)); connection.send(new net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket(0, slot, inventory.getSelected())); } diff --git a/patches/server/0306-Block-Entity-remove-from-being-called-on-Players.patch b/patches/server/0306-Block-Entity-remove-from-being-called-on-Players.patch index 75e6d3623..a2bf3368e 100644 --- a/patches/server/0306-Block-Entity-remove-from-being-called-on-Players.patch +++ b/patches/server/0306-Block-Entity-remove-from-being-called-on-Players.patch @@ -12,10 +12,10 @@ Player we will look at limiting the scope of this change. It appears to be unintentional in the few cases we've seen so far. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 62ccb0aee9b80fd9dcfaf2dfa6abc68567221294..2b44b1137fb5795b778baeab84097f58cee4eab5 100644 +index a5772815211b2739b493f2547fae819b9d9b7a39..7887173102ec582740189882064f5610d952d205 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2259,6 +2259,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2277,6 +2277,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void resetCooldown() { getHandle().resetAttackStrengthTicker(); } diff --git a/patches/server/0503-Brand-support.patch b/patches/server/0503-Brand-support.patch index 359f9d54c..8a778d91a 100644 --- a/patches/server/0503-Brand-support.patch +++ b/patches/server/0503-Brand-support.patch @@ -72,10 +72,10 @@ index 003cd8a304420671d487c9e55622d9578aa75b3a..6caae980ab043b8d48479e0849e1e297 return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 443dcc97f8056df408b8abab6e71a6f5467c6aaf..a9e3687d145c15f218d83a2d10b151fd9e993868 100644 +index 160254615dac48af2af474c303b57dd293fb224b..99e35c68875ae807f406acd6f693f216fab749cd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2400,6 +2400,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2418,6 +2418,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // Paper end }; diff --git a/patches/server/0626-Expose-Tracked-Players.patch b/patches/server/0626-Expose-Tracked-Players.patch index 0e3b2f4fb..ecc989809 100644 --- a/patches/server/0626-Expose-Tracked-Players.patch +++ b/patches/server/0626-Expose-Tracked-Players.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose Tracked Players diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index bb79f5aedf79f42e4ae6c45faa9373a0e8c94159..ee40e03704bb8c6b3aa990542fc852058d00f081 100644 +index a28625f0b6e98b61f395a1b3ee07c2f7bc195893..e5a2fcd390ab5b41d7e482d486cef42a9eef94f5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2319,6 +2319,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2337,6 +2337,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } // Paper end