3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

Even more renames, start hiding some API internals

Dieser Commit ist enthalten in:
Andrew Steinborn 2023-10-29 15:23:01 -04:00
Ursprung 95cd4c407d
Commit 6f88c02c72
163 geänderte Dateien mit 682 neuen und 848 gelöschten Zeilen

Datei anzeigen

@ -3,7 +3,7 @@
name: Java CI with Gradle name: Java CI with Gradle
on: [push, pull_request] on: [ push, pull_request ]
jobs: jobs:
build-17: build-17:

Datei anzeigen

@ -12,22 +12,20 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.tree.LiteralCommandNode; import com.mojang.brigadier.tree.LiteralCommandNode;
/** /**
* A command that uses Brigadier for parsing the command and * A command that uses Brigadier for parsing the command and providing suggestions to the client.
* providing suggestions to the client.
*/ */
public final class BrigadierCommand implements Command { public final class BrigadierCommand implements Command {
/** /**
* The return code used by a {@link com.mojang.brigadier.Command} to indicate * The return code used by a {@link com.mojang.brigadier.Command} to indicate the command
* the command execution should be forwarded to the backend server. * execution should be forwarded to the backend server.
*/ */
public static final int FORWARD = 0xF6287429; public static final int FORWARD = 0xF6287429;
private final LiteralCommandNode<CommandSource> node; private final LiteralCommandNode<CommandSource> node;
/** /**
* Constructs a {@link BrigadierCommand} from the node returned by * Constructs a {@link BrigadierCommand} from the node returned by the given builder.
* the given builder.
* *
* @param builder the {@link LiteralCommandNode} builder * @param builder the {@link LiteralCommandNode} builder
*/ */

Datei anzeigen

@ -7,11 +7,11 @@
package com.velocitypowered.api.command; package com.velocitypowered.api.command;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
/** /**
* Represents a command that can be executed by a {@link CommandSource} * Represents a command that can be executed by a {@link CommandSource} such as a {@link Player} or
* such as a {@link Player} or the console. * the console.
* *
* <p><strong>You must not subclass <code>Command</code></strong>. Use one of the following * <p><strong>You must not subclass <code>Command</code></strong>. Use one of the following
* <i>registrable</i> subinterfaces:</p> * <i>registrable</i> subinterfaces:</p>
@ -30,4 +30,5 @@ import com.velocitypowered.api.proxy.Player;
* </ul> * </ul>
*/ */
public interface Command { public interface Command {
} }

Datei anzeigen

@ -18,8 +18,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public interface CommandManager { public interface CommandManager {
/** /**
* Returns a builder to create a {@link CommandMeta} with * Returns a builder to create a {@link CommandMeta} with the given alias.
* the given alias.
* *
* @param alias the first command alias * @param alias the first command alias
* @return a {@link CommandMeta} builder * @return a {@link CommandMeta} builder
@ -27,8 +26,7 @@ public interface CommandManager {
CommandMeta.Builder buildMeta(String alias); CommandMeta.Builder buildMeta(String alias);
/** /**
* Returns a builder to create a {@link CommandMeta} for * Returns a builder to create a {@link CommandMeta} for the given Brigadier command.
* the given Brigadier command.
* *
* @param command the command * @param command the command
* @return a {@link CommandMeta} builder * @return a {@link CommandMeta} builder
@ -41,8 +39,9 @@ public interface CommandManager {
* @param alias the first command alias * @param alias the first command alias
* @param command the command to register * @param command the command to register
* @param otherAliases additional aliases * @param otherAliases additional aliases
* @throws IllegalArgumentException if one of the given aliases is already registered, or * @throws IllegalArgumentException if one of the given aliases is already registered, or the
* the given command does not implement a registrable {@link Command} subinterface * given command does not implement a registrable {@link Command}
* subinterface
* @see Command for a list of registrable subinterfaces * @see Command for a list of registrable subinterfaces
*/ */
default void register(String alias, Command command, String... otherAliases) { default void register(String alias, Command command, String... otherAliases) {
@ -62,8 +61,9 @@ public interface CommandManager {
* *
* @param meta the command metadata * @param meta the command metadata
* @param command the command to register * @param command the command to register
* @throws IllegalArgumentException if one of the given aliases is already registered, or * @throws IllegalArgumentException if one of the given aliases is already registered, or the
* the given command does not implement a registrable {@link Command} subinterface * given command does not implement a registrable {@link Command}
* subinterface
* @see Command for a list of registrable subinterfaces * @see Command for a list of registrable subinterfaces
*/ */
void register(CommandMeta meta, Command command); void register(CommandMeta meta, Command command);
@ -95,25 +95,24 @@ public interface CommandManager {
* *
* @param source the source to execute the command for * @param source the source to execute the command for
* @param cmdLine the command to run * @param cmdLine the command to run
* @return a future that may be completed with the result of the command execution. * @return a future that may be completed with the result of the command execution. Can be
* Can be completed exceptionally if an exception is thrown during execution. * completed exceptionally if an exception is thrown during execution.
*/ */
CompletableFuture<Boolean> executeAsync(CommandSource source, String cmdLine); CompletableFuture<Boolean> executeAsync(CommandSource source, String cmdLine);
/** /**
* Attempts to asynchronously execute a command from the given {@code cmdLine} * Attempts to asynchronously execute a command from the given {@code cmdLine} without firing a
* without firing a {@link CommandExecuteEvent}. * {@link CommandExecuteEvent}.
* *
* @param source the source to execute the command for * @param source the source to execute the command for
* @param cmdLine the command to run * @param cmdLine the command to run
* @return a future that may be completed with the result of the command execution. * @return a future that may be completed with the result of the command execution. Can be
* Can be completed exceptionally if an exception is thrown during execution. * completed exceptionally if an exception is thrown during execution.
*/ */
CompletableFuture<Boolean> executeImmediatelyAsync(CommandSource source, String cmdLine); CompletableFuture<Boolean> executeImmediatelyAsync(CommandSource source, String cmdLine);
/** /**
* Returns an immutable collection of the case-insensitive aliases registered * Returns an immutable collection of the case-insensitive aliases registered on this manager.
* on this manager.
* *
* @return the registered aliases * @return the registered aliases
*/ */

Datei anzeigen

@ -17,25 +17,25 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public interface CommandMeta { public interface CommandMeta {
/** /**
* Returns a non-empty collection containing the case-insensitive aliases * Returns a non-empty collection containing the case-insensitive aliases used to execute the
* used to execute the command. * command.
* *
* @return the command aliases * @return the command aliases
*/ */
Collection<String> aliases(); Collection<String> aliases();
/** /**
* Returns an immutable collection containing command nodes that provide * Returns an immutable collection containing command nodes that provide additional argument
* additional argument metadata and tab-complete suggestions. * metadata and tab-complete suggestions. Note some {@link Command} implementations may not
* Note some {@link Command} implementations may not support hinting. * support hinting.
* *
* @return the hinting command nodes * @return the hinting command nodes
*/ */
Collection<CommandNode<CommandSource>> hints(); Collection<CommandNode<CommandSource>> hints();
/** /**
* Returns the plugin who registered the command. * Returns the plugin who registered the command. Note some {@link Command} registrations may not
* Note some {@link Command} registrations may not provide this information. * provide this information.
* *
* @return the registering plugin * @return the registering plugin
*/ */
@ -55,8 +55,8 @@ public interface CommandMeta {
Builder aliases(String... aliases); Builder aliases(String... aliases);
/** /**
* Specifies a command node providing additional argument metadata and * Specifies a command node providing additional argument metadata and tab-complete
* tab-complete suggestions. * suggestions.
* *
* @param node the command node * @param node the command node
* @return this builder, for chaining * @return this builder, for chaining

Datei anzeigen

@ -15,9 +15,8 @@ import java.util.concurrent.CompletableFuture;
* A command that can be executed with arbitrary arguments. * A command that can be executed with arbitrary arguments.
* *
* <p>Modifying the command tree (e.g. registering a command via * <p>Modifying the command tree (e.g. registering a command via
* {@link CommandManager#register(CommandMeta, Command)}) during * {@link CommandManager#register(CommandMeta, Command)}) during permission checking and suggestions
* permission checking and suggestions provision results in * provision results in undefined behavior, which may include deadlocks.
* undefined behavior, which may include deadlocks.
* *
* @param <I> the type of the command invocation object * @param <I> the type of the command invocation object
*/ */

Datei anzeigen

@ -8,9 +8,9 @@
package com.velocitypowered.api.command; package com.velocitypowered.api.command;
/** /**
* A specialized sub-interface of {@code Command} which indicates the proxy should pass * A specialized sub-interface of {@code Command} which indicates the proxy should pass the command
* the command and its arguments directly without further processing. * and its arguments directly without further processing. This is useful for bolting on external
* This is useful for bolting on external command frameworks to Velocity. * command frameworks to Velocity.
*/ */
public interface RawCommand extends InvocableCommand<RawCommand.Invocation> { public interface RawCommand extends InvocableCommand<RawCommand.Invocation> {

Datei anzeigen

@ -10,8 +10,7 @@ package com.velocitypowered.api.command;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
/** /**
* A simple command, modelled after the convention popularized by * A simple command, modelled after the convention popularized by Bukkit and BungeeCord.
* Bukkit and BungeeCord.
* *
* <p>Prefer using {@link BrigadierCommand}, which is also * <p>Prefer using {@link BrigadierCommand}, which is also
* backwards-compatible with older clients. * backwards-compatible with older clients.

Datei anzeigen

@ -15,8 +15,8 @@ import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
* Represents an implementation of brigadier's {@link Message}, providing support for {@link * Represents an implementation of brigadier's {@link Message}, providing support for
* Component} messages. * {@link Component} messages.
*/ */
public final class VelocityBrigadierMessage implements Message, ComponentLike { public final class VelocityBrigadierMessage implements Message, ComponentLike {

Datei anzeigen

@ -8,8 +8,8 @@
package com.velocitypowered.api.event; package com.velocitypowered.api.event;
/** /**
* Represents a continuation of a paused event handler. Any of the resume methods * Represents a continuation of a paused event handler. Any of the resume methods may only be called
* may only be called once otherwise an {@link IllegalStateException} is expected. * once otherwise an {@link IllegalStateException} is expected.
*/ */
public interface Continuation { public interface Continuation {

Datei anzeigen

@ -15,8 +15,8 @@ import java.util.concurrent.CompletableFuture;
public interface EventManager { public interface EventManager {
/** /**
* Requests that the specified {@code listener} listen for events and associate it with the {@code * Requests that the specified {@code listener} listen for events and associate it with the
* plugin}. * {@code plugin}.
* *
* @param plugin the plugin to associate with the listener * @param plugin the plugin to associate with the listener
* @param listener the listener to register * @param listener the listener to register
@ -24,8 +24,8 @@ public interface EventManager {
void register(Object plugin, Object listener); void register(Object plugin, Object listener);
/** /**
* Requests that the specified {@code handler} listen for events and associate it with the {@code * Requests that the specified {@code handler} listen for events and associate it with the
* plugin}. * {@code plugin}.
* *
* @param plugin the plugin to associate with the handler * @param plugin the plugin to associate with the handler
* @param eventClass the class for the event handler to register * @param eventClass the class for the event handler to register
@ -37,8 +37,8 @@ public interface EventManager {
} }
/** /**
* Requests that the specified {@code handler} listen for events and associate it with the {@code * Requests that the specified {@code handler} listen for events and associate it with the
* plugin}. * {@code plugin}.
* *
* @param plugin the plugin to associate with the handler * @param plugin the plugin to associate with the handler
* @param eventClass the class for the event handler to register * @param eventClass the class for the event handler to register

Datei anzeigen

@ -37,8 +37,8 @@ public interface ResultedEvent<R extends ResultedEvent.Result> {
interface Result { interface Result {
/** /**
* Returns whether the event is allowed to proceed. Plugins may choose to skip denied * Returns whether the event is allowed to proceed. Plugins may choose to skip denied events,
* events, and the proxy will respect the result of this method. * and the proxy will respect the result of this method.
* *
* @return whether the event is allowed to proceed * @return whether the event is allowed to proceed
*/ */

Datei anzeigen

@ -34,9 +34,9 @@ public @interface Subscribe {
* not to enable it now. This option is being provided as a migration aid.</strong></p> * not to enable it now. This option is being provided as a migration aid.</strong></p>
* *
* <p>If this method returns {@code true}, the method is guaranteed to be executed * <p>If this method returns {@code true}, the method is guaranteed to be executed
* asynchronously. Otherwise, the handler may be executed on the current thread or * asynchronously. Otherwise, the handler may be executed on the current thread or asynchronously.
* asynchronously. <strong>This still means you must consider thread-safety in your * <strong>This still means you must consider thread-safety in your event listeners</strong> as
* event listeners</strong> as the "current thread" can and will be different each time.</p> * the "current thread" can and will be different each time.</p>
* *
* <p>If any method handler targeting an event type is marked with {@code true}, then every * <p>If any method handler targeting an event type is marked with {@code true}, then every
* handler targeting that event type will be executed asynchronously.</p> * handler targeting that event type will be executed asynchronously.</p>

Datei anzeigen

@ -14,8 +14,8 @@ import java.lang.annotation.Target;
/** /**
* Marks an event as an event the proxy will wait on to completely fire (including any * Marks an event as an event the proxy will wait on to completely fire (including any
* {@link com.velocitypowered.api.event.EventTask}s) before continuing handling it. Annotated * {@link com.velocitypowered.api.event.EventTask}s) before continuing handling it. Annotated
* classes are suitable candidates for using EventTasks for handling complex asynchronous * classes are suitable candidates for using EventTasks for handling complex asynchronous operations
* operations in a non-blocking matter. * in a non-blocking matter.
*/ */
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
@Documented @Documented

Datei anzeigen

@ -127,8 +127,8 @@ public final class CommandExecuteEvent implements ResultedEvent<CommandResult> {
} }
/** /**
* Forwards the command to server instead of executing it on the proxy. This is the * Forwards the command to server instead of executing it on the proxy. This is the default
* default behavior when a command is not registered on Velocity. * behavior when a command is not registered on Velocity.
* *
* @return the forward result * @return the forward result
*/ */

Datei anzeigen

@ -13,13 +13,12 @@ import com.google.common.annotations.Beta;
import com.mojang.brigadier.tree.RootCommandNode; import com.mojang.brigadier.tree.RootCommandNode;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.event.player.PlayerReferentEvent; import com.velocitypowered.api.event.player.PlayerReferentEvent;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
/** /**
* Allows plugins to modify the packet indicating commands available on the server to a * Allows plugins to modify the packet indicating commands available on the server to a Minecraft
* Minecraft 1.13+ client. The given {@link RootCommandNode} is mutable. Velocity will wait * 1.13+ client. The given {@link RootCommandNode} is mutable. Velocity will wait for this event to
* for this event to finish firing before sending the list of available commands to the * finish firing before sending the list of available commands to the client.
* client.
*/ */
@AwaitingEvent @AwaitingEvent
@Beta @Beta

Datei anzeigen

@ -8,12 +8,12 @@
package com.velocitypowered.api.event.connection; package com.velocitypowered.api.event.connection;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.network.connection.InboundConnection;
/** /**
* This event is fired when a handshake is established between a client and the proxy. * This event is fired when a handshake is established between a client and the proxy. Velocity will
* Velocity will fire this event asynchronously and will not wait for it to complete before * fire this event asynchronously and will not wait for it to complete before handling the
* handling the connection. * connection.
*/ */
public final class ConnectionHandshakeEvent { public final class ConnectionHandshakeEvent {

Datei anzeigen

@ -9,19 +9,18 @@ package com.velocitypowered.api.event.connection;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
/** /**
* This event is fired when a player disconnects from the proxy. This operation can take place * This event is fired when a player disconnects from the proxy. This operation can take place when
* when the player disconnects due to normal network activity or when the proxy shuts down. * the player disconnects due to normal network activity or when the proxy shuts down. Operations on
* Operations on the provided player, aside from basic data retrieval operations, may behave in * the provided player, aside from basic data retrieval operations, may behave in undefined ways.
* undefined ways.
* *
* <p> * <p>
* Velocity typically fires this event asynchronously and does not wait for a response. However, * Velocity typically fires this event asynchronously and does not wait for a response. However, it
* it will wait for all {@link DisconnectEvent}s for every player on the proxy to fire * will wait for all {@link DisconnectEvent}s for every player on the proxy to fire successfully
* successfully before the proxy shuts down. This event is the sole exception to the * before the proxy shuts down. This event is the sole exception to the {@link AwaitingEvent}
* {@link AwaitingEvent} contract. * contract.
* </p> * </p>
*/ */
@AwaitingEvent @AwaitingEvent

Datei anzeigen

@ -11,7 +11,7 @@ import com.google.common.base.Preconditions;
import com.velocitypowered.api.event.ResultedEvent; import com.velocitypowered.api.event.ResultedEvent;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.event.player.PlayerReferentEvent; import com.velocitypowered.api.event.player.PlayerReferentEvent;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
/** /**
* This event is fired once the player has been authenticated, but before they connect to a server. * This event is fired once the player has been authenticated, but before they connect to a server.

Datei anzeigen

@ -12,18 +12,19 @@ import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import com.velocitypowered.api.event.ResultedEvent; import com.velocitypowered.api.event.ResultedEvent;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.network.connection.ServerConnection;
import com.velocitypowered.api.proxy.ServerConnection;
import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import com.velocitypowered.api.proxy.messages.ChannelMessageSink; import com.velocitypowered.api.proxy.messages.ChannelMessageSink;
import com.velocitypowered.api.proxy.messages.ChannelMessageSource; import com.velocitypowered.api.proxy.messages.ChannelMessageSource;
import com.velocitypowered.api.proxy.player.Player;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.util.Arrays; import java.util.Arrays;
/** /**
* This event is fired when a plugin message is sent to the proxy, either from a client ({@link * This event is fired when a plugin message is sent to the proxy, either from a client
* Player}) or a server ({@link ServerConnection}). Velocity will wait on this event to finish * ({@link Player}) or a server ({@link ServerConnection}). Velocity will wait on this event to
* firing before discarding the sent plugin message (if handled) or forwarding it to the server. * finish firing before discarding the sent plugin message (if handled) or forwarding it to the
* server.
*/ */
@AwaitingEvent @AwaitingEvent
public final class PluginMessageEvent implements ResultedEvent<PluginMessageEvent.ForwardResult> { public final class PluginMessageEvent implements ResultedEvent<PluginMessageEvent.ForwardResult> {

Datei anzeigen

@ -10,7 +10,7 @@ package com.velocitypowered.api.event.connection;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.event.player.PlayerReferentEvent; import com.velocitypowered.api.event.player.PlayerReferentEvent;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
/** /**
* This event is fired once the player has been fully initialized and is about to connect to their * This event is fired once the player has been fully initialized and is about to connect to their

Datei anzeigen

@ -10,7 +10,8 @@ package com.velocitypowered.api.event.connection;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.event.ResultedEvent; import com.velocitypowered.api.event.ResultedEvent;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.network.connection.InboundConnection;
import com.velocitypowered.api.network.connection.LoginPhaseConnection;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -24,8 +25,8 @@ import org.checkerframework.checker.nullness.qual.Nullable;
* *
* <p> * <p>
* As of Velocity 3.1.0, you may cast the {@link InboundConnection} to a * As of Velocity 3.1.0, you may cast the {@link InboundConnection} to a
* {@link com.velocitypowered.api.proxy.LoginPhaseConnection} to allow a * {@link LoginPhaseConnection} to allow a proxy plugin to send login plugin messages to the
* proxy plugin to send login plugin messages to the client. * client.
* </p> * </p>
*/ */
@AwaitingEvent @AwaitingEvent

Datei anzeigen

@ -11,20 +11,21 @@ import com.google.common.base.Preconditions;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.permission.PermissionProvider; import com.velocitypowered.api.permission.PermissionProvider;
import com.velocitypowered.api.permission.PermissionSubject; import com.velocitypowered.api.permission.PermissionSubject;
import com.velocitypowered.api.proxy.player.Player;
import net.kyori.adventure.permission.PermissionChecker; import net.kyori.adventure.permission.PermissionChecker;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
/** /**
* Called when a {@link PermissionSubject}'s permissions are being setup. This event is typically * Called when a {@link PermissionSubject}'s permissions are being setup. This event is typically
* called for the {@link com.velocitypowered.api.proxy.ConsoleCommandSource} and any * called for the {@link com.velocitypowered.api.proxy.ConsoleCommandSource} and any {@link Player}s
* {@link com.velocitypowered.api.proxy.Player}s who join the proxy. * who join the proxy.
* *
* <p>This event is only called once per subject, on initialisation.</p> * <p>This event is only called once per subject, on initialisation.</p>
* *
* <p> * <p>
* Velocity will wait for this event to finish firing before proceeding further with server * Velocity will wait for this event to finish firing before proceeding further with server startup
* startup (for the console command source) and logins (for players) but it is strongly * (for the console command source) and logins (for players) but it is strongly recommended to
* recommended to minimize the amount of work that must be done in this event. * minimize the amount of work that must be done in this event.
* </p> * </p>
*/ */
@AwaitingEvent @AwaitingEvent

Datei anzeigen

@ -9,7 +9,7 @@ package com.velocitypowered.api.event.player;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.network.connection.InboundConnection;
import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.api.util.GameProfile;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;

Datei anzeigen

@ -10,7 +10,7 @@ package com.velocitypowered.api.event.player;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.event.ResultedEvent; import com.velocitypowered.api.event.ResultedEvent;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@ -19,9 +19,9 @@ import org.checkerframework.checker.nullness.qual.Nullable;
/** /**
* Fired when a player is kicked from a server. You may either allow Velocity to kick the player * Fired when a player is kicked from a server. You may either allow Velocity to kick the player
* (with an optional reason override) or redirect the player to a separate server. By default, * (with an optional reason override) or redirect the player to a separate server. By default,
* Velocity will notify the user (if they are already connected to a server) or disconnect them * Velocity will notify the user (if they are already connected to a server) or disconnect them (if
* (if they are not on a server and no other servers are available). Velocity will wait on this * they are not on a server and no other servers are available). Velocity will wait on this event to
* event to finish firing before taking the specified action. * finish firing before taking the specified action.
*/ */
@AwaitingEvent @AwaitingEvent
public final class KickedFromServerEvent implements public final class KickedFromServerEvent implements
@ -161,9 +161,9 @@ public final class KickedFromServerEvent implements
} }
/** /**
* Creates a new redirect result to forward the player to the specified {@code server}. * Creates a new redirect result to forward the player to the specified {@code server}. The
* The specified {@code message} will be sent to the player after the redirection. * specified {@code message} will be sent to the player after the redirection. Use
* Use {@code Component.empty()} to skip sending any messages to the player. * {@code Component.empty()} to skip sending any messages to the player.
* *
* @param server the server to send the player to * @param server the server to send the player to
* @param message the message will be sent to the player after redirecting * @param message the message will be sent to the player after redirecting
@ -175,8 +175,8 @@ public final class KickedFromServerEvent implements
} }
/** /**
* Creates a new redirect result to forward the player to the specified {@code server}. * Creates a new redirect result to forward the player to the specified {@code server}. The kick
* The kick reason will be displayed to the player * reason will be displayed to the player
* *
* @param server the server to send the player to * @param server the server to send the player to
* @return the redirect result * @return the redirect result

Datei anzeigen

@ -8,13 +8,13 @@
package com.velocitypowered.api.event.player; package com.velocitypowered.api.event.player;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import com.velocitypowered.api.proxy.player.Player;
import java.util.List; import java.util.List;
/** /**
* This event is fired when a client ({@link Player}) sends a plugin message through the * This event is fired when a client ({@link Player}) sends a plugin message through the register
* register channel. Velocity will not wait on this event to finish firing. * channel. Velocity will not wait on this event to finish firing.
*/ */
public final class PlayerChannelRegisterEvent implements PlayerReferentEvent { public final class PlayerChannelRegisterEvent implements PlayerReferentEvent {

Datei anzeigen

@ -10,14 +10,14 @@ package com.velocitypowered.api.event.player;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.event.ResultedEvent; import com.velocitypowered.api.event.ResultedEvent;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
import java.util.Optional; import java.util.Optional;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
/** /**
* This event is fired when a player types in a chat message. Velocity will wait on this event * This event is fired when a player types in a chat message. Velocity will wait on this event to
* to finish firing before forwarding it to the server, if the result allows it. * finish firing before forwarding it to the server, if the result allows it.
*/ */
@AwaitingEvent @AwaitingEvent
public final class PlayerChatEvent implements ResultedEvent<PlayerChatEvent.ChatResult>, public final class PlayerChatEvent implements ResultedEvent<PlayerChatEvent.ChatResult>,

Datei anzeigen

@ -9,14 +9,14 @@ package com.velocitypowered.api.event.player;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import java.util.Optional; import java.util.Optional;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
/** /**
* Fired when a player has finished the login process, and we need to choose the first server * Fired when a player has finished the login process, and we need to choose the first server to
* to connect to. Velocity will wait on this event to finish firing before initiating the connection * connect to. Velocity will wait on this event to finish firing before initiating the connection
* but you should try to limit the work done in this event. Failures will be handled by * but you should try to limit the work done in this event. Failures will be handled by
* {@link KickedFromServerEvent} as normal. * {@link KickedFromServerEvent} as normal.
*/ */

Datei anzeigen

@ -8,13 +8,14 @@
package com.velocitypowered.api.event.player; package com.velocitypowered.api.event.player;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
/** /**
* Fired when a {@link Player} sends the <code>minecraft:brand</code> plugin message. Velocity will * Fired when a {@link Player} sends the <code>minecraft:brand</code> plugin message. Velocity will
* not wait on the result of this event. * not wait on the result of this event.
*/ */
public final class PlayerClientBrandEvent implements PlayerReferentEvent { public final class PlayerClientBrandEvent implements PlayerReferentEvent {
private final Player player; private final Player player;
private final String brand; private final String brand;
@ -46,4 +47,3 @@ public final class PlayerClientBrandEvent implements PlayerReferentEvent {
+ '}'; + '}';
} }
} }

Datei anzeigen

@ -9,7 +9,7 @@ package com.velocitypowered.api.event.player;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.util.ModInfo; import com.velocitypowered.api.util.ModInfo;
/** /**

Datei anzeigen

@ -7,7 +7,7 @@
package com.velocitypowered.api.event.player; package com.velocitypowered.api.event.player;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
/** /**
* Defines any event that refers to a player. * Defines any event that refers to a player.

Datei anzeigen

@ -10,7 +10,7 @@ package com.velocitypowered.api.event.player;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.player.ResourcePackInfo; import com.velocitypowered.api.proxy.player.ResourcePackInfo;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -67,8 +67,8 @@ public class PlayerResourcePackStatusEvent implements PlayerReferentEvent {
} }
/** /**
* Gets whether or not to override the kick resulting from * Gets whether or not to override the kick resulting from {@link ResourcePackInfo#required()}
* {@link ResourcePackInfo#required()} being true. * being true.
* *
* @return whether or not to overwrite the result * @return whether or not to overwrite the result
*/ */
@ -77,11 +77,10 @@ public class PlayerResourcePackStatusEvent implements PlayerReferentEvent {
} }
/** /**
* Set to true to prevent {@link ResourcePackInfo#required()} * Set to true to prevent {@link ResourcePackInfo#required()} from kicking the player. Overwriting
* from kicking the player. * this kick is only possible on versions older than 1.17, as the client or server will enforce
* Overwriting this kick is only possible on versions older than 1.17, * this regardless. Cancelling the resulting kick-events will not prevent the player from
* as the client or server will enforce this regardless. Cancelling the resulting * disconnecting from the proxy.
* kick-events will not prevent the player from disconnecting from the proxy.
* *
* @param overwriteKick whether or not to cancel the kick * @param overwriteKick whether or not to cancel the kick
* @throws IllegalArgumentException if the player version is 1.17 or newer * @throws IllegalArgumentException if the player version is 1.17 or newer

Datei anzeigen

@ -9,13 +9,13 @@ package com.velocitypowered.api.event.player;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.player.PlayerSettings; import com.velocitypowered.api.proxy.player.PlayerSettings;
/** /**
* This event is fired when the client sends new client settings for the player. This event can * This event is fired when the client sends new client settings for the player. This event can and
* and typically will be fired multiple times per connection. Velocity will not wait on this event * typically will be fired multiple times per connection. Velocity will not wait on this event to
* to finish firing. * finish firing.
*/ */
public final class PlayerSettingsChangedEvent implements PlayerReferentEvent { public final class PlayerSettingsChangedEvent implements PlayerReferentEvent {

Datei anzeigen

@ -9,7 +9,7 @@ package com.velocitypowered.api.event.player;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;

Datei anzeigen

@ -15,7 +15,7 @@ import com.google.common.io.ByteStreams;
import com.velocitypowered.api.event.ResultedEvent; import com.velocitypowered.api.event.ResultedEvent;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.event.player.ServerLoginPluginMessageEvent.ResponseResult; import com.velocitypowered.api.event.player.ServerLoginPluginMessageEvent.ResponseResult;
import com.velocitypowered.api.proxy.ServerConnection; import com.velocitypowered.api.network.connection.ServerConnection;
import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.util.Arrays; import java.util.Arrays;
@ -23,12 +23,13 @@ import org.checkerframework.checker.nullness.qual.Nullable;
/** /**
* Fired when a server sends a login plugin message to the proxy. Plugins have the opportunity to * Fired when a server sends a login plugin message to the proxy. Plugins have the opportunity to
* respond to the messages as needed. Velocity will wait on this event to finish. The server will * respond to the messages as needed. Velocity will wait on this event to finish. The server will be
* be responsible for continuing the login process once the server is satisfied with any login * responsible for continuing the login process once the server is satisfied with any login plugin
* plugin responses sent by proxy plugins (or messages indicating a lack of response). * responses sent by proxy plugins (or messages indicating a lack of response).
*/ */
@AwaitingEvent @AwaitingEvent
public class ServerLoginPluginMessageEvent implements ResultedEvent<ResponseResult> { public class ServerLoginPluginMessageEvent implements ResultedEvent<ResponseResult> {
private final ServerConnection connection; private final ServerConnection connection;
private final ChannelIdentifier identifier; private final ChannelIdentifier identifier;
private final byte[] contents; private final byte[] contents;
@ -122,7 +123,7 @@ public class ServerLoginPluginMessageEvent implements ResultedEvent<ResponseResu
private static final ResponseResult UNKNOWN = new ResponseResult(null); private static final ResponseResult UNKNOWN = new ResponseResult(null);
private final byte@Nullable [] response; private final byte @Nullable [] response;
private ResponseResult(byte @Nullable [] response) { private ResponseResult(byte @Nullable [] response) {
this.response = response; this.response = response;

Datei anzeigen

@ -8,7 +8,7 @@
package com.velocitypowered.api.event.player; package com.velocitypowered.api.event.player;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -18,6 +18,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
* firing. * firing.
*/ */
public class ServerPostConnectEvent implements PlayerReferentEvent { public class ServerPostConnectEvent implements PlayerReferentEvent {
private final Player player; private final Player player;
private final RegisteredServer previousServer; private final RegisteredServer previousServer;
@ -38,7 +39,8 @@ public class ServerPostConnectEvent implements PlayerReferentEvent {
/** /**
* Returns the previous server the player was connected to. This is {@code null} if they were not * Returns the previous server the player was connected to. This is {@code null} if they were not
* connected to another server beforehand (for instance, if the player has just joined the proxy). * connected to another server beforehand (for instance, if the player has just joined the
* proxy).
* *
* @return the previous server the player was connected to * @return the previous server the player was connected to
*/ */

Datei anzeigen

@ -10,10 +10,10 @@ package com.velocitypowered.api.event.player;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.event.ResultedEvent; import com.velocitypowered.api.event.ResultedEvent;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.network.connection.ServerConnection;
import com.velocitypowered.api.proxy.ConnectionRequestBuilder; import com.velocitypowered.api.proxy.ConnectionRequestBuilder;
import com.velocitypowered.api.proxy.ConnectionRequestBuilder.Status; import com.velocitypowered.api.proxy.ConnectionRequestBuilder.Status;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.ServerConnection;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import java.util.Optional; import java.util.Optional;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -78,9 +78,9 @@ public final class ServerPreConnectEvent implements
} }
/** /**
* Returns the server that the player originally tried to connect to. To get the server the * Returns the server that the player originally tried to connect to. To get the server the player
* player will connect to, see the {@link ServerResult} of this event. To get the server the * will connect to, see the {@link ServerResult} of this event. To get the server the player is
* player is currently on when this event is fired, use {@link #getPreviousServer()}. * currently on when this event is fired, use {@link #getPreviousServer()}.
* *
* @return the server that the player originally tried to connect to * @return the server that the player originally tried to connect to
*/ */

Datei anzeigen

@ -9,18 +9,18 @@ package com.velocitypowered.api.event.player;
import com.velocitypowered.api.event.ResultedEvent; import com.velocitypowered.api.event.ResultedEvent;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.proxy.ServerConnection; import com.velocitypowered.api.network.connection.ServerConnection;
import com.velocitypowered.api.proxy.player.ResourcePackInfo; import com.velocitypowered.api.proxy.player.ResourcePackInfo;
/** /**
* This event is fired when the downstream server tries to send a player a ResourcePack packet. * This event is fired when the downstream server tries to send a player a ResourcePack packet. The
* The proxy will wait on this event to finish before forwarding the resource pack to the user. * proxy will wait on this event to finish before forwarding the resource pack to the user. If this
* If this event is denied, it will retroactively send a DENIED status to the downstream * event is denied, it will retroactively send a DENIED status to the downstream server in response.
* server in response.
* If the downstream server has it set to "forced" it will forcefully disconnect the user. * If the downstream server has it set to "forced" it will forcefully disconnect the user.
*/ */
@AwaitingEvent @AwaitingEvent
public class ServerResourcePackSendEvent implements ResultedEvent<ResultedEvent.GenericResult> { public class ServerResourcePackSendEvent implements ResultedEvent<ResultedEvent.GenericResult> {
private GenericResult result; private GenericResult result;
private final ResourcePackInfo receivedResourcePack; private final ResourcePackInfo receivedResourcePack;
private ResourcePackInfo providedResourcePack; private ResourcePackInfo providedResourcePack;

Datei anzeigen

@ -10,19 +10,20 @@ package com.velocitypowered.api.event.player;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* This event is fired after a tab complete response is sent by the remote server, for clients on * This event is fired after a tab complete response is sent by the remote server, for clients on
* 1.12.2 and below. You have the opportunity to modify the response sent to the remote player. * 1.12.2 and below. You have the opportunity to modify the response sent to the remote player.
* Velocity will wait for this event to finish firing before sending the tab complete results to * Velocity will wait for this event to finish firing before sending the tab complete results to the
* the client. Be sure to be as fast as possible, since the client will freeze while it waits for * client. Be sure to be as fast as possible, since the client will freeze while it waits for the
* the tab complete results. * tab complete results.
*/ */
@AwaitingEvent @AwaitingEvent
public class TabCompleteEvent implements PlayerReferentEvent { public class TabCompleteEvent implements PlayerReferentEvent {
private final Player player; private final Player player;
private final String partialMessage; private final String partialMessage;
private final List<String> suggestions; private final List<String> suggestions;

Datei anzeigen

@ -9,15 +9,15 @@ package com.velocitypowered.api.event.proxy;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.event.annotation.AwaitingEvent; import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.network.connection.InboundConnection;
import com.velocitypowered.api.proxy.server.ServerPing; import com.velocitypowered.api.proxy.server.ServerPing;
/** /**
* This event is fired when a request for server information is sent by a remote client, or when the * This event is fired when a request for server information is sent by a remote client, or when the
* server sends the MOTD and favicon to the client after a successful login. Velocity will * server sends the MOTD and favicon to the client after a successful login. Velocity will wait on
* wait on this event to finish firing before delivering the results to the remote client, but * this event to finish firing before delivering the results to the remote client, but you are urged
* you are urged to handle this event as quickly as possible when handling this event due to the * to handle this event as quickly as possible when handling this event due to the amount of ping
* amount of ping packets a client can send. * packets a client can send.
*/ */
@AwaitingEvent @AwaitingEvent
public final class ProxyPingEvent { public final class ProxyPingEvent {

Datei anzeigen

@ -161,8 +161,7 @@ public enum ProtocolVersion {
} }
/** /**
* Returns the user-friendly name of the version * Returns the user-friendly name of the version this protocol was introduced in.
* this protocol was introduced in.
* *
* @return the version name * @return the version name
*/ */
@ -171,8 +170,7 @@ public enum ProtocolVersion {
} }
/** /**
* Returns the user-friendly name of the last * Returns the user-friendly name of the last version this protocol is valid for.
* version this protocol is valid for.
* *
* @return the version name * @return the version name
*/ */

Datei anzeigen

@ -5,7 +5,7 @@
* reference the LICENSE file in the api top-level directory. * reference the LICENSE file in the api top-level directory.
*/ */
package com.velocitypowered.api.proxy; package com.velocitypowered.api.network.connection;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;

Datei anzeigen

@ -5,22 +5,22 @@
* reference the LICENSE file in the api top-level directory. * reference the LICENSE file in the api top-level directory.
*/ */
package com.velocitypowered.api.proxy; package com.velocitypowered.api.network.connection;
import com.velocitypowered.api.proxy.crypto.KeyIdentifiable; import com.velocitypowered.api.proxy.crypto.KeyIdentifiable;
import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
/** /**
* Represents a connextion that is in the login phase. This is most useful in conjunction * Represents a connextion that is in the login phase. This is most useful in conjunction for login
* for login plugin messages. * plugin messages.
*/ */
public interface LoginPhaseConnection extends InboundConnection, KeyIdentifiable { public interface LoginPhaseConnection extends InboundConnection, KeyIdentifiable {
/** /**
* Sends a login plugin message to the client, and provides a consumer to react to the * Sends a login plugin message to the client, and provides a consumer to react to the response to
* response to the client. The login process will not continue until there are no more * the client. The login process will not continue until there are no more login plugin messages
* login plugin messages that require responses. * that require responses.
* *
* @param identifier the channel identifier to use * @param identifier the channel identifier to use
* @param contents the message to send * @param contents the message to send

Datei anzeigen

@ -5,10 +5,11 @@
* reference the LICENSE file in the api top-level directory. * reference the LICENSE file in the api top-level directory.
*/ */
package com.velocitypowered.api.proxy; package com.velocitypowered.api.network.connection;
import com.velocitypowered.api.proxy.messages.ChannelMessageSink; import com.velocitypowered.api.proxy.messages.ChannelMessageSink;
import com.velocitypowered.api.proxy.messages.ChannelMessageSource; import com.velocitypowered.api.proxy.messages.ChannelMessageSource;
import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.proxy.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
import java.util.Optional; import java.util.Optional;

Datei anzeigen

@ -21,8 +21,8 @@ public @interface Plugin {
/** /**
* The ID of the plugin. This ID should be unique as to not conflict with other plugins. The * The ID of the plugin. This ID should be unique as to not conflict with other plugins. The
* plugin ID may contain alphanumeric characters, dashes, and underscores, and be a maximum * plugin ID may contain alphanumeric characters, dashes, and underscores, and be a maximum of 64
* of 64 characters long. * characters long.
* *
* @return the ID for this plugin * @return the ID for this plugin
*/ */

Datei anzeigen

@ -32,8 +32,7 @@ public interface PluginContainer {
} }
/** /**
* Returns an executor service for this plugin. The executor will use a cached * Returns an executor service for this plugin. The executor will use a cached thread pool.
* thread pool.
* *
* @return an {@link ExecutorService} associated with this plugin * @return an {@link ExecutorService} associated with this plugin
*/ */

Datei anzeigen

@ -13,8 +13,8 @@ import java.util.Optional;
/** /**
* Manages plugins loaded on the proxy. This manager can retrieve {@link PluginContainer}s from * Manages plugins loaded on the proxy. This manager can retrieve {@link PluginContainer}s from
* plugin instances and inject arbitrary JAR files into the plugin classpath with {@link * plugin instances and inject arbitrary JAR files into the plugin classpath with
* #addToClasspath(Object, Path)}. * {@link #addToClasspath(Object, Path)}.
*/ */
public interface PluginManager { public interface PluginManager {

Datei anzeigen

@ -7,6 +7,7 @@
package com.velocitypowered.api.proxy; package com.velocitypowered.api.proxy;
import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -26,8 +27,8 @@ public interface ConnectionRequestBuilder {
RegisteredServer server(); RegisteredServer server();
/** /**
* Initiates the connection to the remote server and emits a result on the {@link * Initiates the connection to the remote server and emits a result on the
* CompletableFuture} after the user has logged on. No messages will be communicated to the * {@link CompletableFuture} after the user has logged on. No messages will be communicated to the
* client: the user is responsible for all error handling. * client: the user is responsible for all error handling.
* *
* @return a {@link CompletableFuture} representing the status of this connection * @return a {@link CompletableFuture} representing the status of this connection
@ -35,9 +36,9 @@ public interface ConnectionRequestBuilder {
CompletableFuture<Result> connect(); CompletableFuture<Result> connect();
/** /**
* Initiates the connection to the remote server and emits a result on the {@link * Initiates the connection to the remote server and emits a result on the
* CompletableFuture} after the user has logged on. Velocity's own built-in handling will be used * {@link CompletableFuture} after the user has logged on. Velocity's own built-in handling will
* to provide errors to the client. * be used to provide errors to the client.
* *
* @return a {@link CompletableFuture} representing the status of this connection * @return a {@link CompletableFuture} representing the status of this connection
*/ */

Datei anzeigen

@ -13,4 +13,5 @@ import com.velocitypowered.api.command.CommandSource;
* Indicates that the executor of the command is the console. * Indicates that the executor of the command is the console.
*/ */
public interface ConsoleCommandSource extends CommandSource { public interface ConsoleCommandSource extends CommandSource {
} }

Datei anzeigen

@ -13,6 +13,7 @@ import com.velocitypowered.api.event.EventManager;
import com.velocitypowered.api.plugin.PluginManager; import com.velocitypowered.api.plugin.PluginManager;
import com.velocitypowered.api.proxy.config.ProxyConfig; import com.velocitypowered.api.proxy.config.ProxyConfig;
import com.velocitypowered.api.proxy.messages.ChannelRegistrar; import com.velocitypowered.api.proxy.messages.ChannelRegistrar;
import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.player.ResourcePackInfo; import com.velocitypowered.api.proxy.player.ResourcePackInfo;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.proxy.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
@ -42,8 +43,8 @@ public interface ProxyServer extends Audience {
void shutdown(); void shutdown();
/** /**
* Closes all listening endpoints for this server. * Closes all listening endpoints for this server. This includes the main minecraft listener and
* This includes the main minecraft listener and query channel. * query channel.
*/ */
void closeListeners(); void closeListeners();
@ -203,20 +204,19 @@ public interface ProxyServer extends Audience {
/** /**
* Creates a builder to build a {@link ResourcePackInfo} instance for use with * Creates a builder to build a {@link ResourcePackInfo} instance for use with
* {@link com.velocitypowered.api.proxy.Player#sendResourcePackOffer(ResourcePackInfo)}. * {@link Player#sendResourcePackOffer(ResourcePackInfo)}.
* *
* <p>Note: The resource-pack location should always: * <p>Note: The resource-pack location should always:
* - Use HTTPS with a valid certificate. * - Use HTTPS with a valid certificate. - Be in a crawler-accessible location. Having it behind
* - Be in a crawler-accessible location. Having it behind Cloudflare or other DoS/Bot/crawler * Cloudflare or other DoS/Bot/crawler protection may cause issues in downloading. - Be on a
* protection may cause issues in downloading. * web-server with enough bandwidth and reliable connection so the download does not time out or
* - Be on a web-server with enough bandwidth and reliable connection * fail.</p>
* so the download does not time out or fail.</p>
* *
* <p>Do also make sure that the resource pack is in the correct format for the version * <p>Do also make sure that the resource pack is in the correct format for the version
* of the client. It is also highly recommended to always provide the resource-pack SHA-1 hash * of the client. It is also highly recommended to always provide the resource-pack SHA-1 hash of
* of the resource pack with {@link ResourcePackInfo.Builder#hash(byte[])} * the resource pack with {@link ResourcePackInfo.Builder#hash(byte[])} whenever possible to save
* whenever possible to save bandwidth. If a hash is present the client will first check * bandwidth. If a hash is present the client will first check if it already has a resource pack
* if it already has a resource pack by that hash cached.</p> * by that hash cached.</p>
* *
* @param url The url where the resource pack can be found * @param url The url where the resource pack can be found
* @return a ResourcePackInfo builder * @return a ResourcePackInfo builder

Datei anzeigen

@ -70,9 +70,9 @@ public interface ProxyConfig {
boolean isOnlineMode(); boolean isOnlineMode();
/** /**
* If client's ISP/AS sent from this proxy is different from the one from Mojang's * If client's ISP/AS sent from this proxy is different from the one from Mojang's authentication
* authentication server, the player is kicked. This disallows some VPN and proxy * server, the player is kicked. This disallows some VPN and proxy connections but is a weak form
* connections but is a weak form of protection. * of protection.
* *
* @return whether to prevent client proxy connections by checking the IP with Mojang servers * @return whether to prevent client proxy connections by checking the IP with Mojang servers
*/ */

Datei anzeigen

@ -20,8 +20,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public interface IdentifiedKey extends KeySigned { public interface IdentifiedKey extends KeySigned {
/** /**
* Returns RSA public key. * Returns RSA public key. Note: this key is at least 2048 bits but may be larger.
* Note: this key is at least 2048 bits but may be larger.
* *
* @return the RSA public key in question * @return the RSA public key in question
*/ */
@ -33,14 +32,13 @@ public interface IdentifiedKey extends KeySigned {
* *
* @param signature the signature data * @param signature the signature data
* @param toVerify the signed data * @param toVerify the signed data
*
* @return validity of the signature * @return validity of the signature
*/ */
boolean verifyDataSignature(byte[] signature, byte[]... toVerify); boolean verifyDataSignature(byte[] signature, byte[]... toVerify);
/** /**
* Retrieves the signature holders UUID. * Retrieves the signature holders UUID. Returns null before the
* Returns null before the {@link com.velocitypowered.api.event.connection.LoginEvent}. * {@link com.velocitypowered.api.event.connection.LoginEvent}.
* *
* @return the holder UUID or null if not present * @return the holder UUID or null if not present
*/ */

Datei anzeigen

@ -15,8 +15,8 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public interface KeyIdentifiable { public interface KeyIdentifiable {
/** /**
* Returns the timed identified key of the object context. This is only available if the client * Returns the timed identified key of the object context. This is only available if the client is
* is running Minecraft 1.19 or newer. * running Minecraft 1.19 or newer.
* *
* @return the key or null if not available * @return the key or null if not available
*/ */

Datei anzeigen

@ -25,10 +25,8 @@ public interface KeySigned {
PublicKey signer(); PublicKey signer();
/** /**
* Returns the expiry time point of the key. * Returns the expiry time point of the key. Note: this limit is arbitrary. RSA keys don't expire,
* Note: this limit is arbitrary. RSA keys don't expire, * but the signature of this key as provided by the session server will expire.
* but the signature of this key as provided by the session
* server will expire.
* *
* @return the expiry time point * @return the expiry time point
*/ */
@ -53,9 +51,8 @@ public interface KeySigned {
byte[] signature(); byte[] signature();
/** /**
* Validates the signature, expiry temporal and key against the * Validates the signature, expiry temporal and key against the signer public key. Note: This will
* signer public key. Note: This will **not** check for * **not** check for expiry. You can check for expiry with {@link KeySigned#hasExpired()}.
* expiry. You can check for expiry with {@link KeySigned#hasExpired()}.
* <p>DOES NOT WORK YET FOR MESSAGES AND COMMANDS!</p> * <p>DOES NOT WORK YET FOR MESSAGES AND COMMANDS!</p>
* Addendum: Does not work for 1.19.1 until the user has authenticated. * Addendum: Does not work for 1.19.1 until the user has authenticated.
* *

Datei anzeigen

@ -7,6 +7,8 @@
package com.velocitypowered.api.proxy.messages; package com.velocitypowered.api.proxy.messages;
import net.kyori.adventure.key.Key;
/** /**
* Represents a channel identifier for use with plugin messaging. * Represents a channel identifier for use with plugin messaging.
*/ */
@ -18,4 +20,27 @@ public interface ChannelIdentifier {
* @return the textual representation of the identifier * @return the textual representation of the identifier
*/ */
String id(); String id();
/**
* Returns a channel identifier to identify a channel for Minecraft clients older than Minecraft
* 1.13.
*
* @param name the channel name to use
* @return the channel identifier with the given name
*/
static ChannelIdentifier legacy(String name) {
return new LegacyChannelIdentifier(name);
}
/**
* Returns a channel identifier to identify a channel for Minecraft clients newer or equal to
* Minecraft 1.13. This uses a Minecraft resource code of the form {@code namespace:name}.
*
* @param key the channel name to use
* @return the channel identifier with the given name
*/
static ChannelIdentifier ofKey(Key key) {
return new MinecraftChannelIdentifier(key);
}
} }

Datei anzeigen

@ -17,7 +17,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
* messages, please see {@link MinecraftChannelIdentifier}. This class is immutable and safe for * messages, please see {@link MinecraftChannelIdentifier}. This class is immutable and safe for
* multi-threaded use. * multi-threaded use.
*/ */
public final class LegacyChannelIdentifier implements ChannelIdentifier { final class LegacyChannelIdentifier implements ChannelIdentifier {
private final String name; private final String name;
@ -26,7 +26,7 @@ public final class LegacyChannelIdentifier implements ChannelIdentifier {
* *
* @param name the name for the channel * @param name the name for the channel
*/ */
public LegacyChannelIdentifier(String name) { LegacyChannelIdentifier(String name) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(name), "provided name is empty"); Preconditions.checkArgument(!Strings.isNullOrEmpty(name), "provided name is empty");
this.name = name; this.name = name;
} }
@ -54,7 +54,7 @@ public final class LegacyChannelIdentifier implements ChannelIdentifier {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(name); return name.hashCode();
} }
@Override @Override

Datei anzeigen

@ -7,11 +7,7 @@
package com.velocitypowered.api.proxy.messages; package com.velocitypowered.api.proxy.messages;
import static com.google.common.base.Preconditions.checkArgument;
import com.google.common.base.Strings;
import java.util.Objects; import java.util.Objects;
import java.util.regex.Pattern;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -19,94 +15,17 @@ import org.checkerframework.checker.nullness.qual.Nullable;
* Represents a Minecraft 1.13+ channel identifier. This class is immutable and safe for * Represents a Minecraft 1.13+ channel identifier. This class is immutable and safe for
* multi-threaded use. * multi-threaded use.
*/ */
public final class MinecraftChannelIdentifier implements ChannelIdentifier { final class MinecraftChannelIdentifier implements ChannelIdentifier {
private static final Pattern VALID_IDENTIFIER_REGEX = Pattern.compile("[a-z0-9/\\-_]*"); private final Key key;
private final String namespace; MinecraftChannelIdentifier(Key key) {
private final String name; this.key = key;
private MinecraftChannelIdentifier(String namespace, String name) {
this.namespace = namespace;
this.name = name;
}
/**
* Creates an identifier in the default namespace ({@code minecraft}). Plugins are strongly
* encouraged to provide their own namespace.
*
* @param name the name in the default namespace to use
* @return a new channel identifier
*/
public static MinecraftChannelIdentifier forDefaultNamespace(String name) {
return new MinecraftChannelIdentifier("minecraft", name);
}
/**
* Creates an identifier in the specified namespace.
*
* @param namespace the namespace to use
* @param name the channel name inside the specified namespace
* @return a new channel identifier
*/
public static MinecraftChannelIdentifier create(String namespace, String name) {
checkArgument(!Strings.isNullOrEmpty(namespace), "namespace is null or empty");
checkArgument(name != null, "namespace is null or empty");
checkArgument(VALID_IDENTIFIER_REGEX.matcher(namespace).matches(),
"namespace is not valid, must match: %s got %s",
VALID_IDENTIFIER_REGEX.toString(),
namespace);
checkArgument(VALID_IDENTIFIER_REGEX.matcher(name).matches(),
"name is not valid, must match: %s got %s",
VALID_IDENTIFIER_REGEX.toString(),
name);
return new MinecraftChannelIdentifier(namespace, name);
}
/**
* Creates an channel identifier from the specified Minecraft identifier.
*
* @param identifier the Minecraft identifier
* @return a new channel identifier
*/
public static MinecraftChannelIdentifier from(String identifier) {
int colonPos = identifier.indexOf(':');
if (colonPos == -1) {
throw new IllegalArgumentException("Identifier does not contain a colon.");
}
if (colonPos + 1 == identifier.length()) {
throw new IllegalArgumentException("Identifier is empty.");
}
String namespace = identifier.substring(0, colonPos);
String name = identifier.substring(colonPos + 1);
return create(namespace, name);
}
/**
* Creates an channel identifier from the specified Minecraft identifier.
*
* @param key the Minecraft key to use
* @return a new channel identifier
*/
public static MinecraftChannelIdentifier from(Key key) {
return create(key.namespace(), key.value());
}
public String getNamespace() {
return namespace;
}
public String getName() {
return name;
}
public Key asKey() {
return Key.key(namespace, name);
} }
@Override @Override
public String toString() { public String toString() {
return namespace + ":" + name + " (modern)"; return this.key.asString() + " (modern)";
} }
@Override @Override
@ -118,17 +37,16 @@ public final class MinecraftChannelIdentifier implements ChannelIdentifier {
return false; return false;
} }
MinecraftChannelIdentifier that = (MinecraftChannelIdentifier) o; MinecraftChannelIdentifier that = (MinecraftChannelIdentifier) o;
return Objects.equals(namespace, that.namespace) return Objects.equals(key, that.key);
&& Objects.equals(name, that.name);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(namespace, name); return key.hashCode();
} }
@Override @Override
public String id() { public String id() {
return namespace + ":" + name; return key.asString();
} }
} }

Datei anzeigen

@ -14,6 +14,7 @@ import java.util.UUID;
* Represents a chat session held by a player. * Represents a chat session held by a player.
*/ */
public interface ChatSession extends KeyIdentifiable { public interface ChatSession extends KeyIdentifiable {
/** /**
* Returns the {@link UUID} of the session. * Returns the {@link UUID} of the session.
* *

Datei anzeigen

@ -5,17 +5,18 @@
* reference the LICENSE file in the api top-level directory. * reference the LICENSE file in the api top-level directory.
*/ */
package com.velocitypowered.api.proxy; package com.velocitypowered.api.proxy.player;
import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.event.player.PlayerResourcePackStatusEvent; import com.velocitypowered.api.event.player.PlayerResourcePackStatusEvent;
import com.velocitypowered.api.network.connection.InboundConnection;
import com.velocitypowered.api.network.connection.ServerConnection;
import com.velocitypowered.api.proxy.ConnectionRequestBuilder;
import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.proxy.crypto.KeyIdentifiable; import com.velocitypowered.api.proxy.crypto.KeyIdentifiable;
import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import com.velocitypowered.api.proxy.messages.ChannelMessageSink; import com.velocitypowered.api.proxy.messages.ChannelMessageSink;
import com.velocitypowered.api.proxy.messages.ChannelMessageSource; import com.velocitypowered.api.proxy.messages.ChannelMessageSource;
import com.velocitypowered.api.proxy.player.PlayerSettings;
import com.velocitypowered.api.proxy.player.ResourcePackInfo;
import com.velocitypowered.api.proxy.player.TabList;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.api.util.GameProfile;
import com.velocitypowered.api.util.ModInfo; import com.velocitypowered.api.util.ModInfo;
@ -186,19 +187,17 @@ public interface Player extends
void spoofChatInput(String input); void spoofChatInput(String input);
/** /**
* Queues and sends a new Resource-pack offer to the player. * Queues and sends a new Resource-pack offer to the player. To monitor the status of the sent
* To monitor the status of the sent resource pack, subscribe to * resource pack, subscribe to {@link PlayerResourcePackStatusEvent}. To create a
* {@link PlayerResourcePackStatusEvent}. * {@link ResourcePackInfo} use the {@link ProxyServer#createResourcePackBuilder(String)}
* To create a {@link ResourcePackInfo} use the * builder.
* {@link ProxyServer#createResourcePackBuilder(String)} builder.
* *
* @param packInfo the resource-pack in question * @param packInfo the resource-pack in question
*/ */
void sendResourcePackOffer(ResourcePackInfo packInfo); void sendResourcePackOffer(ResourcePackInfo packInfo);
/** /**
* Gets the {@link ResourcePackInfo} of the currently applied * Gets the {@link ResourcePackInfo} of the currently applied resource-pack or null if none.
* resource-pack or null if none.
* *
* @return the applied resource pack or null if none. * @return the applied resource pack or null if none.
*/ */
@ -206,9 +205,8 @@ public interface Player extends
ResourcePackInfo appliedResourcePack(); ResourcePackInfo appliedResourcePack();
/** /**
* Gets the {@link ResourcePackInfo} of the resource pack * Gets the {@link ResourcePackInfo} of the resource pack the user is currently downloading or is
* the user is currently downloading or is currently * currently prompted to install or null if none.
* prompted to install or null if none.
* *
* @return the pending resource pack or null if none * @return the pending resource pack or null if none
*/ */
@ -217,9 +215,9 @@ public interface Player extends
/** /**
* <strong>Note that this method does not send a plugin message to the server the player * <strong>Note that this method does not send a plugin message to the server the player
* is connected to.</strong> You should only use this method if you are trying to communicate * is connected to.</strong> You should only use this method if you are trying to communicate with
* with a mod that is installed on the player's client. To send a plugin message to the server * a mod that is installed on the player's client. To send a plugin message to the server from the
* from the player, you should use the equivalent method on the instance returned by * player, you should use the equivalent method on the instance returned by
* {@link #connectedServer()}. * {@link #connectedServer()}.
* *
* @inheritDoc * @inheritDoc

Datei anzeigen

@ -59,9 +59,8 @@ public interface PlayerSettings {
/** /**
* Returns whether the client explicitly allows listing on the * Returns whether the client explicitly allows listing on the
* {@link com.velocitypowered.api.proxy.player.TabList} or not in * {@link com.velocitypowered.api.proxy.player.TabList} or not in anonymous TabList mode. This
* anonymous TabList mode. * feature was introduced in 1.18.
* This feature was introduced in 1.18.
* *
* @return whether or not the client explicitly allows listing. Always false on older clients. * @return whether or not the client explicitly allows listing. Always false on older clients.
*/ */

Datei anzeigen

@ -23,8 +23,8 @@ public interface ResourcePackInfo {
String url(); String url();
/** /**
* Gets the {@link Component} that is displayed on the resource-pack prompt. * Gets the {@link Component} that is displayed on the resource-pack prompt. This is only
* This is only displayed if the client version is 1.17 or newer. * displayed if the client version is 1.17 or newer.
* *
* @return the prompt if present or null otherwise * @return the prompt if present or null otherwise
*/ */
@ -32,16 +32,16 @@ public interface ResourcePackInfo {
Component prompt(); Component prompt();
/** /**
* Gets whether or not the acceptance of the resource-pack is enforced. * Gets whether or not the acceptance of the resource-pack is enforced. See
* See {@link Builder#required(boolean)} for more information. * {@link Builder#required(boolean)} for more information.
* *
* @return whether or not to force usage of this resource-pack * @return whether or not to force usage of this resource-pack
*/ */
boolean required(); boolean required();
/** /**
* Gets the SHA-1 hash of the resource-pack * Gets the SHA-1 hash of the resource-pack See {@link Builder#hash(byte[])} for more
* See {@link Builder#hash(byte[])} for more information. * information.
* *
* @return the hash if present or null otherwise * @return the hash if present or null otherwise
*/ */
@ -56,8 +56,8 @@ public interface ResourcePackInfo {
Origin origin(); Origin origin();
/** /**
* Gets the original {@link Origin} of the resource-pack. * Gets the original {@link Origin} of the resource-pack. The original origin may differ if the
* The original origin may differ if the resource pack was altered in the event * resource pack was altered in the event
* {@link com.velocitypowered.api.event.player.ServerResourcePackSendEvent}. * {@link com.velocitypowered.api.event.player.ServerResourcePackSendEvent}.
* *
* @return the origin of the resource pack * @return the origin of the resource pack
@ -65,12 +65,11 @@ public interface ResourcePackInfo {
Origin originalOrigin(); Origin originalOrigin();
/** /**
* Returns a copy of this {@link ResourcePackInfo} instance as a builder so that it can * Returns a copy of this {@link ResourcePackInfo} instance as a builder so that it can be
* be modified. * modified. It is <b>not</b> guaranteed that
* It is <b>not</b> guaranteed that
* {@code resourcePackInfo.asBuilder().build().equals(resourcePackInfo)} is true. That is due to * {@code resourcePackInfo.asBuilder().build().equals(resourcePackInfo)} is true. That is due to
* the transient {@link ResourcePackInfo#origin()} and * the transient {@link ResourcePackInfo#origin()} and {@link ResourcePackInfo#originalOrigin()}
* {@link ResourcePackInfo#originalOrigin()} fields. * fields.
* *
* @return a content-copy of this instance as a {@link ResourcePackInfo.Builder} * @return a content-copy of this instance as a {@link ResourcePackInfo.Builder}
*/ */
@ -85,7 +84,6 @@ public interface ResourcePackInfo {
* {@link ResourcePackInfo#originalOrigin()} fields are transient. * {@link ResourcePackInfo#originalOrigin()} fields are transient.
* *
* @param newUrl The new URL to use in the updated builder. * @param newUrl The new URL to use in the updated builder.
*
* @return a content-copy of this instance as a {@link ResourcePackInfo.Builder} * @return a content-copy of this instance as a {@link ResourcePackInfo.Builder}
*/ */
ResourcePackInfo.Builder asBuilder(String newUrl); ResourcePackInfo.Builder asBuilder(String newUrl);
@ -96,40 +94,34 @@ public interface ResourcePackInfo {
interface Builder { interface Builder {
/** /**
* Sets the resource-pack as required to play on the network. * Sets the resource-pack as required to play on the network. This feature was introduced in
* This feature was introduced in 1.17. * 1.17. Setting this to true has one of two effects: If the client is on 1.17 or newer: - The
* Setting this to true has one of two effects: * resource-pack prompt will display without a decline button - Accept or disconnect are the
* If the client is on 1.17 or newer: * only available options but players may still press escape. - Forces the resource-pack offer
* - The resource-pack prompt will display without a decline button * prompt to display even if the player has previously declined or disabled resource packs - The
* - Accept or disconnect are the only available options but players may still press escape. * player will be disconnected from the network if they close/skip the prompt. If the client is
* - Forces the resource-pack offer prompt to display even if the player has * on a version older than 1.17: - If the player accepts the resource pack or has previously
* previously declined or disabled resource packs * accepted a resource-pack then nothing else will happen. - If the player declines the resource
* - The player will be disconnected from the network if they close/skip the prompt. * pack or has previously declined a resource-pack the player will be disconnected from the
* If the client is on a version older than 1.17: * network
* - If the player accepts the resource pack or has previously accepted a resource-pack
* then nothing else will happen.
* - If the player declines the resource pack or has previously declined a resource-pack
* the player will be disconnected from the network
* *
* @param shouldForce whether or not to force the client to accept the resource pack * @param shouldForce whether or not to force the client to accept the resource pack
*/ */
Builder required(boolean shouldForce); Builder required(boolean shouldForce);
/** /**
* Sets the SHA-1 hash of the provided resource pack. * Sets the SHA-1 hash of the provided resource pack. Note: It is recommended to always set this
* Note: It is recommended to always set this hash. * hash. If this hash is not set/ not present then the client will always download the resource
* If this hash is not set/ not present then the client will always download * pack even if it may still be cached. By having this hash present, the client will check first
* the resource pack even if it may still be cached. By having this hash present, * whether or not a resource pack by this hash is cached before downloading.
* the client will check first whether or not a resource pack by this hash is cached
* before downloading.
* *
* @param hash the SHA-1 hash of the resource-pack * @param hash the SHA-1 hash of the resource-pack
*/ */
Builder hash(@Nullable byte[] hash); Builder hash(@Nullable byte[] hash);
/** /**
* Sets a {@link Component} to display on the download prompt. * Sets a {@link Component} to display on the download prompt. This will only display if the
* This will only display if the client version is 1.17 or newer. * client version is 1.17 or newer.
* *
* @param prompt the component to display * @param prompt the component to display
*/ */
@ -137,8 +129,8 @@ public interface ResourcePackInfo {
/** /**
* Builds the {@link ResourcePackInfo} from the provided info for use with * Builds the {@link ResourcePackInfo} from the provided info for use with
* {@link com.velocitypowered.api.proxy.Player#sendResourcePackOffer(ResourcePackInfo)}. * {@link Player#sendResourcePackOffer(ResourcePackInfo)}. Note: Some features may be
* Note: Some features may be version-dependent. Check before use. * version-dependent. Check before use.
* *
* @return a ResourcePackInfo instance from the provided information * @return a ResourcePackInfo instance from the provided information
*/ */

Datei anzeigen

@ -7,7 +7,6 @@
package com.velocitypowered.api.proxy.player; package com.velocitypowered.api.proxy.player;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.crypto.IdentifiedKey; import com.velocitypowered.api.proxy.crypto.IdentifiedKey;
import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.api.util.GameProfile;
import java.util.Collection; import java.util.Collection;

Datei anzeigen

@ -18,6 +18,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
* Represents a single entry in a {@link TabList}. * Represents a single entry in a {@link TabList}.
*/ */
public interface TabListEntry extends KeyIdentifiable { public interface TabListEntry extends KeyIdentifiable {
/** /**
* Returns the {@link ChatSession} associated with this entry. * Returns the {@link ChatSession} associated with this entry.
* *

Datei anzeigen

@ -17,13 +17,13 @@ import net.kyori.adventure.builder.AbstractBuilder;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
* Contains the parameters used to ping a {@link RegisteredServer}. * Contains the parameters used to ping a {@link RegisteredServer}. This class is immutable.
* This class is immutable.
* *
* @since 3.2.0
* @see RegisteredServer#ping(PingOptions) * @see RegisteredServer#ping(PingOptions)
* @since 3.2.0
*/ */
public final class PingOptions { public final class PingOptions {
/** /**
* Default PingOptions. * Default PingOptions.
*/ */
@ -95,6 +95,7 @@ public final class PingOptions {
* @since 3.2.0 * @since 3.2.0
*/ */
public static final class Builder implements AbstractBuilder<PingOptions> { public static final class Builder implements AbstractBuilder<PingOptions> {
private ProtocolVersion protocolVersion = ProtocolVersion.UNKNOWN; private ProtocolVersion protocolVersion = ProtocolVersion.UNKNOWN;
private long timeout = 0; private long timeout = 0;
@ -116,11 +117,9 @@ public final class PingOptions {
/** /**
* Sets the maximum time to wait to get the required {@link ServerPing}. * Sets the maximum time to wait to get the required {@link ServerPing}.
* *
* @param timeout the timeout duration * @param timeout the timeout duration A value of 0 means that the read-timeout value from the
* A value of 0 means that the read-timeout value * Velocity configuration will be used, while a negative value means that there
* from the Velocity configuration will be used, * will be no timeout.
* while a negative value means that there will
* be no timeout.
* @return this builder * @return this builder
*/ */
public Builder timeout(final @NotNull Duration timeout) { public Builder timeout(final @NotNull Duration timeout) {
@ -132,11 +131,9 @@ public final class PingOptions {
/** /**
* Sets the maximum time to wait to get the required {@link ServerPing}. * Sets the maximum time to wait to get the required {@link ServerPing}.
* *
* @param time the timeout duration * @param time the timeout duration A value of 0 means that the read-timeout value from the
* A value of 0 means that the read-timeout value * Velocity configuration will be used, while a negative value means that there
* from the Velocity configuration will be used, * will be no timeout.
* while a negative value means that there will
* be no timeout.
* @param timeunit the unit of time to be used to provide the timeout duration * @param timeunit the unit of time to be used to provide the timeout duration
* @return this builder * @return this builder
*/ */

Datei anzeigen

@ -55,8 +55,8 @@ public final class QueryResponse {
} }
/** /**
* Get hostname which will be used to reply to the query. By default it is {@link * Get hostname which will be used to reply to the query. By default it is
* ProxyConfig#getMotd()} in plain text without colour codes. * {@link ProxyConfig#getMotd()} in plain text without colour codes.
* *
* @return hostname * @return hostname
*/ */
@ -75,8 +75,8 @@ public final class QueryResponse {
} }
/** /**
* Get map name which will be used to reply to the query. By default {@link * Get map name which will be used to reply to the query. By default
* ProxyConfig#getQueryMap()} is sent. * {@link ProxyConfig#getQueryMap()} is sent.
* *
* @return map name * @return map name
*/ */
@ -149,10 +149,10 @@ public final class QueryResponse {
/** /**
* Creates a new {@link Builder} instance from data represented by this response, so that you * Creates a new {@link Builder} instance from data represented by this response, so that you may
* may create a new {@link QueryResponse} with new data. It is guaranteed that * create a new {@link QueryResponse} with new data. It is guaranteed that
* {@code queryResponse.toBuilder().build().equals(queryResponse)}: that is, if no other * {@code queryResponse.toBuilder().build().equals(queryResponse)}: that is, if no other changes
* changes are made to the returned builder, the built instance will equal the original instance. * are made to the returned builder, the built instance will equal the original instance.
* *
* @return {@link QueryResponse} builder * @return {@link QueryResponse} builder
*/ */
@ -227,6 +227,7 @@ public final class QueryResponse {
* A builder for {@link QueryResponse} objects. * A builder for {@link QueryResponse} objects.
*/ */
public static final class Builder { public static final class Builder {
private @MonotonicNonNull String hostname; private @MonotonicNonNull String hostname;
private @MonotonicNonNull String gameVersion; private @MonotonicNonNull String gameVersion;
private @MonotonicNonNull String map; private @MonotonicNonNull String map;

Datei anzeigen

@ -7,8 +7,8 @@
package com.velocitypowered.api.proxy.server; package com.velocitypowered.api.proxy.server;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.messages.ChannelMessageSink; import com.velocitypowered.api.proxy.messages.ChannelMessageSink;
import com.velocitypowered.api.proxy.player.Player;
import java.util.Collection; import java.util.Collection;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import net.kyori.adventure.audience.Audience; import net.kyori.adventure.audience.Audience;
@ -42,8 +42,8 @@ public interface RegisteredServer extends ChannelMessageSink, Audience {
CompletableFuture<ServerPing> ping(); CompletableFuture<ServerPing> ping();
/** /**
* Attempts to ping the remote server and return the server list ping result * Attempts to ping the remote server and return the server list ping result according to the
* according to the options provided. * options provided.
* *
* @param pingOptions the options provided for pinging the server * @param pingOptions the options provided for pinging the server
* @return the server ping result from the server * @return the server ping result from the server

Datei anzeigen

@ -109,10 +109,9 @@ public final class ServerPing {
} }
/** /**
* Returns a copy of this {@link ServerPing} instance as a builder so that it can be modified. * Returns a copy of this {@link ServerPing} instance as a builder so that it can be modified. It
* It is guaranteed that {@code ping.asBuilder().build().equals(ping)} is true: that is, if no * is guaranteed that {@code ping.asBuilder().build().equals(ping)} is true: that is, if no other
* other changes are made to the returned builder, the built instance will equal the original * changes are made to the returned builder, the built instance will equal the original instance.
* instance.
* *
* @return a copy of this instance as a {@link Builder} * @return a copy of this instance as a {@link Builder}
*/ */
@ -307,10 +306,9 @@ public final class ServerPing {
} }
/** /**
* Represents the version of the server sent to the client. A protocol version * Represents the version of the server sent to the client. A protocol version that does not match
* that does not match the client's protocol version will show up on the server * the client's protocol version will show up on the server list as an incompatible version, but
* list as an incompatible version, but the client will still permit the user * the client will still permit the user to connect to the server anyway.
* to connect to the server anyway.
*/ */
public static final class Version { public static final class Version {
@ -363,8 +361,8 @@ public final class ServerPing {
} }
/** /**
* Represents what the players the server purports to have online, its maximum capacity, * Represents what the players the server purports to have online, its maximum capacity, and a
* and a sample of players on the server. * sample of players on the server.
*/ */
public static final class Players { public static final class Players {

Datei anzeigen

@ -44,7 +44,7 @@ class FastUuidSansHyphens {
private static final int MOJANG_BROKEN_UUID_LENGTH = 32; private static final int MOJANG_BROKEN_UUID_LENGTH = 32;
private static final char[] HEX_DIGITS = private static final char[] HEX_DIGITS =
new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
private static final long[] HEX_VALUES = new long[128]; private static final long[] HEX_VALUES = new long[128];
@ -82,13 +82,11 @@ class FastUuidSansHyphens {
} }
/** /**
* Parses a UUID from the given character sequence. The character sequence must represent a * Parses a UUID from the given character sequence. The character sequence must represent a Mojang
* Mojang UUID. * UUID.
* *
* @param uuidSequence the character sequence from which to parse a UUID * @param uuidSequence the character sequence from which to parse a UUID
*
* @return the UUID represented by the given character sequence * @return the UUID represented by the given character sequence
*
* @throws IllegalArgumentException if the given character sequence does not conform to the string * @throws IllegalArgumentException if the given character sequence does not conform to the string
* representation of a Mojang UUID. * representation of a Mojang UUID.
*/ */
@ -142,7 +140,6 @@ class FastUuidSansHyphens {
* Mojang-style UUID. * Mojang-style UUID.
* *
* @param uuid the UUID to represent as a string * @param uuid the UUID to represent as a string
*
* @return a string representation of the given UUID * @return a string representation of the given UUID
*/ */
public static String toString(final UUID uuid) { public static String toString(final UUID uuid) {

Datei anzeigen

@ -1,63 +0,0 @@
/*
* Copyright (C) 2019-2021 Velocity Contributors
*
* The Velocity API is licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in the api top-level directory.
*/
package com.velocitypowered.api.proxy.messages;
import static com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier.create;
import static com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier.from;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
class MinecraftChannelIdentifierTest {
@Test
void createAllowsValidNamespaces() {
create("minecraft", "brand");
}
@Test
void createAllowsEmptyName() {
create("minecraft", "");
}
@Test
void createDisallowsNull() {
assertAll(
() -> assertThrows(IllegalArgumentException.class, () -> create(null, "")),
() -> assertThrows(IllegalArgumentException.class, () -> create("", "")),
() -> assertThrows(IllegalArgumentException.class, () -> create("minecraft", null))
);
}
@Test
void fromIdentifierIsCorrect() {
MinecraftChannelIdentifier expected = MinecraftChannelIdentifier.create("velocity", "test");
assertEquals(expected, MinecraftChannelIdentifier.from("velocity:test"));
}
@Test
void createAllowsSlashes() {
create("velocity", "test/test2");
}
@Test
void fromIdentifierThrowsOnBadValues() {
assertAll(
() -> assertThrows(IllegalArgumentException.class, () -> from("")),
() -> assertThrows(IllegalArgumentException.class, () -> from(":")),
() -> assertThrows(IllegalArgumentException.class, () -> from(":a")),
() -> assertThrows(IllegalArgumentException.class, () -> from("a:")),
() -> assertThrows(IllegalArgumentException.class, () -> from("hello:$$$$$$")),
() -> assertThrows(IllegalArgumentException.class, () -> from("hello::"))
);
}
}

Datei anzeigen

@ -1,5 +1,4 @@
import org.gradle.jvm.tasks.Jar import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.withType
import java.io.ByteArrayOutputStream import java.io.ByteArrayOutputStream
val currentShortRevision = ByteArrayOutputStream().use { val currentShortRevision = ByteArrayOutputStream().use {

Datei anzeigen

@ -10,6 +10,7 @@ extensions.configure<SpotlessExtension> {
} else { } else {
licenseHeaderFile(rootProject.file("HEADER.txt")) licenseHeaderFile(rootProject.file("HEADER.txt"))
} }
importOrder()
removeUnusedImports() removeUnusedImports()
} }
} }

Datei anzeigen

@ -6,7 +6,7 @@
<suppressions> <suppressions>
<suppress checks="MissingJavadocType" <suppress checks="MissingJavadocType"
files="src/main/java/com/velocitypowered/proxy/network/protocol/packet/*" /> files="src/main/java/com/velocitypowered/proxy/network/protocol/packet/*"/>
<suppress checks="MissingJavadocMethod" <suppress checks="MissingJavadocMethod"
files="src/main/java/com/velocitypowered/proxy/network/protocol/packet/*" /> files="src/main/java/com/velocitypowered/proxy/network/protocol/packet/*"/>
</suppressions> </suppressions>

Datei anzeigen

@ -32,7 +32,7 @@
<!-- https://checkstyle.org/config_filters.html#SuppressionFilter --> <!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
<module name="SuppressionFilter"> <module name="SuppressionFilter">
<property name="file" value="${org.checkstyle.google.suppressionfilter.config}" <property name="file" value="${org.checkstyle.google.suppressionfilter.config}"
default="checkstyle-suppressions.xml" /> default="checkstyle-suppressions.xml"/>
<!--<property name="optional" value="true"/>--> <!--<property name="optional" value="true"/>-->
</module> </module>
@ -45,7 +45,8 @@
<module name="LineLength"> <module name="LineLength">
<property name="fileExtensions" value="java"/> <property name="fileExtensions" value="java"/>
<property name="max" value="100"/> <property name="max" value="100"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/> <property name="ignorePattern"
value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module> </module>
<module name="TreeWalker"> <module name="TreeWalker">
@ -104,7 +105,7 @@
<property name="query" value="//RCURLY[parent::SLIST[count(./*)=1] <property name="query" value="//RCURLY[parent::SLIST[count(./*)=1]
or preceding-sibling::*[last()][self::LCURLY]]"/> or preceding-sibling::*[last()][self::LCURLY]]"/>
</module> </module>
<module name="WhitespaceAfter" /> <module name="WhitespaceAfter"/>
<module name="WhitespaceAround"> <module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/> <property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyLambdas" value="true"/> <property name="allowEmptyLambdas" value="true"/>
@ -356,14 +357,14 @@
<!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter --> <!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
<module name="SuppressionXpathFilter"> <module name="SuppressionXpathFilter">
<property name="file" value="${org.checkstyle.google.suppressionxpathfilter.config}" <property name="file" value="${org.checkstyle.google.suppressionxpathfilter.config}"
default="checkstyle-xpath-suppressions.xml" /> default="checkstyle-xpath-suppressions.xml"/>
<property name="optional" value="true"/> <property name="optional" value="true"/>
</module> </module>
<module name="SuppressWarningsHolder" /> <module name="SuppressWarningsHolder"/>
<module name="SuppressionCommentFilter"> <module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)" /> <property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)" /> <property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
<property name="checkFormat" value="$1" /> <property name="checkFormat" value="$1"/>
</module> </module>
<module name="SuppressWithNearbyCommentFilter"> <module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="CHECKSTYLE.SUPPRESS\: ([\w\|]+)"/> <property name="commentFormat" value="CHECKSTYLE.SUPPRESS\: ([\w\|]+)"/>

Datei anzeigen

@ -5,27 +5,38 @@ traditional Java fallbacks.
## Compression ## Compression
* **Supported platforms**: Linux x86_64 and aarch64, with Java 11 `ByteBuffer` API support as a fallback. * **Supported platforms**: Linux x86_64 and aarch64, with Java 11 `ByteBuffer` API support as a
fallback.
Compiled on CentOS 7. Compiled on CentOS 7.
* **Rationale**: Using a native zlib wrapper, we can avoid multiple trips into Java just to copy memory around. * **Rationale**: Using a native zlib wrapper, we can avoid multiple trips into Java just to copy
memory around.
## Encryption ## Encryption
* **Supported platforms**: Linux x86_64 (OpenSSL 1.0.x and OpenSSL 1.1.x) and aarch64 (OpenSSL 1.1.x only) * **Supported platforms**: Linux x86_64 (OpenSSL 1.0.x and OpenSSL 1.1.x) and aarch64 (OpenSSL 1.1.x
* **Rationale**: Using a C library for encryption means we can limit memory copies. Prior to Java 7, this was the only only)
way to use AES-NI extensions on modern processors, but this is less important since JDK 8 has native support. * **Rationale**: Using a C library for encryption means we can limit memory copies. Prior to Java 7,
* OpenSSL is not included in Velocity. Every distribution provides it now. To deal with ABI incompatibilities, this was the only
the native library (which only calls into OpenSSL and contains no cryptographic code) are available for way to use AES-NI extensions on modern processors, but this is less important since JDK 8 has
CentOS 7 (OpenSSL 1.0.0-based), Debian 9 (OpenSSL 1.1.0-based) and Debian Bookworm (OpenSSL 3.0.0-based) native support.
* OpenSSL is not included in Velocity. Every distribution provides it now. To deal with ABI
incompatibilities,
the native library (which only calls into OpenSSL and contains no cryptographic code) are
available for
CentOS 7 (OpenSSL 1.0.0-based), Debian 9 (OpenSSL 1.1.0-based) and Debian Bookworm (OpenSSL
3.0.0-based)
to provide the widest, most reasonable compatibility with most modern distributions. to provide the widest, most reasonable compatibility with most modern distributions.
## OS support ## OS support
The natives intend to have the widest possible range of compatibility with modern Linux distributions The natives intend to have the widest possible range of compatibility with modern Linux
distributions
(defined as those being released in or after 2014). (defined as those being released in or after 2014).
In theory, these libraries can be compiled for any Unix-like system (in the past, we supported macOS), In theory, these libraries can be compiled for any Unix-like system (in the past, we supported
macOS),
but interest in other systems is minimal at best, thus we focus on Linux x86_64 and aarch64 as they but interest in other systems is minimal at best, thus we focus on Linux x86_64 and aarch64 as they
are commonly used platforms. are commonly used platforms.
Alpine Linux support is on a "best-effort" basis only. Using `apk add libc6-compat` may enable native support. Alpine Linux support is on a "best-effort" basis only. Using `apk add libc6-compat` may enable
native support.

Datei anzeigen

@ -23,5 +23,6 @@ import com.velocitypowered.natives.util.BufferPreference;
* Generic interface for any Velocity native. * Generic interface for any Velocity native.
*/ */
public interface Native { public interface Native {
BufferPreference preferredBufferType(); BufferPreference preferredBufferType();
} }

Datei anzeigen

@ -21,6 +21,7 @@ import io.netty.buffer.ByteBuf;
import java.util.zip.DataFormatException; import java.util.zip.DataFormatException;
class CompressorUtils { class CompressorUtils {
/** /**
* The default preferred output buffer size for zlib. * The default preferred output buffer size for zlib.
*/ */

Datei anzeigen

@ -27,6 +27,7 @@ import java.util.zip.DataFormatException;
* implementation. * implementation.
*/ */
public interface VelocityCompressor extends Disposable, Native { public interface VelocityCompressor extends Disposable, Native {
void inflate(ByteBuf source, ByteBuf destination, int uncompressedSize) void inflate(ByteBuf source, ByteBuf destination, int uncompressedSize)
throws DataFormatException; throws DataFormatException;

Datei anzeigen

@ -25,6 +25,7 @@ import io.netty.buffer.ByteBufAllocator;
* Additional utilities for {@link ByteBuf}. * Additional utilities for {@link ByteBuf}.
*/ */
public class MoreByteBufUtils { public class MoreByteBufUtils {
private MoreByteBufUtils() { private MoreByteBufUtils() {
throw new AssertionError(); throw new AssertionError();
} }

Datei anzeigen

@ -25,6 +25,7 @@ import java.util.function.BooleanSupplier;
* Statically-computed constraints for native code. * Statically-computed constraints for native code.
*/ */
public class NativeConstraints { public class NativeConstraints {
private static final boolean NATIVES_ENABLED = !Boolean.getBoolean("velocity.natives-disabled"); private static final boolean NATIVES_ENABLED = !Boolean.getBoolean("velocity.natives-disabled");
private static final boolean IS_AMD64; private static final boolean IS_AMD64;
private static final boolean IS_AARCH64; private static final boolean IS_AARCH64;

Datei anzeigen

@ -24,8 +24,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
/** /**
* The main class. Responsible for parsing command line arguments and then launching the * The main class. Responsible for parsing command line arguments and then launching the proxy.
* proxy.
*/ */
public class Velocity { public class Velocity {

Datei anzeigen

@ -28,8 +28,8 @@ import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.plugin.PluginContainer; import com.velocitypowered.api.plugin.PluginContainer;
import com.velocitypowered.api.plugin.PluginManager; import com.velocitypowered.api.plugin.PluginManager;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.player.ResourcePackInfo; import com.velocitypowered.api.proxy.player.ResourcePackInfo;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.proxy.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;

Datei anzeigen

@ -33,7 +33,7 @@ import com.spotify.futures.CompletableFutures;
import com.velocitypowered.api.command.Command; import com.velocitypowered.api.command.Command;
import com.velocitypowered.api.command.CommandMeta; import com.velocitypowered.api.command.CommandMeta;
import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.proxy.command.brigadier.VelocityArgumentCommandNode; import com.velocitypowered.proxy.command.brigadier.VelocityArgumentCommandNode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -157,8 +157,8 @@ final class SuggestionsProvider<S> {
} }
final Collection<CommandNode<S>> aliases = contextSoFar.getRootNode().getChildren(); final Collection<CommandNode<S>> aliases = contextSoFar.getRootNode().getChildren();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked") final CompletableFuture<Suggestions>[] futures =
final CompletableFuture<Suggestions>[] futures = new CompletableFuture[aliases.size()]; new CompletableFuture[aliases.size()];
int i = 0; int i = 0;
for (final CommandNode<S> node : aliases) { for (final CommandNode<S> node : aliases) {
CompletableFuture<Suggestions> future = Suggestions.empty(); CompletableFuture<Suggestions> future = Suggestions.empty();

Datei anzeigen

@ -28,8 +28,8 @@ import com.mojang.brigadier.tree.ArgumentCommandNode;
import com.mojang.brigadier.tree.LiteralCommandNode; import com.mojang.brigadier.tree.LiteralCommandNode;
import com.velocitypowered.api.command.BrigadierCommand; import com.velocitypowered.api.command.BrigadierCommand;
import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;

Datei anzeigen

@ -25,9 +25,9 @@ import com.mojang.brigadier.tree.ArgumentCommandNode;
import com.mojang.brigadier.tree.LiteralCommandNode; import com.mojang.brigadier.tree.LiteralCommandNode;
import com.velocitypowered.api.command.BrigadierCommand; import com.velocitypowered.api.command.BrigadierCommand;
import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.network.connection.ServerConnection;
import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.proxy.ServerConnection; import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
@ -39,6 +39,7 @@ import net.kyori.adventure.util.TriState;
* Implements the Velocity default {@code /send} command. * Implements the Velocity default {@code /send} command.
*/ */
public class SendCommand { public class SendCommand {
private final ProxyServer server; private final ProxyServer server;
private static final String SERVER_ARG = "server"; private static final String SERVER_ARG = "server";
private static final String PLAYER_ARG = "player"; private static final String PLAYER_ARG = "player";
@ -63,7 +64,7 @@ public class SendCommand {
String argument = context.getArguments().containsKey(PLAYER_ARG) String argument = context.getArguments().containsKey(PLAYER_ARG)
? context.getArgument(PLAYER_ARG, String.class) ? context.getArgument(PLAYER_ARG, String.class)
: ""; : "";
for (Player player : server.getAllPlayers()) { for (Player player : server.onlinePlayers()) {
String playerName = player.username(); String playerName = player.username();
if (playerName.regionMatches(true, 0, argument, 0, argument.length())) { if (playerName.regionMatches(true, 0, argument, 0, argument.length())) {
builder.suggest(playerName); builder.suggest(playerName);

Datei anzeigen

@ -22,9 +22,9 @@ import static net.kyori.adventure.text.event.HoverEvent.showText;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.command.SimpleCommand; import com.velocitypowered.api.command.SimpleCommand;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.network.connection.ServerConnection;
import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.proxy.ServerConnection; import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.proxy.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
import java.util.List; import java.util.List;

Datei anzeigen

@ -413,6 +413,7 @@ public class VelocityCommand implements SimpleCommand {
* Heap SubCommand. * Heap SubCommand.
*/ */
public static class Heap implements SubCommand { public static class Heap implements SubCommand {
private static final Logger logger = LogManager.getLogger(Heap.class); private static final Logger logger = LogManager.getLogger(Heap.class);
private MethodHandle heapGenerator; private MethodHandle heapGenerator;
private Consumer<CommandSource> heapConsumer; private Consumer<CommandSource> heapConsumer;

Datei anzeigen

@ -487,8 +487,8 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
} }
/** /**
* Sets the compression threshold on the connection. You are responsible for sending {@link * Sets the compression threshold on the connection. You are responsible for sending
* SetCompression} beforehand. * {@link SetCompression} beforehand.
* *
* @param threshold the compression threshold to use * @param threshold the compression threshold to use
*/ */

Datei anzeigen

@ -18,10 +18,9 @@
package com.velocitypowered.proxy.connection.backend; package com.velocitypowered.proxy.connection.backend;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.network.connection.ServerConnection;
import com.velocitypowered.api.proxy.ServerConnection; import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import com.velocitypowered.api.proxy.messages.LegacyChannelIdentifier; import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.proxy.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
import com.velocitypowered.api.util.UuidUtils; import com.velocitypowered.api.util.UuidUtils;
@ -41,14 +40,15 @@ import java.net.SocketAddress;
import java.util.Optional; import java.util.Optional;
import java.util.StringJoiner; import java.util.StringJoiner;
import net.kyori.adventure.identity.Identity; import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.ComponentSerializer; import net.kyori.adventure.text.serializer.ComponentSerializer;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
/** /**
* Handles messages coming from servers trying to communicate with the BungeeCord plugin * Handles messages coming from servers trying to communicate with the BungeeCord plugin messaging
* messaging channel interface. * channel interface.
*/ */
@SuppressFBWarnings( @SuppressFBWarnings(
value = "OS_OPEN_STREAM", value = "OS_OPEN_STREAM",
@ -58,10 +58,10 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
) )
public class BungeeCordMessageResponder { public class BungeeCordMessageResponder {
private static final MinecraftChannelIdentifier MODERN_CHANNEL = MinecraftChannelIdentifier private static final ChannelIdentifier MODERN_CHANNEL = ChannelIdentifier.ofKey(
.create("bungeecord", "main"); Key.key("bungeecord", "main"));
private static final LegacyChannelIdentifier LEGACY_CHANNEL = private static final ChannelIdentifier LEGACY_CHANNEL =
new LegacyChannelIdentifier("BungeeCord"); ChannelIdentifier.legacy("BungeeCord");
private final VelocityServer proxy; private final VelocityServer proxy;
private final ConnectedPlayer player; private final ConnectedPlayer player;

Datei anzeigen

@ -20,7 +20,7 @@ package com.velocitypowered.proxy.connection.backend;
import com.velocitypowered.api.event.player.ServerLoginPluginMessageEvent; import com.velocitypowered.api.event.player.ServerLoginPluginMessageEvent;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.proxy.crypto.IdentifiedKey; import com.velocitypowered.api.proxy.crypto.IdentifiedKey;
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier; import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.config.PlayerInfoForwarding; import com.velocitypowered.proxy.config.PlayerInfoForwarding;
import com.velocitypowered.proxy.config.VelocityConfiguration; import com.velocitypowered.proxy.config.VelocityConfiguration;
@ -50,6 +50,7 @@ import java.util.concurrent.CompletableFuture;
import javax.crypto.Mac; import javax.crypto.Mac;
import javax.crypto.SecretKey; import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -108,8 +109,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
} }
final byte[] contents = ByteBufUtil.getBytes(packet.content()); final byte[] contents = ByteBufUtil.getBytes(packet.content());
final MinecraftChannelIdentifier identifier = MinecraftChannelIdentifier final ChannelIdentifier identifier = ChannelIdentifier.ofKey(Key.key(packet.getChannel()));
.from(packet.getChannel());
this.server.eventManager().fire(new ServerLoginPluginMessageEvent(serverConn, identifier, this.server.eventManager().fire(new ServerLoginPluginMessageEvent(serverConn, identifier,
contents, packet.getId())) contents, packet.getId()))
.thenAcceptAsync(event -> { .thenAcceptAsync(event -> {

Datei anzeigen

@ -24,7 +24,7 @@ import static com.velocitypowered.proxy.network.Connections.HANDLER;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.proxy.ServerConnection; import com.velocitypowered.api.network.connection.ServerConnection;
import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.proxy.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
@ -95,8 +95,8 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
/** /**
* Connects to the server. * Connects to the server.
* *
* @return a {@link com.velocitypowered.api.proxy.ConnectionRequestBuilder.Result} * @return a {@link com.velocitypowered.api.proxy.ConnectionRequestBuilder.Result} representing
* representing whether the connection succeeded * whether the connection succeeded
*/ */
public CompletableFuture<Impl> connect() { public CompletableFuture<Impl> connect() {
CompletableFuture<Impl> result = new CompletableFuture<>(); CompletableFuture<Impl> result = new CompletableFuture<>();
@ -357,8 +357,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
} }
/** /**
* Gets whether the {@link JoinGame} packet has been * Gets whether the {@link JoinGame} packet has been sent by this server.
* sent by this server.
* *
* @return Whether the join has been completed. * @return Whether the join has been completed.
*/ */

Datei anzeigen

@ -28,8 +28,6 @@ import com.velocitypowered.api.event.player.PlayerClientBrandEvent;
import com.velocitypowered.api.event.player.TabCompleteEvent; import com.velocitypowered.api.event.player.TabCompleteEvent;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import com.velocitypowered.api.proxy.messages.LegacyChannelIdentifier;
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.connection.ConnectionTypes; import com.velocitypowered.proxy.connection.ConnectionTypes;
import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnection;
@ -80,6 +78,7 @@ import java.util.Queue;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@ -303,9 +302,9 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
List<ChannelIdentifier> channelIdentifiers = new ArrayList<>(); List<ChannelIdentifier> channelIdentifiers = new ArrayList<>();
for (String channel : channels) { for (String channel : channels) {
try { try {
channelIdentifiers.add(MinecraftChannelIdentifier.from(channel)); channelIdentifiers.add(ChannelIdentifier.ofKey(Key.key(channel)));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
channelIdentifiers.add(new LegacyChannelIdentifier(channel)); channelIdentifiers.add(ChannelIdentifier.legacy(channel));
} }
} }
server.eventManager() server.eventManager()

Datei anzeigen

@ -35,13 +35,13 @@ import com.velocitypowered.api.event.player.PlayerResourcePackStatusEvent;
import com.velocitypowered.api.event.player.PlayerSettingsChangedEvent; import com.velocitypowered.api.event.player.PlayerSettingsChangedEvent;
import com.velocitypowered.api.event.player.ServerPreConnectEvent; import com.velocitypowered.api.event.player.ServerPreConnectEvent;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.network.connection.ServerConnection;
import com.velocitypowered.api.permission.PermissionProvider; import com.velocitypowered.api.permission.PermissionProvider;
import com.velocitypowered.api.proxy.ConnectionRequestBuilder; import com.velocitypowered.api.proxy.ConnectionRequestBuilder;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ServerConnection;
import com.velocitypowered.api.proxy.crypto.IdentifiedKey; import com.velocitypowered.api.proxy.crypto.IdentifiedKey;
import com.velocitypowered.api.proxy.crypto.KeyIdentifiable; import com.velocitypowered.api.proxy.crypto.KeyIdentifiable;
import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import com.velocitypowered.api.proxy.player.Player;
import com.velocitypowered.api.proxy.player.PlayerSettings; import com.velocitypowered.api.proxy.player.PlayerSettings;
import com.velocitypowered.api.proxy.player.ResourcePackInfo; import com.velocitypowered.api.proxy.player.ResourcePackInfo;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;

Datei anzeigen

@ -30,8 +30,8 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
/** /**
* Handles the play state between exiting the login phase and establishing the first connection * Handles the play state between exiting the login phase and establishing the first connection to a
* to a backend server. * backend server.
*/ */
public class InitialConnectSessionHandler implements MinecraftSessionHandler { public class InitialConnectSessionHandler implements MinecraftSessionHandler {

Datei anzeigen

@ -18,7 +18,7 @@
package com.velocitypowered.proxy.connection.client; package com.velocitypowered.proxy.connection.client;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.network.connection.InboundConnection;
import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.MinecraftConnectionAssociation; import com.velocitypowered.proxy.connection.MinecraftConnectionAssociation;
import com.velocitypowered.proxy.connection.util.VelocityInboundConnection; import com.velocitypowered.proxy.connection.util.VelocityInboundConnection;

Datei anzeigen

@ -18,7 +18,7 @@
package com.velocitypowered.proxy.connection.client; package com.velocitypowered.proxy.connection.client;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.proxy.LoginPhaseConnection; import com.velocitypowered.api.network.connection.LoginPhaseConnection;
import com.velocitypowered.api.proxy.crypto.IdentifiedKey; import com.velocitypowered.api.proxy.crypto.IdentifiedKey;
import com.velocitypowered.api.proxy.crypto.KeyIdentifiable; import com.velocitypowered.api.proxy.crypto.KeyIdentifiable;
import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.api.proxy.messages.ChannelIdentifier;

Datei anzeigen

@ -76,9 +76,9 @@ public enum LegacyForgeHandshakeClientPhase implements ClientConnectionPhase {
}, },
/** /**
* The Mod list is sent to the server, captured by Velocity. Transition to {@link * The Mod list is sent to the server, captured by Velocity. Transition to
* #WAITING_SERVER_DATA} when an ACK is sent, which indicates to the server to start sending state * {@link #WAITING_SERVER_DATA} when an ACK is sent, which indicates to the server to start
* data. * sending state data.
*/ */
MOD_LIST(LegacyForgeConstants.ACK_DISCRIMINATOR) { MOD_LIST(LegacyForgeConstants.ACK_DISCRIMINATOR) {
@Override @Override
@ -139,9 +139,10 @@ public enum LegacyForgeHandshakeClientPhase implements ClientConnectionPhase {
* The handshake is complete. The handshake can be reset. * The handshake is complete. The handshake can be reset.
* *
* <p>Note that a successful connection to a server does not mean that we will be in this state. * <p>Note that a successful connection to a server does not mean that we will be in this state.
* After a handshake reset, if the next server is vanilla we will still be in the {@link * After a handshake reset, if the next server is vanilla we will still be in the
* #NOT_STARTED} phase, which means we must NOT send a reset packet. This is handled by overriding * {@link #NOT_STARTED} phase, which means we must NOT send a reset packet. This is handled by
* the {@link #resetConnectionPhase(ConnectedPlayer)} in this element (it is usually a no-op). * overriding the {@link #resetConnectionPhase(ConnectedPlayer)} in this element (it is usually a
* no-op).
*/ */
COMPLETE(null) { COMPLETE(null) {
@Override @Override
@ -181,8 +182,8 @@ public enum LegacyForgeHandshakeClientPhase implements ClientConnectionPhase {
* *
* @param packetToAdvanceOn The ID of the packet discriminator that indicates that the client has * @param packetToAdvanceOn The ID of the packet discriminator that indicates that the client has
* moved onto a new phase, and as such, Velocity should do so too * moved onto a new phase, and as such, Velocity should do so too
* (inspecting {@link #nextPhase()}. A null indicates there is * (inspecting {@link #nextPhase()}. A null indicates there is no further
* no further phase to transition to. * phase to transition to.
*/ */
LegacyForgeHandshakeClientPhase(Integer packetToAdvanceOn) { LegacyForgeHandshakeClientPhase(Integer packetToAdvanceOn) {
this.packetToAdvanceOn = packetToAdvanceOn; this.packetToAdvanceOn = packetToAdvanceOn;

Datei anzeigen

@ -23,8 +23,7 @@ import net.kyori.adventure.key.Key;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
/** /**
* Holds the registry data that is sent * Holds the registry data that is sent to the client during the config stage.
* to the client during the config stage.
*/ */
public class ClientConfigData { public class ClientConfigData {
@ -76,6 +75,7 @@ public class ClientConfigData {
* Builder for ClientConfigData. * Builder for ClientConfigData.
*/ */
public static class Builder { public static class Builder {
private VelocityResourcePackInfo resourcePackInfo; private VelocityResourcePackInfo resourcePackInfo;
private DataTag tag; private DataTag tag;
private RegistrySync registry; private RegistrySync registry;

Datei anzeigen

@ -27,6 +27,7 @@ import org.jetbrains.annotations.NotNull;
* Represents a data tag. * Represents a data tag.
*/ */
public class DataTag { public class DataTag {
private final ImmutableList<DataTag.Set> entrySets; private final ImmutableList<DataTag.Set> entrySets;
public DataTag(ImmutableList<DataTag.Set> entrySets) { public DataTag(ImmutableList<DataTag.Set> entrySets) {

Datei anzeigen

@ -53,4 +53,3 @@ public class ConnectionTypeImpl implements ConnectionType {
return original; return original;
} }
} }

Datei anzeigen

@ -162,11 +162,10 @@ public class ServerListPingHandler {
} }
/** /**
* Gets the current server ping for this connection, firing {@code ProxyPingEvent} if the * Gets the current server ping for this connection, firing {@code ProxyPingEvent} if the ping is
* ping is not cached. * not cached.
* *
* @param connection the connection being pinged * @param connection the connection being pinged
*
* @return the server ping as a completable future * @return the server ping as a completable future
*/ */
public CompletableFuture<ServerPing> getPing(VelocityInboundConnection connection) { public CompletableFuture<ServerPing> getPing(VelocityInboundConnection connection) {
@ -176,11 +175,10 @@ public class ServerListPingHandler {
} }
/** /**
* Gets the current server ping for this connection, firing {@code ProxyPingEvent} if the * Gets the current server ping for this connection, firing {@code ProxyPingEvent} if the ping is
* ping is not cached. * not cached.
* *
* @param connection the connection being pinged * @param connection the connection being pinged
*
* @return the server ping as a completable future * @return the server ping as a completable future
*/ */
public CompletableFuture<StatusResponse> getPacketResponse(VelocityInboundConnection connection) { public CompletableFuture<StatusResponse> getPacketResponse(VelocityInboundConnection connection) {

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen