3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-24 15:20:35 +01:00

1.20.3 working & checkstyle fixes

Dieser Commit ist enthalten in:
pkt77 2023-12-06 09:57:42 -05:00 committet von Shane Freeder
Ursprung 814b53f12c
Commit efcfeb3e53
15 geänderte Dateien mit 437 neuen und 173 gelöschten Zeilen

Datei anzeigen

@ -133,6 +133,18 @@ public class PlayerResourcePackStatusEvent {
/**
* The player has accepted the resource pack and is now downloading it.
*/
ACCEPTED
ACCEPTED,
/**
* The URL of the resource pack failed to load.
*/
INVALID_URL,
/**
* The player failed to reload the resource pack.
*/
FAILED_RELOAD,
/**
* The resource pack was discarded.
*/
DISCARDED,
}
}
}

Datei anzeigen

@ -19,7 +19,6 @@ import com.velocitypowered.api.proxy.player.TabList;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.util.GameProfile;
import com.velocitypowered.api.util.ModInfo;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
@ -300,4 +299,4 @@ public interface Player extends
* @return the player's client brand
*/
@Nullable String getClientBrand();
}
}

Datei anzeigen

@ -7,11 +7,10 @@
package com.velocitypowered.api.proxy.player;
import java.util.UUID;
import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.UUID;
/**
* Represents the information for a resource pack to apply that can be sent to the client.
*/
@ -175,4 +174,4 @@ public interface ResourcePackInfo {
*/
PLUGIN_ON_PROXY
}
}
}

Datei anzeigen

@ -198,6 +198,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
serverConn.getPlayer().queueResourcePack(toSend);
} else if (serverConn.getConnection() != null) {
serverConn.getConnection().write(new ResourcePackResponse(
packet.getId(),
packet.getHash(),
PlayerResourcePackStatusEvent.Status.DECLINED
));
@ -205,6 +206,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
}, playerConnection.eventLoop()).exceptionally((ex) -> {
if (serverConn.getConnection() != null) {
serverConn.getConnection().write(new ResourcePackResponse(
packet.getId(),
packet.getHash(),
PlayerResourcePackStatusEvent.Status.DECLINED
));
@ -218,7 +220,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
@Override
public boolean handle(RemoveResourcePack packet) {
//TODO
return false; //TODO
}
@Override
@ -312,8 +314,9 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
ping -> server.getEventManager()
.fire(new ProxyPingEvent(this.serverConn.getPlayer(), ping)),
playerConnection.eventLoop()).thenAcceptAsync(pingEvent -> this.playerConnection.write(
new ServerData(new ComponentHolder(this.serverConn.ensureConnected().getProtocolVersion(),
pingEvent.getPing().getDescriptionComponent()),
new ServerData(new ComponentHolder(
this.serverConn.ensureConnected().getProtocolVersion(),
pingEvent.getPing().getDescriptionComponent()),
pingEvent.getPing().getFavicon().orElse(null), packet.isSecureChatEnforced())),
playerConnection.eventLoop());
return true;
@ -386,4 +389,4 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
playerConnection.setAutoReading(writable);
}
}
}

Datei anzeigen

