Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 11:00:06 +01:00
Update adventure (#8625)
Dieser Commit ist enthalten in:
Ursprung
53eb820c6b
Commit
df1f4ac26d
@ -7,14 +7,14 @@ Co-authored-by: zml <zml@stellardrift.ca>
|
||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index c2928c6f2d54de0ffde164fd9407085cf9fa18a6..ab62ed5c6767d0a858583af795018a82c94d2fc3 100644
|
||||
index c2928c6f2d54de0ffde164fd9407085cf9fa18a6..c9f9174a085174b96897c013e0ecb79738c2e9e3 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -8,17 +8,37 @@ java {
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
+val adventureVersion = "4.11.0"
|
||||
+val adventureVersion = "4.12.0"
|
||||
+val apiAndDocs: Configuration by configurations.creating {
|
||||
+ attributes {
|
||||
+ attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
|
||||
|
@ -3179,7 +3179,7 @@ index 446fdca49a5a6999626a7ee3a1d5c168b15a09dd..f9863e138994f6c7a7975a852f106faa
|
||||
public boolean isOp() {
|
||||
return true;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index d2be98416529aea3bdbedd0ea7131bd8de2a0162..e12b4ec0d14901a0246cfea16c65fb046c7a4f6c 100644
|
||||
index d2be98416529aea3bdbedd0ea7131bd8de2a0162..6c316c969e87d9da047cd80c15d5579f7f65d1a5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -277,14 +277,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@ -3405,7 +3405,7 @@ index d2be98416529aea3bdbedd0ea7131bd8de2a0162..e12b4ec0d14901a0246cfea16c65fb04
|
||||
@Override
|
||||
public int getPing() {
|
||||
return this.getHandle().latency;
|
||||
@@ -1955,6 +2048,193 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1955,6 +2048,250 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return this.getHandle().allowsListing();
|
||||
}
|
||||
|
||||
@ -3422,6 +3422,54 @@ index d2be98416529aea3bdbedd0ea7131bd8de2a0162..e12b4ec0d14901a0246cfea16c65fb04
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void deleteMessage(net.kyori.adventure.chat.SignedMessage.Signature signature) {
|
||||
+ if (getHandle().connection == null) return;
|
||||
+ net.minecraft.network.chat.MessageSignature sig = new net.minecraft.network.chat.MessageSignature(signature.bytes());
|
||||
+
|
||||
+ this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundDeleteChatPacket(new net.minecraft.network.chat.MessageSignature.Packed(sig)));
|
||||
+ }
|
||||
+
|
||||
+ private net.minecraft.network.chat.ChatType.Bound toHandle(net.kyori.adventure.chat.ChatType.Bound boundChatType) {
|
||||
+ net.minecraft.core.Registry<net.minecraft.network.chat.ChatType> chatTypeRegistry = this.getHandle().level.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.CHAT_TYPE);
|
||||
+
|
||||
+ return new net.minecraft.network.chat.ChatType.Bound(
|
||||
+ chatTypeRegistry.get(io.papermc.paper.adventure.PaperAdventure.asVanilla(boundChatType.type().key())),
|
||||
+ io.papermc.paper.adventure.PaperAdventure.asVanilla(boundChatType.name()),
|
||||
+ io.papermc.paper.adventure.PaperAdventure.asVanilla(boundChatType.target())
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendMessage(net.kyori.adventure.text.Component message, net.kyori.adventure.chat.ChatType.Bound boundChatType) {
|
||||
+ if (getHandle().connection == null) return;
|
||||
+
|
||||
+ net.minecraft.network.chat.Component component = io.papermc.paper.adventure.PaperAdventure.asVanilla(message);
|
||||
+ this.getHandle().sendChatMessage(new net.minecraft.network.chat.OutgoingChatMessage.Disguised(component), this.getHandle().isTextFilteringEnabled(), this.toHandle(boundChatType));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendMessage(net.kyori.adventure.chat.SignedMessage signedMessage, net.kyori.adventure.chat.ChatType.Bound boundChatType) {
|
||||
+ if (getHandle().connection == null) return;
|
||||
+
|
||||
+ net.kyori.adventure.text.Component message = signedMessage.unsignedContent() == null ? net.kyori.adventure.text.Component.text(signedMessage.message()) : signedMessage.unsignedContent();
|
||||
+ if (signedMessage.isSystem()) {
|
||||
+ this.sendMessage(message, boundChatType);
|
||||
+ } else {
|
||||
+ super.sendMessage(signedMessage, boundChatType);
|
||||
+ }
|
||||
+// net.minecraft.network.chat.PlayerChatMessage playerChatMessage = new net.minecraft.network.chat.PlayerChatMessage(
|
||||
+// null, // TODO:
|
||||
+// new net.minecraft.network.chat.MessageSignature(signedMessage.signature().bytes()),
|
||||
+// null, // TODO
|
||||
+// io.papermc.paper.adventure.PaperAdventure.asVanilla(signedMessage.unsignedContent()),
|
||||
+// net.minecraft.network.chat.FilterMask.PASS_THROUGH
|
||||
+// );
|
||||
+//
|
||||
+// this.getHandle().sendChatMessage(net.minecraft.network.chat.OutgoingChatMessage.create(playerChatMessage), this.getHandle().isTextFilteringEnabled(), this.toHandle(boundChatType));
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated(forRemoval = true)
|
||||
+ @Override
|
||||
+ public void sendMessage(final net.kyori.adventure.identity.Identity identity, final net.kyori.adventure.text.Component message, final net.kyori.adventure.audience.MessageType type) {
|
||||
+ if (getHandle().connection == null) return;
|
||||
+ final net.minecraft.core.Registry<net.minecraft.network.chat.ChatType> chatTypeRegistry = this.getHandle().level.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.CHAT_TYPE);
|
||||
@ -3530,13 +3578,18 @@ index d2be98416529aea3bdbedd0ea7131bd8de2a0162..e12b4ec0d14901a0246cfea16c65fb04
|
||||
+
|
||||
+ @Override
|
||||
+ public void playSound(final net.kyori.adventure.sound.Sound sound, final double x, final double y, final double z) {
|
||||
+ final long seed = sound.seed().orElseGet(this.getHandle().getRandom()::nextLong);
|
||||
+ final ResourceLocation name = io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.name());
|
||||
+ final java.util.Optional<net.minecraft.sounds.SoundEvent> event = BuiltInRegistries.SOUND_EVENT.getOptional(name);
|
||||
+
|
||||
+ final Holder<SoundEvent> soundHolder;
|
||||
+ if (event.isPresent()) {
|
||||
+ this.getHandle().connection.send(new ClientboundSoundEntityPacket(BuiltInRegistries.SOUND_EVENT.wrapAsHolder(event.get()), io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.source()), entity, sound.volume(), sound.pitch(), this.getHandle().getRandom().nextLong())); // TODO adventure sound seed
|
||||
+ soundHolder = BuiltInRegistries.SOUND_EVENT.wrapAsHolder(event.get());
|
||||
+ } else {
|
||||
+ this.getHandle().connection.send(new ClientboundSoundPacket(Holder.direct(SoundEvent.createVariableRangeEvent(name)), io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.source()), x, y, z, sound.volume(), sound.pitch(), this.getHandle().getRandom().nextLong())); // TODO adventure sound seed
|
||||
+ soundHolder = Holder.direct(SoundEvent.createVariableRangeEvent(name));
|
||||
+ }
|
||||
+
|
||||
+ this.getHandle().connection.send(new ClientboundSoundPacket(soundHolder, io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.source()), x, y, z, sound.volume(), sound.pitch(), seed));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -3549,14 +3602,18 @@ index d2be98416529aea3bdbedd0ea7131bd8de2a0162..e12b4ec0d14901a0246cfea16c65fb04
|
||||
+ } else {
|
||||
+ throw new IllegalArgumentException("Sound emitter must be an Entity or self(), but was: " + emitter);
|
||||
+ }
|
||||
+ final long seed = sound.seed().orElseGet(this.getHandle().getRandom()::nextLong);
|
||||
+
|
||||
+ final ResourceLocation name = io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.name());
|
||||
+ final java.util.Optional<net.minecraft.sounds.SoundEvent> event = BuiltInRegistries.SOUND_EVENT.getOptional(name);
|
||||
+ final Holder<SoundEvent> soundHolder;
|
||||
+ if (event.isPresent()) {
|
||||
+ this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSoundEntityPacket(BuiltInRegistries.SOUND_EVENT.wrapAsHolder(event.get()), io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.source()), entity, sound.volume(), sound.pitch(), this.getHandle().getRandom().nextLong())); // TODO adventure sound seed
|
||||
+ soundHolder = BuiltInRegistries.SOUND_EVENT.wrapAsHolder(event.get());
|
||||
+ } else {
|
||||
+ this.getHandle().connection.send(new ClientboundSoundPacket(Holder.direct(SoundEvent.createVariableRangeEvent(name)), io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.source()), entity.position().x(), entity.position().y(), entity.position().z(), sound.volume(), sound.pitch(), this.getHandle().getRandom().nextLong())); // TODO adventure sound seed
|
||||
+ soundHolder = Holder.direct(SoundEvent.createVariableRangeEvent(name));
|
||||
+ }
|
||||
+
|
||||
+ this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSoundEntityPacket(soundHolder, io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.source()), entity, sound.volume(), sound.pitch(), seed));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -997,7 +997,7 @@ index 11006df8797334da69801cdb9aa34b0f941cf90d..5e5c4de89784db702256ee765091e929
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 51ef894462df15f8a4b9ac6d69fb522a6e77db4e..87c60bf2795bec8cbd579957695eb23971143f30 100644
|
||||
index ae69c14943bd93ca948789ad4d4da899a7505a60..cb1387a18f4306829c75b07a73195b54dbe63ad0 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1,8 +1,10 @@
|
||||
@ -1262,7 +1262,7 @@ index 8784b0702f10eb7582c309c15f18fe13eebd9c8e..6f81aa6b0a835bf10e0d5f2b32fe9fb2
|
||||
this.entityManager.saveAll();
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 340e7da85506b79be154bfea1445c6d2b4feefcc..45c12d663330f166000db326c8a145b6af9e2c46 100644
|
||||
index 91a0b7923b5a39a7de5d7899002ec4cd4a987a47..b383b5d21f6fd06f0825838aad51047211bc8148 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -335,7 +335,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@ -1816,10 +1816,10 @@ index b0ffa23faf62629043dfd613315eaf9c5fcc2cfe..00000000000000000000000000000000
|
||||
- }
|
||||
-}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index e12b4ec0d14901a0246cfea16c65fb046c7a4f6c..091346c2cbe7f7cf0173072343f796afe2a0f4c5 100644
|
||||
index cfc2636b939f7590e2f31c551dc397dfe2e98188..70d02af76c65379f0dd9d2800d7327d68e93f3d1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2321,6 +2321,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2378,6 +2378,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
CraftPlayer.this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(components, position == net.md_5.bungee.api.ChatMessageType.ACTION_BAR));
|
||||
}
|
||||
|
@ -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 e5b32af97f045f52c92dcd8f56af1508c54db490..8c528f32ef3a5e97ff14bd299a1f6e93b1a8a9af 100644
|
||||
index 00cabbfb53b4b1b427a9483332a5ffdb8172fd6b..6a8494e8b49094a3235b25415a02014ff6c71b33 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2591,6 +2591,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2648,6 +2648,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
return this.adventure$pointers;
|
||||
}
|
||||
|
@ -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 7e4cdc2ff30bd85e2ddd271f7b0a531100fdce36..b9e484ec8173be94fae307830e87a9205e56a11e 100644
|
||||
index fc468d79fb18fdc5e06aedb51868ac94c1979c11..4fe360a8ac16a30f696b6e09e5e056dfa18256d7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2638,6 +2638,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2695,6 +2695,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void resetCooldown() {
|
||||
getHandle().resetAttackStrengthTicker();
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Brand support
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index f440d9446d738429e33ed1fa9fa495af67f6427a..8eeb521b11062ecc699813c2132f7edf655d8d09 100644
|
||||
index 508a6e062de1994f26393d33e8b41ea245e0c3d0..40423a24eac6675c8b9ddb843c910e324709ebe4 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -298,6 +298,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@ -56,10 +56,10 @@ index f440d9446d738429e33ed1fa9fa495af67f6427a..8eeb521b11062ecc699813c2132f7edf
|
||||
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 d9e278d2f7f4bc767c0211736817748d4ca6dae0..60e8e82a1fc255aa713808a78ae2dc73ef0b6be3 100644
|
||||
index 5741795405d302aadbf4c10caabd40797557e102..e61402856dbf5c394724101e513438587b5583c9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2766,6 +2766,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2823,6 +2823,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
// Paper end
|
||||
};
|
||||
|
||||
|
@ -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 a511e41a1bba469a3d21f758f6e363bd95ecc49c..6082d9279505f518100bc88e011e433d69d95897 100644
|
||||
index e3da648ce9d5e2fb2b6737b6fd217ade042a0cbc..4e76dbec9ded8b866c85bea86b2349f15db13094 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2938,6 +2938,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2995,6 +2995,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
|
@ -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 6082d9279505f518100bc88e011e433d69d95897..de6e79180f242a006310adad40b041f5ac6a2a3f 100644
|
||||
index 4e76dbec9ded8b866c85bea86b2349f15db13094..5c56dbb485b3e7a9c67353c0a9bc3dadfcda29be 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2943,6 +2943,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -3000,6 +3000,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));
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren