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

Massively improved Javadoc coverage to prepare for Javadoc site.

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-08-25 00:29:22 -04:00
Ursprung 4fb415c845
Commit 7ee56d9f5f
49 geänderte Dateien mit 214 neuen und 79 gelöschten Zeilen

Datei anzeigen

@ -48,6 +48,21 @@ artifacts {
archives sourcesJar archives sourcesJar
} }
javadoc {
options.encoding = 'UTF-8'
options.charSet = 'UTF-8'
options.links(
'http://www.slf4j.org/apidocs/',
'https://google.github.io/guava/releases/25.1-jre/api/docs/',
'https://google.github.io/guice/api-docs/4.2/javadoc/',
'https://jd.kyori.net/text/1.12-1.6.4/',
'https://docs.oracle.com/javase/8/docs/api/'
)
// Disable the crazy super-strict doclint tool in Java 8
options.addStringOption('Xdoclint:none', '-quiet')
}
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {

Datei anzeigen

@ -0,0 +1,4 @@
/**
* Provides a simple command framework.
*/
package com.velocitypowered.api.command;

Datei anzeigen

@ -19,7 +19,7 @@ public interface ResultedEvent<R extends ResultedEvent.Result> {
R getResult(); R getResult();
/** /**
* Sets the result of this event. * Sets the result of this event. The result must be non-null.
* @param result the new result * @param result the new result
*/ */
void setResult(@NonNull R result); void setResult(@NonNull R result);
@ -28,6 +28,11 @@ public interface ResultedEvent<R extends ResultedEvent.Result> {
* Represents a result for an event. * Represents a result for an event.
*/ */
interface Result { interface Result {
/**
* Returns whether or not the event is allowed to proceed. Plugins may choose to skip denied events, and the
* proxy will respect the result of this method.
* @return whether or not the event is allowed to proceed
*/
boolean isAllowed(); boolean isAllowed();
} }

Datei anzeigen

@ -0,0 +1,4 @@
/**
* Provides events for handling incoming connections to the proxy and loigns.
*/
package com.velocitypowered.api.event.connection;

Datei anzeigen

@ -0,0 +1,4 @@
/**
* Provides core support for handling events with Velocity. Subpackages include event classes.
*/
package com.velocitypowered.api.event;

Datei anzeigen

@ -0,0 +1,4 @@
/**
* Provides events to handle setting up permissions for permission subjects.
*/
package com.velocitypowered.api.event.permission;

Datei anzeigen

@ -1,4 +1,4 @@
package com.velocitypowered.api.event.player.gameprofile; package com.velocitypowered.api.event.player;
import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.proxy.InboundConnection;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -43,7 +43,7 @@ public class GameProfileRequestEvent {
/** /**
* Returns the game profile that will be used to initialize the connection with. Should no profile be currently * Returns the game profile that will be used to initialize the connection with. Should no profile be currently
* specified, the one generated by the proxy (for offline mode) or retrieved from the Mojang session servers (for * specified, the one generated by the proxy (for offline mode) or retrieved from the Mojang session servers (for
* online mode). * online mode) will be returned instead.
* @return the user's {@link GameProfile} * @return the user's {@link GameProfile}
*/ */
public GameProfile getGameProfile() { public GameProfile getGameProfile() {
@ -51,7 +51,7 @@ public class GameProfileRequestEvent {
} }
/** /**
* Sets the game profile to use for this connection. Using this method on an online-mode connection is invalid. * Sets the game profile to use for this connection. It is invalid to use this method on an online-mode connection.
* @param gameProfile the profile to use for the connection, {@code null} uses the original profile * @param gameProfile the profile to use for the connection, {@code null} uses the original profile
*/ */
public void setGameProfile(@Nullable GameProfile gameProfile) { public void setGameProfile(@Nullable GameProfile gameProfile) {

Datei anzeigen

@ -2,7 +2,7 @@ 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;
import com.velocitypowered.api.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
/** /**
* This event is fired once the player has successfully connected to the target server and the connection to the previous * This event is fired once the player has successfully connected to the target server and the connection to the previous

Datei anzeigen

@ -3,7 +3,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.proxy.Player; import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
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;

Datei anzeigen

@ -0,0 +1,4 @@
/**
* Provides events for handling actions performed by players.
*/
package com.velocitypowered.api.event.player;

Datei anzeigen

@ -2,8 +2,11 @@ package com.velocitypowered.api.event.proxy;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.proxy.InboundConnection;
import com.velocitypowered.api.server.ServerPing; import com.velocitypowered.api.proxy.server.ServerPing;
/**
* This event is fired when a server list ping request is sent by a remote client.
*/
public class ProxyPingEvent { public class ProxyPingEvent {
private final InboundConnection connection; private final InboundConnection connection;
private ServerPing ping; private ServerPing ping;

Datei anzeigen

@ -0,0 +1,4 @@
/**
* Provides events for handling the lifecycle of the proxy.
*/
package com.velocitypowered.api.event.proxy;

Datei anzeigen

@ -1,5 +0,0 @@
package com.velocitypowered.api;
/**
* Welcome to the Velocity API documentation.
*/

Datei anzeigen

@ -0,0 +1,4 @@
/**
* Provides the basic building blocks for a custom permission system.
*/
package com.velocitypowered.api.permission;

Datei anzeigen

@ -0,0 +1,4 @@
/**
* Provides annotations to handle injecting dependencies for plugins.
*/
package com.velocitypowered.api.plugin.annotation;

Datei anzeigen

@ -0,0 +1,4 @@
/**
* Provides metadata for plugins.
*/
package com.velocitypowered.api.plugin.meta;

Datei anzeigen

@ -0,0 +1,4 @@
/**
* Provides the Velocity plugin API.
*/
package com.velocitypowered.api.plugin;

Datei anzeigen

@ -1,6 +1,6 @@
package com.velocitypowered.api.proxy; package com.velocitypowered.api.proxy;
import com.velocitypowered.api.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
import net.kyori.text.Component; import net.kyori.text.Component;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@ -8,8 +8,8 @@ import java.util.Optional;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
/** /**
* Represents a connection request. A connection request is created using {@link Player#createConnectionRequest(ServerInfo)} * Provides a fluent interface to compose and send a connection request to another server behind the proxy. A connection
* and is used to allow a plugin to compose and request a connection to another Minecraft server using a fluent API. * request is created using {@link Player#createConnectionRequest(ServerInfo)}.
*/ */
public interface ConnectionRequestBuilder { public interface ConnectionRequestBuilder {
/** /**
@ -50,7 +50,7 @@ public interface ConnectionRequestBuilder {
Status getStatus(); Status getStatus();
/** /**
* Returns a reason for the failure to connect to the server. None may be provided. * Returns an (optional) textual reason for the failure to connect to the server.
* @return the reason why the user could not connect to the server * @return the reason why the user could not connect to the server
*/ */
Optional<Component> getReason(); Optional<Component> getReason();

Datei anzeigen

@ -4,7 +4,7 @@ import java.net.InetSocketAddress;
import java.util.Optional; import java.util.Optional;
/** /**
* Represents a connection to the proxy. There is no guarantee that the connection has been fully initialized. * Represents an incoming connection to the proxy.
*/ */
public interface InboundConnection { public interface InboundConnection {
/** /**

Datei anzeigen

@ -3,7 +3,7 @@ package com.velocitypowered.api.proxy;
import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.command.CommandSource;
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.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
import com.velocitypowered.api.util.MessagePosition; import com.velocitypowered.api.util.MessagePosition;
import net.kyori.text.Component; import net.kyori.text.Component;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@ -56,19 +56,20 @@ public interface Player extends CommandSource, InboundConnection, ChannelMessage
ConnectionRequestBuilder createConnectionRequest(@NonNull ServerInfo info); ConnectionRequestBuilder createConnectionRequest(@NonNull ServerInfo info);
/** /**
* Sets a header and footer to the player * Sets the tab list header and footer for the player.
* @param header component with header * @param header the header component
* @param footer component with footer * @param footer the footer component
*/ */
void setHeaderAndFooter(Component header, Component footer); void setHeaderAndFooter(Component header, Component footer);
/** /**
* Clears a header and footer for the player * Clears the tab list header and footer for the player.
*/ */
void clearHeaderAndFooter(); void clearHeaderAndFooter();
/** /**
* Disconnects the player with the reason * Disconnects the player with the specified reason. Once this method is called, further calls to other {@link Player}
* methods will become undefined.
* @param reason component with the reason * @param reason component with the reason
*/ */
void disconnect(Component reason); void disconnect(Component reason);

Datei anzeigen

@ -6,27 +6,27 @@ import com.velocitypowered.api.event.EventManager;
import com.velocitypowered.api.plugin.PluginManager; import com.velocitypowered.api.plugin.PluginManager;
import com.velocitypowered.api.proxy.messages.ChannelRegistrar; import com.velocitypowered.api.proxy.messages.ChannelRegistrar;
import com.velocitypowered.api.scheduler.Scheduler; import com.velocitypowered.api.scheduler.Scheduler;
import com.velocitypowered.api.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
import java.util.Collection; import java.util.Collection;
import java.util.Optional; import java.util.Optional;
import java.util.UUID; import java.util.UUID;
/** /**
* Represents a Minecraft proxy server that is compatible with the Velocity API. * Provides an interface to a Minecraft server proxy.
*/ */
public interface ProxyServer { public interface ProxyServer {
/** /**
* Retrieves the player currently connected to this proxy by their Minecraft username. * Retrieves the player currently connected to this proxy by their Minecraft username. The search is case-insensitive.
* @param username the username * @param username the username to search for
* @return an {@link Optional} with the player * @return an {@link Optional} with the player, which may be empty
*/ */
Optional<Player> getPlayer(String username); Optional<Player> getPlayer(String username);
/** /**
* Retrieves the player currently connected to this proxy by their Minecraft UUID. * Retrieves the player currently connected to this proxy by their Minecraft UUID.
* @param uuid the UUID * @param uuid the UUID
* @return an {@link Optional} with the player * @return an {@link Optional} with the player, which may be empty
*/ */
Optional<Player> getPlayer(UUID uuid); Optional<Player> getPlayer(UUID uuid);
@ -44,9 +44,9 @@ public interface ProxyServer {
int getPlayerCount(); int getPlayerCount();
/** /**
* Retrieves a registered {@link ServerInfo} instance by its name. * Retrieves a registered {@link ServerInfo} instance by its name. The search is case-insensitive.
* @param name the name of the server * @param name the name of the server
* @return the server * @return the registered server, which may be empty
*/ */
Optional<ServerInfo> getServerInfo(String name); Optional<ServerInfo> getServerInfo(String name);

Datei anzeigen

@ -2,7 +2,7 @@ package com.velocitypowered.api.proxy;
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.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
/** /**
* Represents a connection to a backend server from the proxy for a client. * Represents a connection to a backend server from the proxy for a client.

Datei anzeigen

@ -4,5 +4,9 @@ package com.velocitypowered.api.proxy.messages;
* Represents a kind of channel identifier. * Represents a kind of channel identifier.
*/ */
public interface ChannelIdentifier { public interface ChannelIdentifier {
/**
* Returns the textual representation of this identifier.
* @return the textual representation of the identifier
*/
String getId(); String getId();
} }

Datei anzeigen

@ -0,0 +1,4 @@
/**
* Provides an interface to receive, handle, and send plugin messages on the proxy from clients and servers.
*/
package com.velocitypowered.api.proxy.messages;

Datei anzeigen

@ -0,0 +1,4 @@
/**
* Provides an interface to interact with the proxy at a low level.
*/
package com.velocitypowered.api.proxy;

Datei anzeigen

@ -1,4 +1,4 @@
package com.velocitypowered.api.server; package com.velocitypowered.api.proxy.server;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;

Datei anzeigen

@ -1,7 +1,8 @@
package com.velocitypowered.api.server; package com.velocitypowered.api.proxy.server;
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.util.Favicon;
import net.kyori.text.Component; import net.kyori.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;
@ -65,6 +66,9 @@ public class ServerPing {
return new Builder(); return new Builder();
} }
/**
* A builder for {@link ServerPing} objects.
*/
public static class Builder { public static class Builder {
private Version version; private Version version;
private int onlinePlayers; private int onlinePlayers;

Datei anzeigen

@ -0,0 +1,4 @@
/**
* Provides utilities to handle server information.
*/
package com.velocitypowered.api.proxy.server;

Datei anzeigen

@ -6,17 +6,50 @@ import java.util.concurrent.TimeUnit;
* Represents a scheduler to execute tasks on the proxy. * Represents a scheduler to execute tasks on the proxy.
*/ */
public interface Scheduler { public interface Scheduler {
/**
* Initializes a new {@link TaskBuilder} for creating a task on the proxy.
* @param plugin the plugin to request the task for
* @param runnable the task to run when scheduled
* @return the task builder
*/
TaskBuilder buildTask(Object plugin, Runnable runnable); TaskBuilder buildTask(Object plugin, Runnable runnable);
/**
* Represents a fluent interface to schedule tasks on the proxy.
*/
interface TaskBuilder { interface TaskBuilder {
/**
* Specifies that the task should delay its execution by the specified amount of time.
* @param time the time to delay by
* @param unit the unit of time for {@code time}
* @return this builder, for chaining
*/
TaskBuilder delay(int time, TimeUnit unit); TaskBuilder delay(int time, TimeUnit unit);
/**
* Specifies that the task should continue running after waiting for the specified amount, until it is cancelled.
* @param time the time to delay by
* @param unit the unit of time for {@code time}
* @return this builder, for chaining
*/
TaskBuilder repeat(int time, TimeUnit unit); TaskBuilder repeat(int time, TimeUnit unit);
/**
* Clears the delay on this task.
* @return this builder, for chaining
*/
TaskBuilder clearDelay(); TaskBuilder clearDelay();
/**
* Clears the repeat interval on this task.
* @return this builder, for chaining
*/
TaskBuilder clearRepeat(); TaskBuilder clearRepeat();
/**
* Schedules this task for execution.
* @return the scheduled task
*/
ScheduledTask schedule(); ScheduledTask schedule();
} }
} }

Datei anzeigen

@ -0,0 +1,4 @@
/**
* Provides utilities for scheduling tasks with a fluent builder.
*/
package com.velocitypowered.api.scheduler;

Datei anzeigen

@ -1,4 +1,4 @@
package com.velocitypowered.api.server; package com.velocitypowered.api.util;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;

Datei anzeigen

@ -8,9 +8,9 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
/** /**
* Represents a Mojang game profile. * Represents a Mojang game profile. This class is immutable.
*/ */
public class GameProfile { public final class GameProfile {
private final String id; private final String id;
private final String name; private final String name;
private final List<Property> properties; private final List<Property> properties;
@ -37,6 +37,11 @@ public class GameProfile {
return properties; return properties;
} }
/**
* Creates a game profile suitable for use in offline-mode.
* @param username the username to use
* @return the new offline-mode game profile
*/
public static GameProfile forOfflinePlayer(@NonNull String username) { public static GameProfile forOfflinePlayer(@NonNull String username) {
Preconditions.checkNotNull(username, "username"); Preconditions.checkNotNull(username, "username");
String id = UuidUtils.toUndashed(UuidUtils.generateOfflinePlayerUuid(username)); String id = UuidUtils.toUndashed(UuidUtils.generateOfflinePlayerUuid(username));
@ -52,7 +57,7 @@ public class GameProfile {
'}'; '}';
} }
public class Property { public final class Property {
private final String name; private final String name;
private final String value; private final String value;
private final String signature; private final String signature;

Datei anzeigen

@ -7,11 +7,19 @@ import java.nio.charset.StandardCharsets;
import java.util.Objects; import java.util.Objects;
import java.util.UUID; import java.util.UUID;
/**
* Provides a small, useful selection of utilities for working with Minecraft UUIDs.
*/
public class UuidUtils { public class UuidUtils {
private UuidUtils() { private UuidUtils() {
throw new AssertionError(); throw new AssertionError();
} }
/**
* Converts from an undashed Mojang-style UUID into a Java {@link UUID} object.
* @param string the string to convert
* @return the UUID object
*/
public static @NonNull UUID fromUndashed(final @NonNull String string) { public static @NonNull UUID fromUndashed(final @NonNull String string) {
Objects.requireNonNull(string, "string"); Objects.requireNonNull(string, "string");
Preconditions.checkArgument(string.length() == 32, "Length is incorrect"); Preconditions.checkArgument(string.length() == 32, "Length is incorrect");
@ -21,11 +29,21 @@ public class UuidUtils {
); );
} }
/**
* Converts from a Java {@link UUID} object into an undashed Mojang-style UUID.
* @param uuid the UUID to convert
* @return the undashed UUID
*/
public static @NonNull String toUndashed(final @NonNull UUID uuid) { public static @NonNull String toUndashed(final @NonNull UUID uuid) {
Preconditions.checkNotNull(uuid, "uuid"); Preconditions.checkNotNull(uuid, "uuid");
return Long.toUnsignedString(uuid.getMostSignificantBits(), 16) + Long.toUnsignedString(uuid.getLeastSignificantBits(), 16); return Long.toUnsignedString(uuid.getMostSignificantBits(), 16) + Long.toUnsignedString(uuid.getLeastSignificantBits(), 16);
} }
/**
* Generates a UUID for use for offline mode.
* @param username the username to use
* @return the offline mode UUID
*/
public static @NonNull UUID generateOfflinePlayerUuid(@NonNull String username) { public static @NonNull UUID generateOfflinePlayerUuid(@NonNull String username) {
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + username).getBytes(StandardCharsets.UTF_8)); return UUID.nameUUIDFromBytes(("OfflinePlayer:" + username).getBytes(StandardCharsets.UTF_8));
} }

Datei anzeigen

@ -0,0 +1,4 @@
/**
* Provides a selection of miscellaneous utilities for use by plugins and the proxy.
*/
package com.velocitypowered.api.util;

Datei anzeigen

@ -10,10 +10,10 @@ import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.event.proxy.ProxyShutdownEvent; import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.server.Favicon; import com.velocitypowered.api.util.Favicon;
import com.velocitypowered.api.plugin.PluginManager; import com.velocitypowered.api.plugin.PluginManager;
import com.velocitypowered.api.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
import com.velocitypowered.network.ConnectionManager; import com.velocitypowered.proxy.network.ConnectionManager;
import com.velocitypowered.proxy.command.ServerCommand; import com.velocitypowered.proxy.command.ServerCommand;
import com.velocitypowered.proxy.command.ShutdownCommand; import com.velocitypowered.proxy.command.ShutdownCommand;
import com.velocitypowered.proxy.command.VelocityCommand; import com.velocitypowered.proxy.command.VelocityCommand;

Datei anzeigen

@ -4,7 +4,7 @@ import com.google.common.collect.ImmutableList;
import com.velocitypowered.api.command.Command; import com.velocitypowered.api.command.Command;
import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.VelocityServer;
import net.kyori.text.TextComponent; import net.kyori.text.TextComponent;
import net.kyori.text.format.TextColor; import net.kyori.text.format.TextColor;

Datei anzeigen

@ -2,7 +2,7 @@ package com.velocitypowered.proxy.config;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.moandjiezana.toml.Toml; import com.moandjiezana.toml.Toml;
import com.velocitypowered.api.server.Favicon; import com.velocitypowered.api.util.Favicon;
import com.velocitypowered.proxy.util.AddressUtil; import com.velocitypowered.proxy.util.AddressUtil;
import com.velocitypowered.api.util.LegacyChatColorUtils; import com.velocitypowered.api.util.LegacyChatColorUtils;
import io.netty.buffer.ByteBufUtil; import io.netty.buffer.ByteBufUtil;

Datei anzeigen

@ -24,14 +24,14 @@ import javax.crypto.spec.SecretKeySpec;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;
import static com.velocitypowered.network.Connections.CIPHER_DECODER; import static com.velocitypowered.proxy.network.Connections.CIPHER_DECODER;
import static com.velocitypowered.network.Connections.CIPHER_ENCODER; import static com.velocitypowered.proxy.network.Connections.CIPHER_ENCODER;
import static com.velocitypowered.network.Connections.COMPRESSION_DECODER; import static com.velocitypowered.proxy.network.Connections.COMPRESSION_DECODER;
import static com.velocitypowered.network.Connections.COMPRESSION_ENCODER; import static com.velocitypowered.proxy.network.Connections.COMPRESSION_ENCODER;
import static com.velocitypowered.network.Connections.FRAME_DECODER; import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER;
import static com.velocitypowered.network.Connections.FRAME_ENCODER; import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER;
import static com.velocitypowered.network.Connections.MINECRAFT_DECODER; import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER;
import static com.velocitypowered.network.Connections.MINECRAFT_ENCODER; import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER;
/** /**
* A utility class to make working with the pipeline a little less painful and transparently handles certain Minecraft * A utility class to make working with the pipeline a little less painful and transparently handles certain Minecraft

Datei anzeigen

@ -2,7 +2,6 @@ package com.velocitypowered.proxy.connection.backend;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
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.ServerConnection;
import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import com.velocitypowered.proxy.config.PlayerInfoForwarding; import com.velocitypowered.proxy.config.PlayerInfoForwarding;
@ -17,7 +16,7 @@ import com.velocitypowered.proxy.protocol.packet.PluginMessage;
import com.velocitypowered.proxy.protocol.packet.ServerLogin; import com.velocitypowered.proxy.protocol.packet.ServerLogin;
import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.StateRegistry;
import com.velocitypowered.api.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import io.netty.channel.*; import io.netty.channel.*;
@ -27,13 +26,13 @@ import io.netty.util.AttributeKey;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static com.velocitypowered.network.Connections.FRAME_DECODER; import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER;
import static com.velocitypowered.network.Connections.FRAME_ENCODER; import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER;
import static com.velocitypowered.network.Connections.HANDLER; import static com.velocitypowered.proxy.network.Connections.HANDLER;
import static com.velocitypowered.network.Connections.MINECRAFT_DECODER; import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER;
import static com.velocitypowered.network.Connections.MINECRAFT_ENCODER; import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER;
import static com.velocitypowered.network.Connections.READ_TIMEOUT; import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT;
import static com.velocitypowered.network.Connections.SERVER_READ_TIMEOUT_SECONDS; import static com.velocitypowered.proxy.network.Connections.SERVER_READ_TIMEOUT_SECONDS;
public class VelocityServerConnection implements MinecraftConnectionAssociation, ServerConnection { public class VelocityServerConnection implements MinecraftConnectionAssociation, ServerConnection {
static final AttributeKey<CompletableFuture<ConnectionRequestBuilder.Result>> CONNECTION_NOTIFIER = static final AttributeKey<CompletableFuture<ConnectionRequestBuilder.Result>> CONNECTION_NOTIFIER =

Datei anzeigen

@ -21,7 +21,7 @@ import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
import com.velocitypowered.proxy.protocol.packet.ClientSettings; import com.velocitypowered.proxy.protocol.packet.ClientSettings;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.protocol.packet.PluginMessage;
import com.velocitypowered.proxy.util.ThrowableUtils; import com.velocitypowered.proxy.util.ThrowableUtils;
import com.velocitypowered.api.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
import com.velocitypowered.proxy.protocol.packet.Disconnect; import com.velocitypowered.proxy.protocol.packet.Disconnect;
import com.velocitypowered.proxy.protocol.packet.HeaderAndFooter; import com.velocitypowered.proxy.protocol.packet.HeaderAndFooter;

Datei anzeigen

@ -9,7 +9,7 @@ import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.config.VelocityConfiguration; import com.velocitypowered.proxy.config.VelocityConfiguration;
import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.api.server.ServerPing; import com.velocitypowered.api.proxy.server.ServerPing;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolConstants; import com.velocitypowered.proxy.protocol.ProtocolConstants;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.StateRegistry;

Datei anzeigen

@ -5,9 +5,9 @@ import com.velocitypowered.api.event.connection.LoginEvent;
import com.velocitypowered.api.event.connection.PreLoginEvent; import com.velocitypowered.api.event.connection.PreLoginEvent;
import com.velocitypowered.api.event.connection.PreLoginEvent.PreLoginComponentResult; import com.velocitypowered.api.event.connection.PreLoginEvent.PreLoginComponentResult;
import com.velocitypowered.api.event.permission.PermissionsSetupEvent; import com.velocitypowered.api.event.permission.PermissionsSetupEvent;
import com.velocitypowered.api.event.player.gameprofile.GameProfileRequestEvent; import com.velocitypowered.api.event.player.GameProfileRequestEvent;
import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.proxy.InboundConnection;
import com.velocitypowered.api.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
import com.velocitypowered.proxy.connection.VelocityConstants; import com.velocitypowered.proxy.connection.VelocityConstants;
import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.api.util.GameProfile;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.MinecraftPacket;

Datei anzeigen

@ -12,7 +12,7 @@ import com.velocitypowered.proxy.protocol.packet.StatusPing;
import com.velocitypowered.proxy.protocol.packet.StatusRequest; import com.velocitypowered.proxy.protocol.packet.StatusRequest;
import com.velocitypowered.proxy.protocol.packet.StatusResponse; import com.velocitypowered.proxy.protocol.packet.StatusResponse;
import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.api.server.ServerPing; import com.velocitypowered.api.proxy.server.ServerPing;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil; import io.netty.buffer.ByteBufUtil;

Datei anzeigen

@ -1,4 +1,4 @@
package com.velocitypowered.network; package com.velocitypowered.proxy.network;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.velocitypowered.natives.util.Natives; import com.velocitypowered.natives.util.Natives;
@ -44,14 +44,7 @@ import java.util.Set;
import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static com.velocitypowered.network.Connections.CLIENT_READ_TIMEOUT_SECONDS; import static com.velocitypowered.proxy.network.Connections.*;
import static com.velocitypowered.network.Connections.FRAME_DECODER;
import static com.velocitypowered.network.Connections.FRAME_ENCODER;
import static com.velocitypowered.network.Connections.LEGACY_PING_DECODER;
import static com.velocitypowered.network.Connections.LEGACY_PING_ENCODER;
import static com.velocitypowered.network.Connections.MINECRAFT_DECODER;
import static com.velocitypowered.network.Connections.MINECRAFT_ENCODER;
import static com.velocitypowered.network.Connections.READ_TIMEOUT;
public final class ConnectionManager { public final class ConnectionManager {
private static final Logger logger = LogManager.getLogger(ConnectionManager.class); private static final Logger logger = LogManager.getLogger(ConnectionManager.class);

Datei anzeigen

@ -1,4 +1,4 @@
package com.velocitypowered.network; package com.velocitypowered.proxy.network;
public interface Connections { public interface Connections {
String CIPHER_DECODER = "cipher-decoder"; String CIPHER_DECODER = "cipher-decoder";

Datei anzeigen

@ -1,6 +1,6 @@
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.protocol.packet;
import com.velocitypowered.api.server.ServerPing; import com.velocitypowered.api.proxy.server.ServerPing;
import net.kyori.text.serializer.ComponentSerializers; import net.kyori.text.serializer.ComponentSerializers;
public class LegacyPingResponse { public class LegacyPingResponse {

Datei anzeigen

@ -1,7 +1,7 @@
package com.velocitypowered.proxy.protocol.util; package com.velocitypowered.proxy.protocol.util;
import com.google.gson.*; import com.google.gson.*;
import com.velocitypowered.api.server.Favicon; import com.velocitypowered.api.util.Favicon;
import java.lang.reflect.Type; import java.lang.reflect.Type;

Datei anzeigen

@ -2,7 +2,7 @@ package com.velocitypowered.proxy.util;
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.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
import java.util.*; import java.util.*;
import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReadWriteLock;

Datei anzeigen

@ -1,6 +1,6 @@
package com.velocitypowered.proxy.util; package com.velocitypowered.proxy.util;
import com.velocitypowered.api.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.net.InetAddress; import java.net.InetAddress;