@ -134,12 +134,12 @@ public class ConfigSessionHandler implements MinecraftSessionHandler {
resourcePackToApply = null;
serverConn.getPlayer().queueResourcePack(toSend);
} else if (serverConn.getConnection() != null) {
serverConn.getConnection().write(new ResourcePackResponse(packet.getHash(),
serverConn.getConnection().write(new ResourcePackResponse(packet.getId(), packet.getHash(),
PlayerResourcePackStatusEvent.Status.DECLINED));
}
}, playerConnection.eventLoop()).exceptionally((ex) -> {
if (serverConn.getConnection() != null) {
serverConn.getConnection().write(new ResourcePackResponse(packet.getHash(),
serverConn.getConnection().write(new ResourcePackResponse(packet.getId(), packet.getHash(),
PlayerResourcePackStatusEvent.Status.DECLINED));
}
logger.error("Exception while handling resource pack send for {}", playerConnection, ex);
@ -227,4 +227,4 @@ public class ConfigSessionHandler implements MinecraftSessionHandler {
public static enum State {
START, NEGOTIATING, PLUGIN_MESSAGE_INTERRUPT, RESOURCE_PACK_INTERRUPT, COMPLETE
}
}
}

Datei anzeigen

@ -171,8 +171,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
private final ChatBuilderFactory chatBuilderFactory;
ConnectedPlayer(VelocityServer server, GameProfile profile, MinecraftConnection connection,
@Nullable InetSocketAddress virtualHost, boolean onlineMode,
@Nullable IdentifiedKey playerKey) {
@Nullable InetSocketAddress virtualHost, boolean onlineMode,
@Nullable IdentifiedKey playerKey) {
this.server = server;
this.profile = profile;
this.connection = connection;
@ -357,7 +357,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
@Override
public void sendMessage(@NonNull Identity identity, @NonNull Component message,
@NonNull MessageType type) {
@NonNull MessageType type) {
Preconditions.checkNotNull(message, "message");
Preconditions.checkNotNull(type, "type");
@ -606,7 +606,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
* @param safe whether or not we can safely reconnect to a new server
*/
public void handleConnectionException(RegisteredServer server, Throwable throwable,
boolean safe) {
boolean safe) {
if (!isActive()) {
// If the connection is no longer active, it makes no sense to try and recover it.
return;
@ -645,7 +645,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
* @param safe whether or not we can safely reconnect to a new server
*/
public void handleConnectionException(RegisteredServer server, Disconnect disconnect,
boolean safe) {
boolean safe) {
if (!isActive()) {
// If the connection is no longer active, it makes no sense to try and recover it.
return;
@ -671,7 +671,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
}
private void handleConnectionException(RegisteredServer rs,
@Nullable Component kickReason, Component friendlyReason, boolean safe) {
@Nullable Component kickReason, Component friendlyReason,
boolean safe) {
if (!isActive()) {
// If the connection is no longer active, it makes no sense to try and recover it.
return;
@ -1010,6 +1011,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
}
ResourcePackRequest request = new ResourcePackRequest();
request.setId(queued.getId());
request.setUrl(queued.getUrl());
if (queued.getHash() != null) {
request.setHash(ByteBufUtil.hexDump(queued.getHash()));
@ -1017,7 +1019,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
request.setHash("");
}
request.setRequired(queued.getShouldForce());
request.setPrompt(queued.getPrompt() == null ? null : new ComponentHolder(getProtocolVersion(), queued.getPrompt()));
request.setPrompt(queued.getPrompt() == null ? null :
new ComponentHolder(getProtocolVersion(), queued.getPrompt()));
connection.write(request);
}
@ -1039,12 +1042,12 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
@Override
public Collection<ResourcePackInfo> getAppliedResourcePacks() {
//TODO
return Collections.EMPTY_LIST; //TODO
}
@Override
public Collection<ResourcePackInfo> getPendingResourcePacks() {
//TODO
return Collections.EMPTY_LIST; //TODO
}
/**
@ -1115,7 +1118,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
*/
public void sendKeepAlive() {
if (connection.getState() == StateRegistry.PLAY
|| connection.getState() == StateRegistry.CONFIG) {
|| connection.getState() == StateRegistry.CONFIG) {
KeepAlive keepAlive = new KeepAlive();
keepAlive.setRandomId(ThreadLocalRandom.current().nextLong());
connection.write(keepAlive);
@ -1129,7 +1132,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
CompletableFuture.runAsync(() -> {
connection.write(new StartUpdate());
connection.getChannel().pipeline()
.get(MinecraftEncoder.class).setState(StateRegistry.CONFIG);
.get(MinecraftEncoder.class).setState(StateRegistry.CONFIG);
// Make sure we don't send any play packets to the player after update start
connection.addPlayPacketQueueHandler();
}, connection.eventLoop()).exceptionally((ex) -> {
@ -1176,7 +1179,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
private final @Nullable VelocityRegisteredServer previousServer;
ConnectionRequestBuilderImpl(RegisteredServer toConnect,
@Nullable VelocityServerConnection previousConnection) {
@Nullable VelocityServerConnection previousConnection) {
this.toConnect = Preconditions.checkNotNull(toConnect, "info");
this.previousServer = previousConnection == null ? null : previousConnection.getServer();
}
@ -1290,4 +1293,4 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
connectWithIndication();
}
}
}
}

Datei anzeigen

@ -19,11 +19,10 @@ package com.velocitypowered.proxy.connection.player;
import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.player.ResourcePackInfo;
import java.util.UUID;
import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.UUID;
/**
* Implements {@link ResourcePackInfo}.
*/
@ -38,7 +37,7 @@ public final class VelocityResourcePackInfo implements ResourcePackInfo {
private Origin originalOrigin;
private VelocityResourcePackInfo(UUID id, String url, @Nullable byte[] hash, boolean shouldForce,
@Nullable Component prompt, Origin origin) {
@Nullable Component prompt, Origin origin) {
this.id = id;
this.url = url;
this.hash = hash;
@ -161,4 +160,4 @@ public final class VelocityResourcePackInfo implements ResourcePackInfo {
}
}
}
}

Datei anzeigen

@ -66,10 +66,10 @@ public enum ProtocolUtils {
public static final int DEFAULT_MAX_STRING_SIZE = 65536; // 64KiB
private static final BinaryTagType<? extends BinaryTag>[] BINARY_TAG_TYPES = new BinaryTagType[] {
BinaryTagTypes.END, BinaryTagTypes.BYTE, BinaryTagTypes.SHORT, BinaryTagTypes.INT,
BinaryTagTypes.LONG, BinaryTagTypes.FLOAT, BinaryTagTypes.DOUBLE,
BinaryTagTypes.BYTE_ARRAY, BinaryTagTypes.STRING, BinaryTagTypes.LIST,
BinaryTagTypes.COMPOUND, BinaryTagTypes.INT_ARRAY, BinaryTagTypes.LONG_ARRAY};
BinaryTagTypes.END, BinaryTagTypes.BYTE, BinaryTagTypes.SHORT, BinaryTagTypes.INT,
BinaryTagTypes.LONG, BinaryTagTypes.FLOAT, BinaryTagTypes.DOUBLE,
BinaryTagTypes.BYTE_ARRAY, BinaryTagTypes.STRING, BinaryTagTypes.LIST,
BinaryTagTypes.COMPOUND, BinaryTagTypes.INT_ARRAY, BinaryTagTypes.LONG_ARRAY};
private static final QuietDecoderException BAD_VARINT_CACHED =
new QuietDecoderException("Bad VarInt decoded");
private static final int[] VARINT_EXACT_BYTE_LENGTHS = new int[33];
@ -376,10 +376,12 @@ public enum ProtocolUtils {
* @param reader the {@link BinaryTagIO.Reader} to use
* @return {@link net.kyori.adventure.nbt.CompoundBinaryTag} the CompoundTag from the buffer
*/
public static CompoundBinaryTag readCompoundTag(ByteBuf buf, ProtocolVersion version, BinaryTagIO.Reader reader) {
public static CompoundBinaryTag readCompoundTag(ByteBuf buf, ProtocolVersion version,
BinaryTagIO.Reader reader) {
BinaryTag binaryTag = readBinaryTag(buf, version, reader);
if (binaryTag.type() != BinaryTagTypes.COMPOUND) {
throw new DecoderException("Expected root tag to be CompoundTag, but is " + binaryTag.getClass().getSimpleName());
throw new DecoderException(
"Expected root tag to be CompoundTag, but is " + binaryTag.getClass().getSimpleName());
}
return (CompoundBinaryTag) binaryTag;
}
@ -391,7 +393,8 @@ public enum ProtocolUtils {
* @param reader the {@link BinaryTagIO.Reader} to use
* @return {@link net.kyori.adventure.nbt.BinaryTag} the BinaryTag from the buffer
*/
public static BinaryTag readBinaryTag(ByteBuf buf, ProtocolVersion version, BinaryTagIO.Reader reader) {
public static BinaryTag readBinaryTag(ByteBuf buf, ProtocolVersion version,
BinaryTagIO.Reader reader) {
BinaryTagType<?> type = BINARY_TAG_TYPES[buf.readByte()];
if (version.compareTo(ProtocolVersion.MINECRAFT_1_20_2) < 0) {
buf.skipBytes(buf.readUnsignedShort());
@ -409,7 +412,8 @@ public enum ProtocolUtils {
* @param buf the buffer to write to
* @param tag the BinaryTag to write
*/
public static <T extends BinaryTag> void writeBinaryTag(ByteBuf buf, ProtocolVersion version, T tag) {
public static <T extends BinaryTag> void writeBinaryTag(ByteBuf buf, ProtocolVersion version,
T tag) {
BinaryTagType<T> type = (BinaryTagType<T>) tag.type();
buf.writeByte(type.id());
try {
@ -707,4 +711,4 @@ public enum ProtocolUtils {
SERVERBOUND,
CLIENTBOUND
}
}
}

Datei anzeigen

@ -109,7 +109,9 @@ import java.util.Objects;
import java.util.function.Supplier;
import org.checkerframework.checker.nullness.qual.Nullable;
/** Registry of all Minecraft protocol states and the packets for each state. */
/**
* Registry of all Minecraft protocol states and the packets for each state.
*/
public enum StateRegistry {
HANDSHAKE {
@ -158,14 +160,14 @@ public enum StateRegistry {
clientbound.register(
RemoveResourcePack.class, RemoveResourcePack::new, map(0x06, MINECRAFT_1_20_3, false));
clientbound.register(ResourcePackRequest.class, ResourcePackRequest::new,
map(0x06, MINECRAFT_1_20_2, false),
map(0x07, MINECRAFT_1_20_3, false));
map(0x06, MINECRAFT_1_20_2, false),
map(0x07, MINECRAFT_1_20_3, false));
clientbound.register(ActiveFeatures.class, ActiveFeatures::new,
map(0x07, MINECRAFT_1_20_2, false),
map(0x08, MINECRAFT_1_20_3, false));
map(0x07, MINECRAFT_1_20_2, false),
map(0x08, MINECRAFT_1_20_3, false));
clientbound.register(TagsUpdate.class, TagsUpdate::new,
map(0x08, MINECRAFT_1_20_2, false),
map(0x09, MINECRAFT_1_20_3, false));
map(0x08, MINECRAFT_1_20_2, false),
map(0x09, MINECRAFT_1_20_3, false));
}
},
PLAY {
@ -194,9 +196,9 @@ public enum StateRegistry {
map(0x02, MINECRAFT_1_12_1, false),
map(0x03, MINECRAFT_1_14, MINECRAFT_1_18_2, false));
serverbound.register(
ChatAcknowledgement.class,
ChatAcknowledgement::new,
map(0x03, MINECRAFT_1_19_3, false));
ChatAcknowledgement.class,
ChatAcknowledgement::new,
map(0x03, MINECRAFT_1_19_3, false));
serverbound.register(KeyedPlayerCommand.class, KeyedPlayerCommand::new,
map(0x03, MINECRAFT_1_19, false),
map(0x04, MINECRAFT_1_19_1, MINECRAFT_1_19_1, false));
@ -399,7 +401,9 @@ public enum StateRegistry {
map(0x43, MINECRAFT_1_20_2, true),
map(0x45, MINECRAFT_1_20_3, true));
clientbound.register(
RemoveResourcePack.class, RemoveResourcePack::new, map(0x43, MINECRAFT_1_20_3, false));
RemoveResourcePack.class,
RemoveResourcePack::new,
map(0x43, MINECRAFT_1_20_3, false));
clientbound.register(
ResourcePackRequest.class,
ResourcePackRequest::new,
@ -546,10 +550,10 @@ public enum StateRegistry {
map(0x47, MINECRAFT_1_20_2, false),
map(0x49, MINECRAFT_1_20_3, false));
clientbound.register(
StartUpdate.class,
StartUpdate::new,
map(0x65, MINECRAFT_1_20_2, false),
map(0x67, MINECRAFT_1_20_3, false));
StartUpdate.class,
StartUpdate::new,
map(0x65, MINECRAFT_1_20_2, false),
map(0x67, MINECRAFT_1_20_3, false));
}
},
LOGIN {
@ -584,7 +588,9 @@ public enum StateRegistry {
return (direction == SERVERBOUND ? serverbound : clientbound).getProtocolRegistry(version);
}
/** Packet registry. */
/**
* Packet registry.
*/
public static class PacketRegistry {
private final Direction direction;
@ -618,7 +624,7 @@ public enum StateRegistry {
}
<P extends MinecraftPacket> void register(Class<P> clazz, Supplier<P> packetSupplier,
PacketMapping... mappings) {
PacketMapping... mappings) {
if (mappings.length == 0) {
throw new IllegalArgumentException("At least one mapping must be provided.");
}
@ -682,7 +688,9 @@ public enum StateRegistry {
}
}
/** Protocol registry. */
/**
* Protocol registry.
*/
public class ProtocolRegistry {
public final ProtocolVersion version;
@ -723,7 +731,7 @@ public enum StateRegistry {
throw new IllegalArgumentException(String.format(
"Unable to find id for packet of type %s in %s protocol %s phase %s",
packet.getClass().getName(), PacketRegistry.this.direction,
this.version, PacketRegistry.this.registry
this.version, PacketRegistry.this.registry
));
}
return id;
@ -741,7 +749,9 @@ public enum StateRegistry {
}
}
/** Packet mapping. */
/**
* Packet mapping.
*/
public static final class PacketMapping {
private final int id;
@ -750,7 +760,7 @@ public enum StateRegistry {
private final @Nullable ProtocolVersion lastValidProtocolVersion;
PacketMapping(int id, ProtocolVersion protocolVersion,
ProtocolVersion lastValidProtocolVersion, boolean packetDecoding) {
ProtocolVersion lastValidProtocolVersion, boolean packetDecoding) {
this.id = id;
this.protocolVersion = protocolVersion;
this.lastValidProtocolVersion = lastValidProtocolVersion;
@ -812,8 +822,8 @@ public enum StateRegistry {
* @return PacketMapping with the provided arguments
*/
private static PacketMapping map(int id, ProtocolVersion version,
ProtocolVersion lastValidProtocolVersion, boolean encodeOnly) {
ProtocolVersion lastValidProtocolVersion, boolean encodeOnly) {
return new PacketMapping(id, version, lastValidProtocolVersion, encodeOnly);
}
}
}

Datei anzeigen

@ -39,16 +39,22 @@ public class RemoveResourcePack implements MinecraftPacket {
@Override
public void decode(ByteBuf buf, Direction direction, ProtocolVersion protocolVersion) {
this.id = ProtocolUtils.readUuid(buf);
if (buf.readBoolean()) {
this.id = ProtocolUtils.readUuid(buf);
}
}
@Override
public void encode(ByteBuf buf, Direction direction, ProtocolVersion protocolVersion) {
ProtocolUtils.writeUuid(buf, id);
buf.writeBoolean(id != null);
if (id != null) {
ProtocolUtils.writeUuid(buf, id);
}
}
@Override
public boolean handle(MinecraftSessionHandler handler) {
return handler.handle(this);
}
}
}

Datei anzeigen

@ -26,15 +26,19 @@ import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import java.util.UUID;
public class ResourcePackResponse implements MinecraftPacket {
private UUID id;
private String hash = "";
private @MonotonicNonNull Status status;
public ResourcePackResponse() {
}
public ResourcePackResponse(String hash, @MonotonicNonNull Status status) {
public ResourcePackResponse(UUID id, String hash, @MonotonicNonNull Status status) {
this.id = id;
this.hash = hash;
this.status = status;
}
@ -52,6 +56,9 @@ public class ResourcePackResponse implements MinecraftPacket {
@Override
public void decode(ByteBuf buf, Direction direction, ProtocolVersion protocolVersion) {
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_20_3) >= 0) {
this.id = ProtocolUtils.readUuid(buf);
}
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_9_4) <= 0) {
this.hash = ProtocolUtils.readString(buf);
}
@ -60,6 +67,9 @@ public class ResourcePackResponse implements MinecraftPacket {
@Override
public void encode(ByteBuf buf, Direction direction, ProtocolVersion protocolVersion) {
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_20_3) >= 0) {
ProtocolUtils.writeUuid(buf, id);
}
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_9_4) <= 0) {
ProtocolUtils.writeString(buf, hash);
}
@ -75,4 +85,4 @@ public class ResourcePackResponse implements MinecraftPacket {
public String toString() {
return "ResourcePackResponse{" + "hash=" + hash + ", " + "status=" + status + '}';
}
}
}

Datei anzeigen

@ -20,6 +20,7 @@ package com.velocitypowered.proxy.protocol.packet.brigadier;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19_3;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19_4;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_3;
import static com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentIdentifier.id;
import static com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentIdentifier.mapSet;
import static com.velocitypowered.proxy.protocol.packet.brigadier.DoubleArgumentPropertySerializer.DOUBLE;
@ -206,54 +207,75 @@ public class ArgumentPropertyRegistry {
empty(id("minecraft:item_predicate", mapSet(MINECRAFT_1_19, 15)));
empty(id("minecraft:color", mapSet(MINECRAFT_1_19, 16)));
empty(id("minecraft:component", mapSet(MINECRAFT_1_19, 17)));
empty(id("minecraft:message", mapSet(MINECRAFT_1_19, 18)));
empty(id("minecraft:nbt_compound_tag", mapSet(MINECRAFT_1_19, 19))); // added in 1.14
empty(id("minecraft:nbt_tag", mapSet(MINECRAFT_1_19, 20))); // added in 1.14
empty(id("minecraft:nbt_path", mapSet(MINECRAFT_1_19, 21)));
empty(id("minecraft:objective", mapSet(MINECRAFT_1_19, 22)));
empty(id("minecraft:objective_criteria", mapSet(MINECRAFT_1_19, 23)));
empty(id("minecraft:operation", mapSet(MINECRAFT_1_19, 24)));
empty(id("minecraft:particle", mapSet(MINECRAFT_1_19, 25)));
empty(id("minecraft:angle", mapSet(MINECRAFT_1_19, 26))); // added in 1.16.2
empty(id("minecraft:rotation", mapSet(MINECRAFT_1_19, 27)));
empty(id("minecraft:scoreboard_slot", mapSet(MINECRAFT_1_19, 28)));
empty(id("minecraft:score_holder", mapSet(MINECRAFT_1_19, 29)),
empty(id("minecraft:style", mapSet(MINECRAFT_1_20_3, 18))); // added 1.20.3
empty(id("minecraft:message", mapSet(MINECRAFT_1_20_3, 19), mapSet(MINECRAFT_1_19, 18)));
empty(id("minecraft:nbt_compound_tag", mapSet(MINECRAFT_1_20_3, 20),
mapSet(MINECRAFT_1_19, 19))); // added in 1.14
empty(id("minecraft:nbt_tag", mapSet(MINECRAFT_1_20_3, 21),
mapSet(MINECRAFT_1_19, 20))); // added in 1.14
empty(id("minecraft:nbt_path", mapSet(MINECRAFT_1_20_3, 22), mapSet(MINECRAFT_1_19, 21)));
empty(id("minecraft:objective", mapSet(MINECRAFT_1_20_3, 23), mapSet(MINECRAFT_1_19, 22)));
empty(id("minecraft:objective_criteria", mapSet(MINECRAFT_1_20_3, 24),
mapSet(MINECRAFT_1_19, 23)));
empty(id("minecraft:operation", mapSet(MINECRAFT_1_20_3, 25), mapSet(MINECRAFT_1_19, 24)));
empty(id("minecraft:particle", mapSet(MINECRAFT_1_20_3, 26), mapSet(MINECRAFT_1_19, 25)));
empty(id("minecraft:angle", mapSet(MINECRAFT_1_20_3, 27),
mapSet(MINECRAFT_1_19, 26))); // added in 1.16.2
empty(id("minecraft:rotation", mapSet(MINECRAFT_1_20_3, 28), mapSet(MINECRAFT_1_19, 27)));
empty(
id("minecraft:scoreboard_slot", mapSet(MINECRAFT_1_20_3, 29), mapSet(MINECRAFT_1_19, 28)));
empty(id("minecraft:score_holder", mapSet(MINECRAFT_1_20_3, 30), mapSet(MINECRAFT_1_19, 29)),
ByteArgumentPropertySerializer.BYTE);
empty(id("minecraft:swizzle", mapSet(MINECRAFT_1_19, 30)));
empty(id("minecraft:team", mapSet(MINECRAFT_1_19, 31)));
empty(id("minecraft:item_slot", mapSet(MINECRAFT_1_19, 32)));
empty(id("minecraft:resource_location", mapSet(MINECRAFT_1_19, 33)));
empty(id("minecraft:swizzle", mapSet(MINECRAFT_1_20_3, 31), mapSet(MINECRAFT_1_19, 30)));
empty(id("minecraft:team", mapSet(MINECRAFT_1_20_3, 32), mapSet(MINECRAFT_1_19, 31)));
empty(id("minecraft:item_slot", mapSet(MINECRAFT_1_20_3, 33), mapSet(MINECRAFT_1_19, 32)));
empty(id("minecraft:resource_location", mapSet(MINECRAFT_1_20_3, 34),
mapSet(MINECRAFT_1_19, 33)));
empty(id("minecraft:mob_effect", mapSet(MINECRAFT_1_19_3, -1), mapSet(MINECRAFT_1_19, 34)));
empty(id("minecraft:function", mapSet(MINECRAFT_1_19_3, 34), mapSet(MINECRAFT_1_19, 35)));
empty(id("minecraft:entity_anchor", mapSet(MINECRAFT_1_19_3, 35), mapSet(MINECRAFT_1_19, 36)));
empty(id("minecraft:int_range", mapSet(MINECRAFT_1_19_3, 36), mapSet(MINECRAFT_1_19, 37)));
empty(id("minecraft:float_range", mapSet(MINECRAFT_1_19_3, 37), mapSet(MINECRAFT_1_19, 38)));
empty(id("minecraft:function", mapSet(MINECRAFT_1_20_3, 35), mapSet(MINECRAFT_1_19_3, 34),
mapSet(MINECRAFT_1_19, 35)));
empty(id("minecraft:entity_anchor", mapSet(MINECRAFT_1_20_3, 36), mapSet(MINECRAFT_1_19_3, 35),
mapSet(MINECRAFT_1_19, 36)));
empty(id("minecraft:int_range", mapSet(MINECRAFT_1_20_3, 37), mapSet(MINECRAFT_1_19_3, 36),
mapSet(MINECRAFT_1_19, 37)));
empty(id("minecraft:float_range", mapSet(MINECRAFT_1_20_3, 38), mapSet(MINECRAFT_1_19_3, 37),
mapSet(MINECRAFT_1_19, 38)));
empty(
id("minecraft:item_enchantment", mapSet(MINECRAFT_1_19_3, -1), mapSet(MINECRAFT_1_19, 39)));
empty(id("minecraft:entity_summon", mapSet(MINECRAFT_1_19_3, -1), mapSet(MINECRAFT_1_19, 40)));
empty(id("minecraft:dimension", mapSet(MINECRAFT_1_19_3, 38), mapSet(MINECRAFT_1_19, 41)));
empty(id("minecraft:gamemode", mapSet(MINECRAFT_1_19_3, 39))); // 1.19.3
empty(id("minecraft:dimension", mapSet(MINECRAFT_1_20_3, 39), mapSet(MINECRAFT_1_19_3, 38),
mapSet(MINECRAFT_1_19, 41)));
empty(id("minecraft:gamemode", mapSet(MINECRAFT_1_20_3, 40),
mapSet(MINECRAFT_1_19_3, 39))); // 1.19.3
empty(id("minecraft:time", mapSet(MINECRAFT_1_19_3, 40),
empty(id("minecraft:time", mapSet(MINECRAFT_1_20_3, 41), mapSet(MINECRAFT_1_19_3, 40),
mapSet(MINECRAFT_1_19, 42)), TimeArgumentSerializer.TIME); // added in 1.14
register(
id("minecraft:resource_or_tag", mapSet(MINECRAFT_1_19_3, 41), mapSet(MINECRAFT_1_19, 43)),
id("minecraft:resource_or_tag", mapSet(MINECRAFT_1_20_3, 42), mapSet(MINECRAFT_1_19_3, 41),
mapSet(MINECRAFT_1_19, 43)),
RegistryKeyArgument.class, RegistryKeyArgumentSerializer.REGISTRY);
register(id("minecraft:resource_or_tag_key", mapSet(MINECRAFT_1_19_3, 42)),
register(id("minecraft:resource_or_tag_key", mapSet(MINECRAFT_1_20_3, 43),
mapSet(MINECRAFT_1_19_3, 42)),
RegistryKeyArgumentList.ResourceOrTagKey.class,
RegistryKeyArgumentList.ResourceOrTagKey.Serializer.REGISTRY);
register(id("minecraft:resource", mapSet(MINECRAFT_1_19_3, 43), mapSet(MINECRAFT_1_19, 44)),
register(id("minecraft:resource", mapSet(MINECRAFT_1_20_3, 44), mapSet(MINECRAFT_1_19_3, 43),
mapSet(MINECRAFT_1_19, 44)),
RegistryKeyArgument.class, RegistryKeyArgumentSerializer.REGISTRY);
register(id("minecraft:resource_key", mapSet(MINECRAFT_1_19_3, 44)),
register(
id("minecraft:resource_key", mapSet(MINECRAFT_1_20_3, 45), mapSet(MINECRAFT_1_19_3, 44)),
RegistryKeyArgumentList.ResourceKey.class,
RegistryKeyArgumentList.ResourceKey.Serializer.REGISTRY);
empty(id("minecraft:template_mirror", mapSet(MINECRAFT_1_19, 45))); // 1.19
empty(id("minecraft:template_rotation", mapSet(MINECRAFT_1_19, 46))); // 1.19
empty(id("minecraft:heightmap", mapSet(MINECRAFT_1_19_4, 47))); // 1.19.4
empty(id("minecraft:template_mirror", mapSet(MINECRAFT_1_20_3, 46),
mapSet(MINECRAFT_1_19, 45))); // 1.19
empty(id("minecraft:template_rotation", mapSet(MINECRAFT_1_20_3, 47),
mapSet(MINECRAFT_1_19, 46))); // 1.19
empty(id("minecraft:heightmap", mapSet(MINECRAFT_1_20_3, 49),
mapSet(MINECRAFT_1_19_4, 47))); // 1.19.4
empty(id("minecraft:uuid", mapSet(MINECRAFT_1_19_4, 48), mapSet(MINECRAFT_1_19, 47))); // added in 1.16
empty(id("minecraft:uuid", mapSet(MINECRAFT_1_20_3, 48), mapSet(MINECRAFT_1_19_4, 48),
mapSet(MINECRAFT_1_19, 47))); // added in 1.16
// Crossstitch support
register(id("crossstitch:mod_argument", mapSet(MINECRAFT_1_19, -256)),
@ -261,4 +283,4 @@ public class ArgumentPropertyRegistry {
empty(id("minecraft:nbt")); // No longer in 1.19+
}
}
}

Datei anzeigen

@ -1,82 +1,278 @@
/*
* Copyright (C) 2019-2023 Velocity Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.velocitypowered.proxy.protocol.packet.chat;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.protocol.ProtocolUtils;
import io.netty.buffer.ByteBuf;
import net.kyori.adventure.nbt.BinaryTag;
import net.kyori.adventure.nbt.BinaryTagIO;
import net.kyori.adventure.nbt.BinaryTagType;
import net.kyori.adventure.nbt.ByteArrayBinaryTag;
import net.kyori.adventure.nbt.ByteBinaryTag;
import net.kyori.adventure.nbt.CompoundBinaryTag;
import net.kyori.adventure.nbt.DoubleBinaryTag;
import net.kyori.adventure.nbt.EndBinaryTag;
import net.kyori.adventure.nbt.FloatBinaryTag;
import net.kyori.adventure.nbt.IntArrayBinaryTag;
import net.kyori.adventure.nbt.IntBinaryTag;
import net.kyori.adventure.nbt.ListBinaryTag;
import net.kyori.adventure.nbt.LongArrayBinaryTag;
import net.kyori.adventure.nbt.LongBinaryTag;
import net.kyori.adventure.nbt.ShortBinaryTag;
import net.kyori.adventure.nbt.StringBinaryTag;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class ComponentHolder {
public static ComponentHolder EMPTY = new ComponentHolder(null, Component.empty());
public static ComponentHolder EMPTY = new ComponentHolder(null, Component.empty());
static {
EMPTY.json = "{\"text\":\"\"}";
EMPTY.binaryTag = StringBinaryTag.stringBinaryTag("");
}
static {
EMPTY.json = "{\"text\":\"\"}";
EMPTY.binaryTag = StringBinaryTag.stringBinaryTag("");
}
private final ProtocolVersion version;
private @MonotonicNonNull Component component;
private @MonotonicNonNull String json;
private @MonotonicNonNull BinaryTag binaryTag;
private final ProtocolVersion version;
private @MonotonicNonNull Component component;
private @MonotonicNonNull String json;
private @MonotonicNonNull BinaryTag binaryTag;
public ComponentHolder(ProtocolVersion version, Component component) {
this.version = version;
this.component = component;
}
public ComponentHolder(ProtocolVersion version, Component component) {
this.version = version;
this.component = component;
}
public ComponentHolder(ProtocolVersion version, String json) {
this.version = version;
this.json = json;
}
public ComponentHolder(ProtocolVersion version, String json) {
this.version = version;
this.json = json;
}
public ComponentHolder(ProtocolVersion version, BinaryTag binaryTag) {
this.version = version;
this.binaryTag = binaryTag;
}
public ComponentHolder(ProtocolVersion version, BinaryTag binaryTag) {
this.version = version;
this.binaryTag = binaryTag;
}
public Component getComponent() {
if (component == null) {
if (json != null) {
component = ProtocolUtils.getJsonChatSerializer(version).deserialize(json);
} else if (binaryTag != null) {
//TODO component = deserialize(binaryTag);
throw new UnsupportedOperationException("binary tag -> component not implemented yet");
}
}
return component;
}
public Component getComponent() {
if (component == null) {
if (json != null) {
component = ProtocolUtils.getJsonChatSerializer(version).deserialize(json);
} else if (binaryTag != null) {
component = ProtocolUtils.getJsonChatSerializer(version)
.deserialize(deserialize(binaryTag).toString());
}
}
return component;
}
public String getJson() {
if (json == null) {
json = ProtocolUtils.getJsonChatSerializer(version).serialize(getComponent());
}
return json;
}
public String getJson() {
if (json == null) {
json = ProtocolUtils.getJsonChatSerializer(version).serialize(getComponent());
}
return json;
}
public BinaryTag getBinaryTag() {
if (binaryTag == null) {
//TODO binaryTag = serialize(getComponent());
throw new UnsupportedOperationException("component -> binary tag not implemented yet");
}
return binaryTag;
}
public BinaryTag getBinaryTag() {
if (binaryTag == null) {
binaryTag = serialize(GsonComponentSerializer.gson().serializeToTree(getComponent()));
}
return binaryTag;
}
public static ComponentHolder read(ByteBuf buf, ProtocolVersion version) {
if (version.compareTo(ProtocolVersion.MINECRAFT_1_20_3) >= 0) {
return new ComponentHolder(version, ProtocolUtils.readBinaryTag(buf, version, BinaryTagIO.reader()));
} else {
return new ComponentHolder(version, ProtocolUtils.readString(buf));
}
}
public static BinaryTag serialize(JsonElement json) {
if (json instanceof JsonPrimitive) {
JsonPrimitive jsonPrimitive = (JsonPrimitive) json;
public void write(ByteBuf buf, ProtocolVersion version) {
if (version.compareTo(ProtocolVersion.MINECRAFT_1_20_3) >= 0) {
ProtocolUtils.writeBinaryTag(buf, version, getBinaryTag());
} else {
ProtocolUtils.writeString(buf, getJson());
}
}
}
if (jsonPrimitive.isNumber()) {
Number number = json.getAsNumber();
if (number instanceof Byte) {
return ByteBinaryTag.byteBinaryTag((Byte) number);
} else if (number instanceof Short) {
return ShortBinaryTag.shortBinaryTag((Short) number);
} else if (number instanceof Integer) {
return IntBinaryTag.intBinaryTag((Integer) number);
} else if (number instanceof Long) {
return LongBinaryTag.longBinaryTag((Long) number);
} else if (number instanceof Float) {
return FloatBinaryTag.floatBinaryTag((Float) number);
} else if (number instanceof Double) {
return DoubleBinaryTag.doubleBinaryTag((Double) number);
}
} else if (jsonPrimitive.isString()) {
return StringBinaryTag.stringBinaryTag(jsonPrimitive.getAsString());
} else if (jsonPrimitive.isBoolean()) {
return ByteBinaryTag.byteBinaryTag((byte) (jsonPrimitive.getAsBoolean() ? 1 : 0));
} else {
throw new IllegalArgumentException("Unknown JSON primitive: " + jsonPrimitive);
}
} else if (json instanceof JsonObject) {
CompoundBinaryTag.Builder compound = CompoundBinaryTag.builder();
for (Map.Entry<String, JsonElement> property : ((JsonObject) json).entrySet()) {
compound.put(property.getKey(), serialize(property.getValue()));
}
return compound.build();
} else if (json instanceof JsonArray) {
List<JsonElement> jsonArray = ((JsonArray) json).asList();
if (jsonArray.isEmpty()) {
return ListBinaryTag.empty();
}
BinaryTag listTag;
BinaryTagType<? extends BinaryTag> listType = serialize(jsonArray.get(0)).type();
switch (listType.id()) {
case 1://BinaryTagTypes.BYTE:
byte[] bytes = new byte[jsonArray.size()];
for (int i = 0; i < bytes.length; i++) {
bytes[i] = (Byte) jsonArray.get(i).getAsNumber();
}
listTag = ByteArrayBinaryTag.byteArrayBinaryTag(bytes);
break;
case 3://BinaryTagTypes.INT:
int[] ints = new int[jsonArray.size()];
for (int i = 0; i < ints.length; i++) {
ints[i] = (Integer) jsonArray.get(i).getAsNumber();
}
listTag = IntArrayBinaryTag.intArrayBinaryTag(ints);
break;
case 4://BinaryTagTypes.LONG:
long[] longs = new long[jsonArray.size()];
for (int i = 0; i < longs.length; i++) {
longs[i] = (Long) jsonArray.get(i).getAsNumber();
}
listTag = LongArrayBinaryTag.longArrayBinaryTag(longs);
break;
default:
List<BinaryTag> tagItems = new ArrayList<>(jsonArray.size());
for (JsonElement jsonEl : jsonArray) {
BinaryTag subTag = serialize(jsonEl);
if (subTag.type() != listType) {
throw new IllegalArgumentException("Cannot convert mixed JsonArray to Tag");
}
tagItems.add(subTag);
}
listTag = ListBinaryTag.listBinaryTag(listType, tagItems);
break;
}
return listTag;
}
return EndBinaryTag.endBinaryTag();
}
public static JsonElement deserialize(BinaryTag tag) {
switch (tag.type().id()) {
case 1://BinaryTagTypes.BYTE:
return new JsonPrimitive(((ByteBinaryTag) tag).value());
case 2://BinaryTagTypes.SHORT:
return new JsonPrimitive(((ShortBinaryTag) tag).value());
case 3://BinaryTagTypes.INT:
return new JsonPrimitive(((IntBinaryTag) tag).value());
case 4://BinaryTagTypes.LONG:
return new JsonPrimitive(((LongBinaryTag) tag).value());
case 5://BinaryTagTypes.FLOAT:
return new JsonPrimitive(((FloatBinaryTag) tag).value());
case 6://BinaryTagTypes.DOUBLE:
return new JsonPrimitive(((DoubleBinaryTag) tag).value());
case 7://BinaryTagTypes.BYTE_ARRAY:
byte[] byteArray = ((ByteArrayBinaryTag) tag).value();
JsonArray jsonByteArray = new JsonArray(byteArray.length);
for (byte b : byteArray) {
jsonByteArray.add(new JsonPrimitive(b));
}
return jsonByteArray;
case 8://BinaryTagTypes.STRING:
return new JsonPrimitive(((StringBinaryTag) tag).value());
case 9://BinaryTagTypes.LIST:
ListBinaryTag items = (ListBinaryTag) tag;
JsonArray jsonList = new JsonArray(items.size());
for (BinaryTag subTag : items) {
jsonList.add(deserialize(subTag));
}
return jsonList;
case 10://BinaryTagTypes.COMPOUND:
CompoundBinaryTag compound = (CompoundBinaryTag) tag;
JsonObject jsonObject = new JsonObject();
compound.keySet().forEach(key -> jsonObject.add(key, deserialize(compound.get(key))));
return jsonObject;
case 11://BinaryTagTypes.INT_ARRAY:
int[] intArray = ((IntArrayBinaryTag) tag).value();
JsonArray jsonIntArray = new JsonArray(intArray.length);
for (int i : intArray) {
jsonIntArray.add(new JsonPrimitive(i));
}
return jsonIntArray;
case 12://BinaryTagTypes.LONG_ARRAY:
long[] longArray = ((LongArrayBinaryTag) tag).value();
JsonArray jsonLongArray = new JsonArray(longArray.length);
for (long l : longArray) {
jsonLongArray.add(new JsonPrimitive(l));
}
return jsonLongArray;
default:
throw new IllegalArgumentException("Unknown NBT tag: " + tag);
}
}
public static ComponentHolder read(ByteBuf buf, ProtocolVersion version) {
if (version.compareTo(ProtocolVersion.MINECRAFT_1_20_3) >= 0) {
return new ComponentHolder(version,
ProtocolUtils.readBinaryTag(buf, version, BinaryTagIO.reader()));
} else {
return new ComponentHolder(version, ProtocolUtils.readString(buf));
}
}
public void write(ByteBuf buf, ProtocolVersion version) {
if (version.compareTo(ProtocolVersion.MINECRAFT_1_20_3) >= 0) {
ProtocolUtils.writeBinaryTag(buf, version, getBinaryTag());
} else {
ProtocolUtils.writeString(buf, getJson());
}
}
}

Datei anzeigen

@ -22,9 +22,8 @@ import com.velocitypowered.api.proxy.player.TabList;
import com.velocitypowered.api.proxy.player.TabListEntry;
import com.velocitypowered.api.util.GameProfile;
import com.velocitypowered.proxy.protocol.packet.UpsertPlayerInfo;
import java.util.Optional;
import com.velocitypowered.proxy.protocol.packet.chat.ComponentHolder;
import java.util.Optional;
import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.Nullable;
@ -45,8 +44,8 @@ public class VelocityTabListEntry implements TabListEntry {
* Constructs the instance.
*/
public VelocityTabListEntry(VelocityTabList tabList, GameProfile profile, Component displayName,
int latency,
int gameMode, @Nullable ChatSession session, boolean listed) {
int latency,
int gameMode, @Nullable ChatSession session, boolean listed) {
this.tabList = tabList;
this.profile = profile;
this.displayName = displayName;
@ -80,7 +79,8 @@ public class VelocityTabListEntry implements TabListEntry {
public TabListEntry setDisplayName(@Nullable Component displayName) {
this.displayName = displayName;
UpsertPlayerInfo.Entry upsertEntry = this.tabList.createRawEntry(this);
upsertEntry.setDisplayName(new ComponentHolder(this.tabList.getPlayer().getProtocolVersion(), displayName));
upsertEntry.setDisplayName(
new ComponentHolder(this.tabList.getPlayer().getProtocolVersion(), displayName));
this.tabList.emitActionRaw(UpsertPlayerInfo.Action.UPDATE_DISPLAY_NAME, upsertEntry);
return this;
}
@ -146,4 +146,4 @@ public class VelocityTabListEntry implements TabListEntry {
void setListedWithoutUpdate(boolean listed) {
this.listed = listed;
}
}
}

Datei anzeigen

@ -121,7 +121,7 @@ public class AdventureBossBarManager implements BossBar.Listener {
@Override
public void bossBarNameChanged(@NonNull BossBar bar, @NonNull Component oldName,
@NonNull Component newName) {
@NonNull Component newName) {
BossBarHolder holder = this.getHandler(bar);
if (holder == null) {
return;
@ -149,7 +149,7 @@ public class AdventureBossBarManager implements BossBar.Listener {
@Override
public void bossBarColorChanged(@NonNull BossBar bar, @NonNull Color oldColor,
@NonNull Color newColor) {
@NonNull Color newColor) {
BossBarHolder holder = this.getHandler(bar);
if (holder == null) {
return;
@ -162,7 +162,7 @@ public class AdventureBossBarManager implements BossBar.Listener {
@Override
public void bossBarOverlayChanged(@NonNull BossBar bar, @NonNull Overlay oldOverlay,
@NonNull Overlay newOverlay) {
@NonNull Overlay newOverlay) {
BossBarHolder holder = this.getHandler(bar);
if (holder == null) {
return;
@ -176,7 +176,7 @@ public class AdventureBossBarManager implements BossBar.Listener {
@Override
public void bossBarFlagsChanged(@NonNull BossBar bar, @NonNull Set<Flag> added,
@NonNull Set<Flag> removed) {
@NonNull Set<Flag> removed) {
BossBarHolder holder = this.getHandler(bar);
if (holder == null) {
return;
@ -212,7 +212,8 @@ public class AdventureBossBarManager implements BossBar.Listener {
.proxy.protocol.packet.BossBar();
packet.setUuid(this.id);
packet.setAction(com.velocitypowered.proxy.protocol.packet.BossBar.ADD);
packet.setName(new ComponentHolder(player.getProtocolVersion(), player.translateMessage(bar.name())));
packet.setName(
new ComponentHolder(player.getProtocolVersion(), player.translateMessage(bar.name())));
packet.setColor(COLORS_TO_PROTOCOL.get(bar.color()));
packet.setOverlay(OVERLAY_TO_PROTOCOL.get(bar.overlay()));
packet.setPercent(bar.progress());
@ -241,7 +242,7 @@ public class AdventureBossBarManager implements BossBar.Listener {
}
com.velocitypowered.proxy.protocol.packet.BossBar createTitleUpdate(Component name,
ProtocolVersion version) {
ProtocolVersion version) {
com.velocitypowered.proxy.protocol.packet.BossBar packet = new com.velocitypowered
.proxy.protocol.packet.BossBar();
packet.setUuid(this.id);
@ -282,4 +283,4 @@ public class AdventureBossBarManager implements BossBar.Listener {
return val;
}
}
}
}