Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-28 09:00:09 +01:00
Convert plain to json instead of doing component conversion in DeathListener (#3821)
Closes https://github.com/ViaVersion/ViaVersion/issues/3817
Dieser Commit ist enthalten in:
Ursprung
d3af70d76c
Commit
c113e19d41
@ -24,6 +24,7 @@ import com.viaversion.viaversion.api.type.Type;
|
|||||||
import com.viaversion.viaversion.bukkit.listeners.ViaBukkitListener;
|
import com.viaversion.viaversion.bukkit.listeners.ViaBukkitListener;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9;
|
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
|
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
|
||||||
|
import com.viaversion.viaversion.util.ComponentUtil;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -58,12 +59,12 @@ public class DeathListener extends ViaBukkitListener {
|
|||||||
// If online
|
// If online
|
||||||
UserConnection userConnection = getUserConnection(p);
|
UserConnection userConnection = getUserConnection(p);
|
||||||
if (userConnection != null) {
|
if (userConnection != null) {
|
||||||
PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_9.COMBAT_EVENT, null, userConnection);
|
PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_9.COMBAT_EVENT, userConnection);
|
||||||
try {
|
try {
|
||||||
wrapper.write(Type.VAR_INT, 2); // Event - Entity dead
|
wrapper.write(Type.VAR_INT, 2); // Event - Entity dead
|
||||||
wrapper.write(Type.VAR_INT, p.getEntityId()); // Player ID
|
wrapper.write(Type.VAR_INT, p.getEntityId()); // Player ID
|
||||||
wrapper.write(Type.INT, p.getEntityId()); // Entity ID
|
wrapper.write(Type.INT, p.getEntityId()); // Entity ID
|
||||||
Protocol1_9To1_8.STRING_TO_JSON.write(wrapper, msg); // Message
|
wrapper.write(Type.COMPONENT, ComponentUtil.plainToJson(msg)); // Message
|
||||||
|
|
||||||
wrapper.scheduleSend(Protocol1_9To1_8.class);
|
wrapper.scheduleSend(Protocol1_9To1_8.class);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren