From 34ea8e96b39e3c1abc5478e5431e882ac8fc7e9b Mon Sep 17 00:00:00 2001 From: RootBeer Date: Mon, 18 May 2026 16:47:55 -0400 Subject: [PATCH 1/8] Resolve generic checkstyle issues + void packets from checkstyle block --- api/build.gradle.kts | 2 +- .../api/command/CommandSource.java | 16 ++-- .../api/event/Continuation.java | 2 +- .../api/event/connection/PreLoginEvent.java | 9 +- .../event/player/GameProfileRequestEvent.java | 9 +- .../event/player/PlayerClientBrandEvent.java | 6 +- .../PlayerConfigurationEvent.java | 1 + .../PlayerEnterConfigurationEvent.java | 3 +- .../PlayerEnteredConfigurationEvent.java | 1 + .../PlayerFinishConfigurationEvent.java | 3 +- .../PlayerFinishedConfigurationEvent.java | 1 + .../api/network/ProtocolState.java | 5 ++ .../api/permission/Tristate.java | 3 +- .../com/velocitypowered/api/proxy/Player.java | 17 ++-- .../api/proxy/crypto/IdentifiedKey.java | 5 +- .../api/proxy/crypto/KeySigned.java | 2 +- .../api/proxy/player/ResourcePackInfo.java | 8 +- .../api/proxy/player/TabListEntry.java | 3 + .../api/proxy/server/QueryResponse.java | 1 - .../api/proxy/server/ServerInfo.java | 8 +- .../api/proxy/server/ServerPing.java | 1 - gradle/libs.versions.toml | 4 +- .../natives/util/MoreByteBufUtils.java | 4 +- proxy/build.gradle.kts | 8 +- .../velocitypowered/proxy/VelocityServer.java | 3 +- .../handler/ModernResourcePackHandler.java | 4 +- .../handler/ResourcePackHandler.java | 1 + .../proxy/event/VelocityEventManager.java | 63 +++++++------ .../proxy/protocol/ProtocolUtils.java | 16 ++-- .../packet/AvailableCommandsPacket.java | 9 ++ .../proxy/protocol/packet/BossBarPacket.java | 60 +++++++++---- .../protocol/packet/ClientSettingsPacket.java | 8 +- .../packet/ClientboundSoundEntityPacket.java | 9 +- .../packet/ClientboundStopSoundPacket.java | 6 +- .../protocol/packet/DisconnectPacket.java | 6 +- .../packet/EncryptionResponsePacket.java | 3 +- .../protocol/packet/HandshakePacket.java | 4 +- .../packet/HeaderAndFooterPacket.java | 4 +- .../proxy/protocol/packet/JoinGamePacket.java | 25 +++--- .../protocol/packet/LegacyDisconnect.java | 37 ++++---- .../packet/LegacyPlayerListItemPacket.java | 20 ++--- .../packet/LoginAcknowledgedPacket.java | 2 +- .../protocol/packet/PluginMessagePacket.java | 6 +- .../packet/RemoveResourcePackPacket.java | 2 +- .../packet/ResourcePackRequestPacket.java | 16 ++-- .../packet/ResourcePackResponsePacket.java | 13 ++- .../protocol/packet/ServerDataPacket.java | 4 +- .../protocol/packet/ServerLoginPacket.java | 8 +- .../packet/UpsertPlayerInfoPacket.java | 20 ++--- .../packet/brigadier/ArgumentIdentifier.java | 12 ++- .../brigadier/ArgumentPropertyRegistry.java | 8 +- .../chat/ChatAcknowledgementPacket.java | 68 +++++++------- .../proxy/protocol/packet/chat/ChatQueue.java | 11 +-- .../proxy/protocol/packet/chat/ChatType.java | 2 +- .../protocol/packet/chat/CommandHandler.java | 30 +++---- .../protocol/packet/chat/ComponentHolder.java | 63 ++++++------- .../packet/chat/LastSeenMessages.java | 10 +-- .../chat/RateLimitedCommandHandler.java | 55 ++++++------ .../packet/chat/SystemChatPacket.java | 2 +- .../chat/keyed/KeyedCommandHandler.java | 3 +- .../packet/chat/legacy/LegacyChatPacket.java | 1 + .../chat/legacy/LegacyCommandHandler.java | 4 +- .../chat/session/SessionChatHandler.java | 3 +- .../chat/session/SessionCommandHandler.java | 3 +- .../session/SessionPlayerCommandPacket.java | 33 +++---- .../session/UnsignedPlayerCommandPacket.java | 6 +- .../ClientboundCustomReportDetailsPacket.java | 56 ++++++------ .../config/ClientboundServerLinksPacket.java | 88 +++++++++---------- .../packet/config/KnownPacksPacket.java | 72 +++++++-------- .../packet/config/StartUpdatePacket.java | 2 +- .../packet/config/TagsUpdatePacket.java | 1 - .../packet/title/GenericTitlePacket.java | 7 +- .../packet/title/LegacyTitlePacket.java | 4 +- .../src/main/resources/default-velocity.toml | 2 +- 74 files changed, 525 insertions(+), 492 deletions(-) diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 268a8197ba..aeda343341 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -66,7 +66,7 @@ tasks { "https://www.javadocs.dev/org.slf4j/slf4j-api/${libs.slf4j.get().version}/", "https://guava.dev/releases/${libs.guava.get().version}/api/docs/", "https://google.github.io/guice/api-docs/${libs.guice.get().version}/javadoc/", - "https://docs.oracle.com/en/java/javase/17/docs/api/", + "https://docs.oracle.com/en/java/javase/21/docs/api/", "https://jd.advntr.dev/api/${libs.adventure.bom.get().version}/", "https://jd.advntr.dev/text-minimessage/${libs.adventure.bom.get().version}/", "https://jd.advntr.dev/key/${libs.adventure.bom.get().version}/", diff --git a/api/src/main/java/com/velocitypowered/api/command/CommandSource.java b/api/src/main/java/com/velocitypowered/api/command/CommandSource.java index c94dec4c67..067b908f45 100644 --- a/api/src/main/java/com/velocitypowered/api/command/CommandSource.java +++ b/api/src/main/java/com/velocitypowered/api/command/CommandSource.java @@ -25,7 +25,7 @@ public interface CommandSource extends Audience, PermissionSubject { * @param message MiniMessage content * @see MiniMessage docs * for more information on the format. - **/ + */ default void sendRichMessage(final @NotNull String message) { this.sendMessage(MiniMessage.miniMessage().deserialize(message, this)); } @@ -41,19 +41,19 @@ default void sendRichMessage(final @NotNull String message) { */ default void sendRichMessage( final @NotNull String message, - final @NotNull TagResolver @NotNull... resolvers + final @NotNull TagResolver @NotNull ... resolvers ) { this.sendMessage(MiniMessage.miniMessage().deserialize(message, this, resolvers)); } /** - * Sends a plain message to this source. - * - * @param message plain message - * @apiNote This method will not apply any form of parse to the text provided, - * however, it is recommended not to use legacy color codes as this is a deprecated format + * Sends a plain message to this source. + * + * @param message plain message + * @apiNote This method will not apply any form of parse to the text provided, + * however, it is recommended not to use legacy color codes as this is a deprecated format * and not recommended. - */ + */ default void sendPlainMessage(final @NotNull String message) { this.sendMessage(Component.text(message)); } diff --git a/api/src/main/java/com/velocitypowered/api/event/Continuation.java b/api/src/main/java/com/velocitypowered/api/event/Continuation.java index 30672ef606..11ab424aef 100644 --- a/api/src/main/java/com/velocitypowered/api/event/Continuation.java +++ b/api/src/main/java/com/velocitypowered/api/event/Continuation.java @@ -22,4 +22,4 @@ public interface Continuation { * Resumes the continuation after the executed task failed. */ void resumeWithException(Throwable exception); -} \ No newline at end of file +} diff --git a/api/src/main/java/com/velocitypowered/api/event/connection/PreLoginEvent.java b/api/src/main/java/com/velocitypowered/api/event/connection/PreLoginEvent.java index 952cb091b7..3a7025757e 100644 --- a/api/src/main/java/com/velocitypowered/api/event/connection/PreLoginEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/connection/PreLoginEvent.java @@ -23,11 +23,9 @@ * with the login process, but you should try to limit the work done in any event that fires during * the login process. * - *

- * As of Velocity 3.1.0, you may cast the {@link InboundConnection} to a - * {@link com.velocitypowered.api.proxy.LoginPhaseConnection} to allow a - * proxy plugin to send login plugin messages to the client. - *

+ *

As of Velocity 3.1.0, you may cast the {@link InboundConnection} to a + * {@link com.velocitypowered.api.proxy.LoginPhaseConnection} to allow a + * proxy plugin to send login plugin messages to the client.

*/ @AwaitingEvent public final class PreLoginEvent implements ResultedEvent { @@ -73,6 +71,7 @@ public String getUsername() { /** * Returns the UUID of the connecting player. + * *

This value is {@code null} on 1.19.2 and lower, * up to 1.20.1 it is optional and from 1.20.2 it will always be available.

* diff --git a/api/src/main/java/com/velocitypowered/api/event/player/GameProfileRequestEvent.java b/api/src/main/java/com/velocitypowered/api/event/player/GameProfileRequestEvent.java index bb682255d7..a55dc12aec 100644 --- a/api/src/main/java/com/velocitypowered/api/event/player/GameProfileRequestEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/player/GameProfileRequestEvent.java @@ -18,11 +18,9 @@ * order to set up the game profile for the user. This can be used to configure a custom profile for * a user, i.e. skin replacement. * - *

- * Velocity will wait for this event to finish firing before proceeding with the rest of the login - * process, but you should try to limit the work done in any event that fires during the login - * process. - *

+ *

Velocity will wait for this event to finish firing before proceeding with the rest of the login + * process, but you should try to limit the work done in any event that fires during the login + * process.

*/ @AwaitingEvent public final class GameProfileRequestEvent { @@ -92,5 +90,4 @@ public String toString() { + "}"; } - } diff --git a/api/src/main/java/com/velocitypowered/api/event/player/PlayerClientBrandEvent.java b/api/src/main/java/com/velocitypowered/api/event/player/PlayerClientBrandEvent.java index 268d5b6a19..2a671ac6d2 100644 --- a/api/src/main/java/com/velocitypowered/api/event/player/PlayerClientBrandEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/player/PlayerClientBrandEvent.java @@ -40,9 +40,9 @@ public String getBrand() { @Override public String toString() { return "PlayerClientBrandEvent{" - + "player=" + player - + ", brand='" + brand + '\'' - + '}'; + + "player=" + player + + ", brand='" + brand + '\'' + + '}'; } } diff --git a/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerConfigurationEvent.java b/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerConfigurationEvent.java index 6e042af1c7..60b172f6c5 100644 --- a/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerConfigurationEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerConfigurationEvent.java @@ -14,6 +14,7 @@ /** * This event is executed when a player entered the configuration state and can be configured by Velocity. + * *

Velocity will wait for this event before continuing/ending the configuration state.

* * @param player The player who can be configured. diff --git a/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerEnterConfigurationEvent.java b/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerEnterConfigurationEvent.java index 05d6c2af02..97a2ded0e0 100644 --- a/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerEnterConfigurationEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerEnterConfigurationEvent.java @@ -15,8 +15,9 @@ /** * This event is executed when a player is about to enter the configuration state. * It is not called for the initial configuration of a player after login. + * *

Velocity will wait for this event before asking the client to enter configuration state. - * However due to backend server being unable to keep the connection alive during state changes, + * However, due to backend server being unable to keep the connection alive during state changes, * Velocity will only wait for a maximum of 5 seconds.

* * @param player The player who is about to enter configuration state. diff --git a/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerEnteredConfigurationEvent.java b/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerEnteredConfigurationEvent.java index c16777066c..6560f7bc43 100644 --- a/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerEnteredConfigurationEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerEnteredConfigurationEvent.java @@ -14,6 +14,7 @@ /** * This event is executed when a player has entered the configuration state. + * *

From this moment on, until the {@link PlayerFinishedConfigurationEvent} is executed, * the {@linkplain Player#getProtocolState()} method is guaranteed * to return {@link ProtocolState#CONFIGURATION}.

diff --git a/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerFinishConfigurationEvent.java b/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerFinishConfigurationEvent.java index 50df5a8abe..1cd3f2833c 100644 --- a/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerFinishConfigurationEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerFinishConfigurationEvent.java @@ -14,8 +14,9 @@ /** * This event is executed when a player is about to finish the configuration state. + * *

Velocity will wait for this event before asking the client to finish the configuration state. - * However due to backend server being unable to keep the connection alive during state changes, + * However, due to backend server being unable to keep the connection alive during state changes, * Velocity will only wait for a maximum of 5 seconds. If you need to hold a player in configuration * state, use the {@link PlayerConfigurationEvent}.

* diff --git a/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerFinishedConfigurationEvent.java b/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerFinishedConfigurationEvent.java index 517f119cfe..994a1d4111 100644 --- a/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerFinishedConfigurationEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/player/configuration/PlayerFinishedConfigurationEvent.java @@ -14,6 +14,7 @@ /** * This event is executed when a player has finished the configuration state. + * *

From this moment on, the {@link Player#getProtocolState()} method * will return {@link ProtocolState#PLAY}.

* diff --git a/api/src/main/java/com/velocitypowered/api/network/ProtocolState.java b/api/src/main/java/com/velocitypowered/api/network/ProtocolState.java index 0ecc8287a6..cd9b04d559 100644 --- a/api/src/main/java/com/velocitypowered/api/network/ProtocolState.java +++ b/api/src/main/java/com/velocitypowered/api/network/ProtocolState.java @@ -16,6 +16,7 @@ public enum ProtocolState { /** * Initial connection State. + * *

This status can be caused by a {@link HandshakeIntent#STATUS}, * {@link HandshakeIntent#LOGIN} or {@link HandshakeIntent#TRANSFER} intent.

* If the intent is LOGIN or TRANSFER, the next state will be {@link #LOGIN}, @@ -24,6 +25,7 @@ public enum ProtocolState { HANDSHAKE, /** * Ping State of a connection. + * *

Connections with the {@link HandshakeIntent#STATUS} intent will pass through this state * and be disconnected after it requests the ping from the server * and the server responds with the respective ping.

@@ -31,11 +33,13 @@ public enum ProtocolState { STATUS, /** * Authentication State of a connection. + * *

At this moment the player is authenticating with the authentication servers.

*/ LOGIN, /** * Configuration State of a connection. + * *

At this point the player allows the server to send information * such as resource packs and plugin messages, at the same time the player * will send his client brand and the respective plugin messages @@ -46,6 +50,7 @@ public enum ProtocolState { CONFIGURATION, /** * Game State of a connection. + * *

In this state is where the whole game runs, the server is able to change * the player's state to {@link #CONFIGURATION} as needed in versions 1.20.2 and higher.

*/ diff --git a/api/src/main/java/com/velocitypowered/api/permission/Tristate.java b/api/src/main/java/com/velocitypowered/api/permission/Tristate.java index ddbe26a866..003759e82b 100644 --- a/api/src/main/java/com/velocitypowered/api/permission/Tristate.java +++ b/api/src/main/java/com/velocitypowered/api/permission/Tristate.java @@ -15,7 +15,7 @@ * Represents three different states of a setting. * *

Possible values:

- *

+ * *