3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 02:50:09 +01:00

fix #5526 - use correct type when sending message to clients

Dieser Commit ist enthalten in:
Riley Park 2021-04-21 18:31:45 -07:00
Ursprung dbfa833ec5
Commit 6574d1aa82
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: D831AF236C834E45
10 geänderte Dateien mit 36 neuen und 27 gelöschten Zeilen

Datei anzeigen

@ -105,10 +105,10 @@ index 0000000000000000000000000000000000000000..89597b4a3064c3c6001c7e927a848ee7
+}
diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
new file mode 100644
index 0000000000000000000000000000000000000000..75c36e772be93c9808cd8b72410ad8baa3d47006
index 0000000000000000000000000000000000000000..84dcca67ccd2e52881b4a97de0f061b396ab5f35
--- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
@@ -0,0 +1,214 @@
@@ -0,0 +1,215 @@
+package io.papermc.paper.adventure;
+
+import io.papermc.paper.chat.ChatComposer;
@ -124,6 +124,7 @@ index 0000000000000000000000000000000000000000..75c36e772be93c9808cd8b72410ad8ba
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.TextReplacementConfig;
+import net.kyori.adventure.text.event.ClickEvent;
+import net.minecraft.network.chat.ChatMessageType;
+import net.minecraft.network.chat.IChatBaseComponent;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.EntityPlayer;
@ -271,7 +272,7 @@ index 0000000000000000000000000000000000000000..75c36e772be93c9808cd8b72410ad8ba
+ if (((LazyPlayerSet) event.recipients()).isLazy()) {
+ final IChatBaseComponent vanilla = PaperAdventure.asVanilla(message);
+ for (final EntityPlayer recipient : this.server.getPlayerList().players) {
+ recipient.sendMessage(vanilla, this.player.getUniqueID());
+ recipient.sendMessage(vanilla, ChatMessageType.CHAT, this.player.getUniqueID());
+ }
+ } else {
+ for (final Player recipient : event.recipients()) {
@ -1132,7 +1133,7 @@ index 9c44a3d9273afaf4d35f4ff86727386b34d9eb06..fff22c40ba38575951e8e4821ade22b2
}
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index e818bf022b74cae34a512d8c98b47ec3e5c74b9a..0ff92d701d6ee5ce56eec624eece11de15195b41 100644
index e818bf022b74cae34a512d8c98b47ec3e5c74b9a..bb309790dc90aedabb3c48ea21cd87d1819d2261 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -143,6 +143,7 @@ import net.minecraft.world.item.enchantment.EnchantmentManager;
@ -1187,7 +1188,15 @@ index e818bf022b74cae34a512d8c98b47ec3e5c74b9a..0ff92d701d6ee5ce56eec624eece11de
this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> {
if (!future.isSuccess()) {
@@ -1682,6 +1679,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1660,6 +1657,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.a(ichatbasecomponent, ChatMessageType.SYSTEM, uuid);
}
+ public void sendMessage(final IChatBaseComponent message, final ChatMessageType type, final UUID sender) { this.a(message, type, sender); } // Paper - OBFHELPER
public void a(IChatBaseComponent ichatbasecomponent, ChatMessageType chatmessagetype, UUID uuid) {
this.playerConnection.a((Packet) (new PacketPlayOutChat(ichatbasecomponent, chatmessagetype, uuid)), (future) -> {
if (!future.isSuccess() && (chatmessagetype == ChatMessageType.GAME_INFO || chatmessagetype == ChatMessageType.SYSTEM)) {
@@ -1682,6 +1680,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public String locale = "en_us"; // CraftBukkit - add, lowercase
@ -1195,7 +1204,7 @@ index e818bf022b74cae34a512d8c98b47ec3e5c74b9a..0ff92d701d6ee5ce56eec624eece11de
public void a(PacketPlayInSettings packetplayinsettings) {
// CraftBukkit start
if (getMainHand() != packetplayinsettings.getMainHand()) {
@@ -1693,6 +1691,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1693,6 +1692,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.server.server.getPluginManager().callEvent(event);
}
this.locale = packetplayinsettings.locale;

Datei anzeigen

@ -26,10 +26,10 @@ index db2dddd12f54e6d15916c4cee623676541de37fb..1942f5224aaebb18adb591d6f70a419c
+ }
}
diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
index 75c36e772be93c9808cd8b72410ad8baa3d47006..636c60c7a8d674150fad0579c642cd037debde28 100644
index 84dcca67ccd2e52881b4a97de0f061b396ab5f35..b9bdf74e02f414ac0cf265f37b8a7883cab4fdd0 100644
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
@@ -16,7 +16,11 @@ import net.kyori.adventure.text.event.ClickEvent;
@@ -17,7 +17,11 @@ import net.minecraft.network.chat.ChatMessageType;
import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.EntityPlayer;
@ -41,7 +41,7 @@ index 75c36e772be93c9808cd8b72410ad8baa3d47006..636c60c7a8d674150fad0579c642cd03
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.util.LazyPlayerSet;
import org.bukkit.craftbukkit.util.Waitable;
@@ -178,10 +182,22 @@ public final class ChatProcessor {
@@ -179,10 +183,22 @@ public final class ChatProcessor {
}
private static String legacyDisplayName(final CraftPlayer player) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerLocaleChangeEvent
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index 1f31104a1a350f3b53ce45b034cafe528d406291..3d5d1b83094b5ca45fae47055db397630fdd4f04 100644
index ad55212370e3d814a397680927a1514ea0fe85b5..120cad4e7330900fa11d278cf87a6ab4484469c3 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -1685,7 +1685,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1686,7 +1686,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return s;
}
@ -17,7 +17,7 @@ index 1f31104a1a350f3b53ce45b034cafe528d406291..3d5d1b83094b5ca45fae47055db39763
public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
public void a(PacketPlayInSettings packetplayinsettings) {
// CraftBukkit start
@@ -1693,9 +1693,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1694,9 +1694,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT);
this.server.server.getPluginManager().callEvent(event);
}

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Properly fix item duplication bug
Credit to prplz for figuring out the real issue
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index fa315f10219dc340da4f51a8d4a78e1f33023bb3..afa87cf70ad978161853771c59f5a4906733cab3 100644
index 4b9595f89c75b220fe70840a74e0aaa0276fa122..09385eabefeb7d59de1ce4138648badd123396f9 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -2059,8 +2059,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -2060,8 +2060,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
@Override

Datei anzeigen

@ -19,10 +19,10 @@ spectate the target entity.
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index 1198de213b3809ddf7b7d6f1696d9f07bb4dc42e..d750c814ca3b7dc7df7f87de3e360235849c000b 100644
index 1271de75743356090050763ff2fb67d28b48cb23..46d1e766e234bf49d31583e9e59aeb33c719b1ec 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -1810,15 +1810,59 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1811,15 +1811,59 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return (Entity) (this.spectatedEntity == null ? this : this.spectatedEntity);
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Reset players airTicks on respawn
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index d750c814ca3b7dc7df7f87de3e360235849c000b..ae5fe4f71ea1cc231e5d87920c2243f4f4f581f1 100644
index 46d1e766e234bf49d31583e9e59aeb33c719b1ec..fbc0c81bb7e87f7820325a9a7bb39123db272845 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -2152,6 +2152,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -2153,6 +2153,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
this.setHealth(this.getMaxHealth());
@ -17,7 +17,7 @@ index d750c814ca3b7dc7df7f87de3e360235849c000b..ae5fe4f71ea1cc231e5d87920c2243f4
this.fallDistance = 0;
this.foodData = new FoodMetaData(this);
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 2fc25a13a554174d2b5f415c910c4a26e37b30e1..f102ecb56ac04a5b840fa52e6d1ff9604598d58d 100644
index b6b4eb9ac883cfdfab5f114767fb5cfb29445730..0b61d03506bd56cf7e373daacbf4fb2e29bb0a58 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2350,6 +2350,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne

Datei anzeigen

@ -572,7 +572,7 @@ index 662d7f418e8acc9503ebf43e09410e7bd50f6bb3..372e5268783a84effa8f9f06c3f85b18
this.p = spawnercreature_d;
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index 3105ec935e6fb2cf36b95e63dc9dc09dbfb45029..d66956b879ad7b05ea2a0252ca14b2d06dba135c 100644
index 49e3205dbd94b06b9504039c1a93f830b025a8bb..1e882d9d9b797bb5fb0411f5ecdedf01bcfe5aca 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -94,6 +94,7 @@ import net.minecraft.world.effect.MobEffects;
@ -603,7 +603,7 @@ index 3105ec935e6fb2cf36b95e63dc9dc09dbfb45029..d66956b879ad7b05ea2a0252ca14b2d0
}
// Yes, this doesn't match Vanilla, but it's the best we can do for now.
@@ -2051,6 +2058,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -2052,6 +2059,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent opening inventories when frozen
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index 8371d5ac694f469804ad55669fdedb8b3fc627bd..320be04d9e3284d728adb2df9da7edb63e5f71d1 100644
index 3cf68af488fdd8492c620e6f3438b35cd4aa7737..3e23bda4c1f379d28b722d21d600627a61a65ff0 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -559,7 +559,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -26,7 +26,7 @@ index 8371d5ac694f469804ad55669fdedb8b3fc627bd..320be04d9e3284d728adb2df9da7edb6
// CraftBukkit end
container.addSlotListener(this);
return OptionalInt.of(this.containerCounter);
@@ -2199,7 +2199,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -2200,7 +2200,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
@Override

Datei anzeigen

@ -107,7 +107,7 @@ index 90842b27f64afcdd8eb7d0e52df8cfcb418b5b5a..f47cd43f96f61475bd1d5da11bdbc7c5
return this.e;
}
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index 320be04d9e3284d728adb2df9da7edb63e5f71d1..5b9778c0a7a52ddb05ca7a6864e3b8852cec03e4 100644
index 3e23bda4c1f379d28b722d21d600627a61a65ff0..d010aed07a1e608897ca5f87afcb7661e295d933 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -2,6 +2,7 @@ package net.minecraft.server.level;
@ -127,7 +127,7 @@ index 320be04d9e3284d728adb2df9da7edb63e5f71d1..5b9778c0a7a52ddb05ca7a6864e3b885
private long ca = SystemUtils.getMonotonicMillis();
private Entity spectatedEntity;
public boolean worldChangeInvuln;
@@ -1800,6 +1801,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1801,6 +1802,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public String locale = null; // CraftBukkit - add, lowercase // Paper - default to null
public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
public void a(PacketPlayInSettings packetplayinsettings) {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Player Chunk Load/Unload Events
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index b420e93590d0f109ad13b8ddaa5cd093da9e067d..9522a4a2060fc8b1bda53f72414810ac09915275 100644
index d850721afc33230890353f16c5bc5579c9efb1bf..45c6eb96310146adab802dc3da019f7ee15e0fe5 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -139,6 +139,8 @@ import net.minecraft.world.scores.ScoreboardScore;
@ -17,7 +17,7 @@ index b420e93590d0f109ad13b8ddaa5cd093da9e067d..9522a4a2060fc8b1bda53f72414810ac
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -2088,11 +2090,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -2089,11 +2091,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(ChunkCoordIntPair chunkcoordintpair, Packet<?> packet, Packet<?> packet1) {
this.playerConnection.sendPacket(packet1);
this.playerConnection.sendPacket(packet);