update to Adventure 4.8.1

This commit is contained in:
Jake Potrebic 2021-06-16 15:57:49 -07:00
parent cd8f24d472
commit 7be3024c75
No known key found for this signature in database
GPG Key ID: 7C58557EC9C421F8
6 changed files with 30 additions and 12 deletions

View File

@ -7,14 +7,14 @@ Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index e4123d5f918a5f21b7f6fddba7084643f86ad5aa..176180570bf2705d975cf349faf08b5ba32cdab3 100644 index e4123d5f918a5f21b7f6fddba7084643f86ad5aa..f4fc0aea0b965d786b7384dcb6634885527fd8da 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -19,6 +19,11 @@ dependencies { @@ -19,6 +19,11 @@ dependencies {
api("org.yaml:snakeyaml:1.29") api("org.yaml:snakeyaml:1.29")
api("com.googlecode.json-simple:json-simple:1.1.1") // Paper api("com.googlecode.json-simple:json-simple:1.1.1") // Paper
api("it.unimi.dsi:fastutil:8.2.2") 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-api")
+ api("net.kyori:adventure-text-serializer-gson") + api("net.kyori:adventure-text-serializer-gson")
+ api("net.kyori:adventure-text-serializer-legacy") + api("net.kyori:adventure-text-serializer-legacy")

View File

@ -2038,7 +2038,7 @@ index d4ea706d5456e709b95e34be8220a0d39be2c8f4..2db149bf57c561d7f8f49341fbefafb5
player.initMenu(container); 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 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 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/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 { @@ -244,14 +244,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -2220,7 +2220,7 @@ index 969d5071dbf3356b80da38526351d488ab936c08..e1e9319a67441bccf24b6a844036f343
@Override @Override
public int getPing() { public int getPing() {
return this.getHandle().latency; 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); getInventory().setItemInMainHand(hand);
} }
@ -2335,6 +2335,24 @@ index 969d5071dbf3356b80da38526351d488ab936c08..e1e9319a67441bccf24b6a844036f343
+ } + }
+ +
+ @Override + @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<net.minecraft.sounds.SoundEvent> 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) { + public void stopSound(final net.kyori.adventure.sound.SoundStop stop) {
+ this.getHandle().connection.send(new ClientboundStopSoundPacket( + this.getHandle().connection.send(new ClientboundStopSoundPacket(
+ io.papermc.paper.adventure.PaperAdventure.asVanillaNullable(stop.sound()), + io.papermc.paper.adventure.PaperAdventure.asVanillaNullable(stop.sound()),

View File

@ -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 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 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/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.ClientboundOpenBookPacket(net.minecraft.world.InteractionHand.MAIN_HAND));
connection.send(new net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket(0, slot, inventory.getSelected())); connection.send(new net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket(0, slot, inventory.getSelected()));
} }

View File

@ -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. 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 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 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/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() { public void resetCooldown() {
getHandle().resetAttackStrengthTicker(); getHandle().resetAttackStrengthTicker();
} }

View File

@ -72,10 +72,10 @@ index 003cd8a304420671d487c9e55622d9578aa75b3a..6caae980ab043b8d48479e0849e1e297
return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper 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 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 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/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 // Paper end
}; };

View File

@ -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 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 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/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 // Paper end