mirror of
https://github.com/PaperMC/Velocity.git
synced 2026-02-19 07:27:42 +01:00
Merge branch 'dev/1.1.0' into dev/2.0.0
# Conflicts: # api/src/main/java/com/velocitypowered/api/command/CommandManager.java
This commit is contained in:
@@ -245,14 +245,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
@Override
|
@Override
|
||||||
public void sendActionBar(net.kyori.adventure.text.@NonNull Component message) {
|
public void sendActionBar(net.kyori.adventure.text.@NonNull Component message) {
|
||||||
ProtocolVersion playerVersion = getProtocolVersion();
|
ProtocolVersion playerVersion = getProtocolVersion();
|
||||||
if (playerVersion.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0) {
|
if (playerVersion.compareTo(ProtocolVersion.MINECRAFT_1_11) >= 0) {
|
||||||
// We do not need to use the title packets in 1.16.2+
|
// Use the title packet instead.
|
||||||
// https://bugs.mojang.com/browse/MC-119145
|
|
||||||
Chat chat = Chat.createClientbound(Identity.nil(), message, getProtocolVersion());
|
|
||||||
chat.setType(Chat.ACTION_TYPE);
|
|
||||||
connection.write(chat);
|
|
||||||
} else if (playerVersion.compareTo(ProtocolVersion.MINECRAFT_1_11) >= 0) {
|
|
||||||
// We can use the title packet instead.
|
|
||||||
TitlePacket pkt = new TitlePacket();
|
TitlePacket pkt = new TitlePacket();
|
||||||
pkt.setAction(TitlePacket.SET_ACTION_BAR);
|
pkt.setAction(TitlePacket.SET_ACTION_BAR);
|
||||||
pkt.setComponent(ProtocolUtils.getJsonChatSerializer(playerVersion)
|
pkt.setComponent(ProtocolUtils.getJsonChatSerializer(playerVersion)
|
||||||
@@ -265,7 +259,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
object.addProperty("text", LegacyComponentSerializer.legacySection().serialize(message));
|
object.addProperty("text", LegacyComponentSerializer.legacySection().serialize(message));
|
||||||
Chat chat = new Chat();
|
Chat chat = new Chat();
|
||||||
chat.setMessage(object.toString());
|
chat.setMessage(object.toString());
|
||||||
chat.setType(Chat.ACTION_TYPE);
|
chat.setType(Chat.GAME_INFO_TYPE);
|
||||||
connection.write(chat);
|
connection.write(chat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class Chat implements MinecraftPacket {
|
|||||||
|
|
||||||
public static final byte CHAT_TYPE = (byte) 0;
|
public static final byte CHAT_TYPE = (byte) 0;
|
||||||
public static final byte SYSTEM_TYPE = (byte) 1;
|
public static final byte SYSTEM_TYPE = (byte) 1;
|
||||||
public static final byte ACTION_TYPE = (byte) 2;
|
public static final byte GAME_INFO_TYPE = (byte) 2;
|
||||||
|
|
||||||
public static final int MAX_SERVERBOUND_MESSAGE_LENGTH = 256;
|
public static final int MAX_SERVERBOUND_MESSAGE_LENGTH = 256;
|
||||||
public static final UUID EMPTY_SENDER = new UUID(0, 0);
|
public static final UUID EMPTY_SENDER = new UUID(0, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user