mirror of
https://github.com/PaperMC/Velocity.git
synced 2026-02-17 14:37:43 +01:00
Start tearing out the prefixes
This commit is contained in:
@@ -49,7 +49,7 @@ public final class BrigadierCommand implements Command {
|
||||
*
|
||||
* @return the command node
|
||||
*/
|
||||
public LiteralCommandNode<CommandSource> getNode() {
|
||||
public LiteralCommandNode<CommandSource> node() {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public interface CommandManager {
|
||||
* @param alias the first command alias
|
||||
* @return a {@link CommandMeta} builder
|
||||
*/
|
||||
CommandMeta.Builder metaBuilder(String alias);
|
||||
CommandMeta.Builder buildMeta(String alias);
|
||||
|
||||
/**
|
||||
* Returns a builder to create a {@link CommandMeta} for
|
||||
@@ -33,7 +33,7 @@ public interface CommandManager {
|
||||
* @param command the command
|
||||
* @return a {@link CommandMeta} builder
|
||||
*/
|
||||
CommandMeta.Builder metaBuilder(BrigadierCommand command);
|
||||
CommandMeta.Builder buildMeta(BrigadierCommand command);
|
||||
|
||||
/**
|
||||
* Registers the specified command with the specified aliases.
|
||||
@@ -46,7 +46,7 @@ public interface CommandManager {
|
||||
* @see Command for a list of registrable subinterfaces
|
||||
*/
|
||||
default void register(String alias, Command command, String... otherAliases) {
|
||||
register(metaBuilder(alias).aliases(otherAliases).build(), command);
|
||||
register(buildMeta(alias).aliases(otherAliases).build(), command);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +88,7 @@ public interface CommandManager {
|
||||
* @param alias the command alias to lookup
|
||||
* @return an {@link CommandMeta} of the alias
|
||||
*/
|
||||
@Nullable CommandMeta getCommandMeta(String alias);
|
||||
@Nullable CommandMeta commandMeta(String alias);
|
||||
|
||||
/**
|
||||
* Attempts to asynchronously execute a command from the given {@code cmdLine}.
|
||||
@@ -117,7 +117,7 @@ public interface CommandManager {
|
||||
*
|
||||
* @return the registered aliases
|
||||
*/
|
||||
Collection<String> getAliases();
|
||||
Collection<String> aliases();
|
||||
|
||||
/**
|
||||
* Returns whether the given alias is registered on this manager.
|
||||
|
||||
@@ -22,7 +22,7 @@ public interface CommandMeta {
|
||||
*
|
||||
* @return the command aliases
|
||||
*/
|
||||
Collection<String> getAliases();
|
||||
Collection<String> aliases();
|
||||
|
||||
/**
|
||||
* Returns an immutable collection containing command nodes that provide
|
||||
@@ -31,7 +31,7 @@ public interface CommandMeta {
|
||||
*
|
||||
* @return the hinting command nodes
|
||||
*/
|
||||
Collection<CommandNode<CommandSource>> getHints();
|
||||
Collection<CommandNode<CommandSource>> hints();
|
||||
|
||||
/**
|
||||
* Returns the plugin who registered the command.
|
||||
@@ -39,7 +39,7 @@ public interface CommandMeta {
|
||||
*
|
||||
* @return the registering plugin
|
||||
*/
|
||||
@Nullable Object getPlugin();
|
||||
@Nullable Object plugin();
|
||||
|
||||
/**
|
||||
* Provides a fluent interface to create {@link CommandMeta}s.
|
||||
|
||||
@@ -12,7 +12,11 @@ package com.velocitypowered.api.event;
|
||||
*/
|
||||
public class PostOrder {
|
||||
|
||||
public static final short FIRST = -32768;
|
||||
private PostOrder() {
|
||||
|
||||
}
|
||||
|
||||
public static final short FIRST = -32767;
|
||||
public static final short EARLY = -16384;
|
||||
public static final short NORMAL = 0;
|
||||
public static final short LATE = 16834;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
package com.velocitypowered.api.event;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.Optional;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
@@ -23,7 +22,7 @@ public interface ResultedEvent<R extends ResultedEvent.Result> {
|
||||
*
|
||||
* @return the result of this event
|
||||
*/
|
||||
R getResult();
|
||||
R result();
|
||||
|
||||
/**
|
||||
* Sets the result of this event. The result must be non-null.
|
||||
@@ -38,12 +37,12 @@ public interface ResultedEvent<R extends ResultedEvent.Result> {
|
||||
interface Result {
|
||||
|
||||
/**
|
||||
* Returns whether or not 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, and the proxy will respect the result of this method.
|
||||
*
|
||||
* @return whether or not the event is allowed to proceed
|
||||
* @return whether the event is allowed to proceed
|
||||
*/
|
||||
boolean isAllowed();
|
||||
boolean allowed();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,7 +60,7 @@ public interface ResultedEvent<R extends ResultedEvent.Result> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowed() {
|
||||
public boolean allowed() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -70,11 +69,11 @@ public interface ResultedEvent<R extends ResultedEvent.Result> {
|
||||
return status ? "allowed" : "denied";
|
||||
}
|
||||
|
||||
public static GenericResult allowed() {
|
||||
public static GenericResult allow() {
|
||||
return ALLOWED;
|
||||
}
|
||||
|
||||
public static GenericResult denied() {
|
||||
public static GenericResult deny() {
|
||||
return DENIED;
|
||||
}
|
||||
}
|
||||
@@ -87,20 +86,20 @@ public interface ResultedEvent<R extends ResultedEvent.Result> {
|
||||
private static final ComponentResult ALLOWED = new ComponentResult(true, null);
|
||||
|
||||
private final boolean status;
|
||||
private final @Nullable Component reason;
|
||||
private final @Nullable Component explanation;
|
||||
|
||||
protected ComponentResult(boolean status, @Nullable Component reason) {
|
||||
private ComponentResult(boolean status, @Nullable Component explanation) {
|
||||
this.status = status;
|
||||
this.reason = reason;
|
||||
this.explanation = explanation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowed() {
|
||||
public boolean allowed() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public Optional<Component> getReasonComponent() {
|
||||
return Optional.ofNullable(reason);
|
||||
public @Nullable Component explanation() {
|
||||
return explanation;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,19 +107,19 @@ public interface ResultedEvent<R extends ResultedEvent.Result> {
|
||||
if (status) {
|
||||
return "allowed";
|
||||
}
|
||||
if (reason != null) {
|
||||
return "denied: " + PlainTextComponentSerializer.plainText().serialize(reason);
|
||||
if (explanation != null) {
|
||||
return "denied: " + PlainTextComponentSerializer.plainText().serialize(explanation);
|
||||
}
|
||||
return "denied";
|
||||
}
|
||||
|
||||
public static ComponentResult allowed() {
|
||||
public static ComponentResult allow() {
|
||||
return ALLOWED;
|
||||
}
|
||||
|
||||
public static ComponentResult denied(Component reason) {
|
||||
Preconditions.checkNotNull(reason, "reason");
|
||||
return new ComponentResult(false, reason);
|
||||
public static ComponentResult deny(Component explanation) {
|
||||
Preconditions.checkNotNull(explanation, "explanation");
|
||||
return new ComponentResult(false, explanation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public final class CommandExecuteEvent implements ResultedEvent<CommandResult> {
|
||||
public CommandExecuteEvent(CommandSource commandSource, String command) {
|
||||
this.commandSource = Preconditions.checkNotNull(commandSource, "commandSource");
|
||||
this.command = Preconditions.checkNotNull(command, "command");
|
||||
this.result = CommandResult.allowed();
|
||||
this.result = CommandResult.allow();
|
||||
}
|
||||
|
||||
public CommandSource getCommandSource() {
|
||||
@@ -53,7 +53,7 @@ public final class CommandExecuteEvent implements ResultedEvent<CommandResult> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult getResult() {
|
||||
public CommandResult result() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public final class CommandExecuteEvent implements ResultedEvent<CommandResult> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowed() {
|
||||
public boolean allowed() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public final class CommandExecuteEvent implements ResultedEvent<CommandResult> {
|
||||
*
|
||||
* @return the allowed result
|
||||
*/
|
||||
public static CommandResult allowed() {
|
||||
public static CommandResult allow() {
|
||||
return ALLOWED;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public final class CommandExecuteEvent implements ResultedEvent<CommandResult> {
|
||||
*
|
||||
* @return the denied result
|
||||
*/
|
||||
public static CommandResult denied() {
|
||||
public static CommandResult deny() {
|
||||
return DENIED;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import com.google.common.annotations.Beta;
|
||||
import com.mojang.brigadier.tree.RootCommandNode;
|
||||
import com.velocitypowered.api.event.annotation.AwaitingEvent;
|
||||
import com.velocitypowered.api.event.player.PlayerReferentEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
|
||||
/**
|
||||
@@ -22,7 +23,7 @@ import com.velocitypowered.api.proxy.Player;
|
||||
*/
|
||||
@AwaitingEvent
|
||||
@Beta
|
||||
public class PlayerAvailableCommandsEvent {
|
||||
public class PlayerAvailableCommandsEvent implements PlayerReferentEvent {
|
||||
|
||||
private final Player player;
|
||||
private final RootCommandNode<?> rootNode;
|
||||
@@ -39,7 +40,8 @@ public class PlayerAvailableCommandsEvent {
|
||||
this.rootNode = checkNotNull(rootNode, "rootNode");
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
@Override
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public final class ConnectionHandshakeEvent {
|
||||
this.connection = Preconditions.checkNotNull(connection, "connection");
|
||||
}
|
||||
|
||||
public InboundConnection getConnection() {
|
||||
public InboundConnection connection() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,11 @@ public final class DisconnectEvent {
|
||||
this.loginStatus = Preconditions.checkNotNull(loginStatus, "loginStatus");
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public LoginStatus getLoginStatus() {
|
||||
public LoginStatus loginStatus() {
|
||||
return loginStatus;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ package com.velocitypowered.api.event.connection;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.velocitypowered.api.event.ResultedEvent;
|
||||
import com.velocitypowered.api.event.annotation.AwaitingEvent;
|
||||
import com.velocitypowered.api.event.player.PlayerReferentEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
|
||||
/**
|
||||
@@ -19,22 +20,23 @@ import com.velocitypowered.api.proxy.Player;
|
||||
* process.
|
||||
*/
|
||||
@AwaitingEvent
|
||||
public final class LoginEvent implements ResultedEvent<ResultedEvent.ComponentResult> {
|
||||
public final class LoginEvent implements ResultedEvent<ResultedEvent.ComponentResult>,
|
||||
PlayerReferentEvent {
|
||||
|
||||
private final Player player;
|
||||
private ComponentResult result;
|
||||
|
||||
public LoginEvent(Player player) {
|
||||
this.player = Preconditions.checkNotNull(player, "player");
|
||||
this.result = ComponentResult.allowed();
|
||||
this.result = ComponentResult.allow();
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComponentResult getResult() {
|
||||
public ComponentResult result() {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public final class PluginMessageEvent implements ResultedEvent<PluginMessageEven
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForwardResult getResult() {
|
||||
public ForwardResult result() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -61,19 +61,19 @@ public final class PluginMessageEvent implements ResultedEvent<PluginMessageEven
|
||||
this.result = Preconditions.checkNotNull(result, "result");
|
||||
}
|
||||
|
||||
public ChannelMessageSource getSource() {
|
||||
public ChannelMessageSource source() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public ChannelMessageSink getTarget() {
|
||||
public ChannelMessageSink target() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public ChannelIdentifier getIdentifier() {
|
||||
public ChannelIdentifier identifier() {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
public byte[] getData() {
|
||||
public byte[] rawData() {
|
||||
return Arrays.copyOf(data, data.length);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public final class PluginMessageEvent implements ResultedEvent<PluginMessageEven
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowed() {
|
||||
public boolean allowed() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ package com.velocitypowered.api.event.connection;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.velocitypowered.api.event.annotation.AwaitingEvent;
|
||||
import com.velocitypowered.api.event.player.PlayerReferentEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
|
||||
/**
|
||||
@@ -19,7 +20,7 @@ import com.velocitypowered.api.proxy.Player;
|
||||
* that fires during the login process.
|
||||
*/
|
||||
@AwaitingEvent
|
||||
public final class PostLoginEvent {
|
||||
public final class PostLoginEvent implements PlayerReferentEvent {
|
||||
|
||||
private final Player player;
|
||||
|
||||
@@ -27,7 +28,7 @@ public final class PostLoginEvent {
|
||||
this.player = Preconditions.checkNotNull(player, "player");
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.google.common.base.Preconditions;
|
||||
import com.velocitypowered.api.event.ResultedEvent;
|
||||
import com.velocitypowered.api.event.annotation.AwaitingEvent;
|
||||
import com.velocitypowered.api.proxy.InboundConnection;
|
||||
import java.util.Optional;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
@@ -44,7 +44,7 @@ public final class PreLoginEvent implements ResultedEvent<PreLoginEvent.PreLogin
|
||||
public PreLoginEvent(InboundConnection connection, String username) {
|
||||
this.connection = Preconditions.checkNotNull(connection, "connection");
|
||||
this.username = Preconditions.checkNotNull(username, "username");
|
||||
this.result = PreLoginComponentResult.allowed();
|
||||
this.result = PreLoginComponentResult.allow();
|
||||
}
|
||||
|
||||
public InboundConnection getConnection() {
|
||||
@@ -56,7 +56,7 @@ public final class PreLoginEvent implements ResultedEvent<PreLoginEvent.PreLogin
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreLoginComponentResult getResult() {
|
||||
public PreLoginComponentResult result() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public final class PreLoginEvent implements ResultedEvent<PreLoginEvent.PreLogin
|
||||
Result.FORCE_OFFLINE, null);
|
||||
|
||||
private final Result result;
|
||||
private final net.kyori.adventure.text.Component reason;
|
||||
private final Component reason;
|
||||
|
||||
private PreLoginComponentResult(Result result,
|
||||
net.kyori.adventure.text.@Nullable Component reason) {
|
||||
@@ -97,12 +97,12 @@ public final class PreLoginEvent implements ResultedEvent<PreLoginEvent.PreLogin
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowed() {
|
||||
public boolean allowed() {
|
||||
return result != Result.DISALLOWED;
|
||||
}
|
||||
|
||||
public Optional<net.kyori.adventure.text.Component> getReasonComponent() {
|
||||
return Optional.ofNullable(reason);
|
||||
public @Nullable Component explanation() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public boolean isOnlineModeAllowed() {
|
||||
@@ -132,14 +132,14 @@ public final class PreLoginEvent implements ResultedEvent<PreLoginEvent.PreLogin
|
||||
*
|
||||
* @return the allowed result
|
||||
*/
|
||||
public static PreLoginComponentResult allowed() {
|
||||
public static PreLoginComponentResult allow() {
|
||||
return ALLOWED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a result indicating the connection will be allowed through the proxy, but the
|
||||
* connection will be forced to use online mode provided that the proxy is in offline mode. This
|
||||
* acts similarly to {@link #allowed()} on an online-mode proxy.
|
||||
* acts similarly to {@link #allow()} on an online-mode proxy.
|
||||
*
|
||||
* @return the result
|
||||
*/
|
||||
@@ -160,12 +160,12 @@ public final class PreLoginEvent implements ResultedEvent<PreLoginEvent.PreLogin
|
||||
/**
|
||||
* Denies the login with the specified reason.
|
||||
*
|
||||
* @param reason the reason for disallowing the connection
|
||||
* @param explanation the reason for disallowing the connection
|
||||
* @return a new result
|
||||
*/
|
||||
public static PreLoginComponentResult denied(net.kyori.adventure.text.Component reason) {
|
||||
Preconditions.checkNotNull(reason, "reason");
|
||||
return new PreLoginComponentResult(Result.DISALLOWED, reason);
|
||||
public static PreLoginComponentResult deny(Component explanation) {
|
||||
Preconditions.checkNotNull(explanation, "explanation");
|
||||
return new PreLoginComponentResult(Result.DISALLOWED, explanation);
|
||||
}
|
||||
|
||||
private enum Result {
|
||||
|
||||
@@ -39,7 +39,7 @@ public final class PermissionsSetupEvent {
|
||||
this.provider = this.defaultProvider = Preconditions.checkNotNull(provider, "provider");
|
||||
}
|
||||
|
||||
public PermissionSubject getSubject() {
|
||||
public PermissionSubject subject() {
|
||||
return this.subject;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public final class PermissionsSetupEvent {
|
||||
return this.provider.createChecker(subject);
|
||||
}
|
||||
|
||||
public PermissionProvider getProvider() {
|
||||
public PermissionProvider provider() {
|
||||
return this.provider;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,23 +44,23 @@ public final class GameProfileRequestEvent {
|
||||
boolean onlineMode) {
|
||||
this.connection = Preconditions.checkNotNull(connection, "connection");
|
||||
this.originalProfile = Preconditions.checkNotNull(originalProfile, "originalProfile");
|
||||
this.username = originalProfile.getName();
|
||||
this.username = originalProfile.name();
|
||||
this.onlineMode = onlineMode;
|
||||
}
|
||||
|
||||
public InboundConnection getConnection() {
|
||||
public InboundConnection connection() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
public String username() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public GameProfile getOriginalProfile() {
|
||||
public GameProfile originalProfile() {
|
||||
return originalProfile;
|
||||
}
|
||||
|
||||
public boolean isOnlineMode() {
|
||||
public boolean onlineMode() {
|
||||
return onlineMode;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public final class GameProfileRequestEvent {
|
||||
*
|
||||
* @return the user's {@link GameProfile}
|
||||
*/
|
||||
public GameProfile getGameProfile() {
|
||||
public GameProfile profileToUse() {
|
||||
return gameProfile == null ? originalProfile : gameProfile;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public final class GameProfileRequestEvent {
|
||||
*
|
||||
* @param gameProfile the profile for this connection, {@code null} uses the original profile
|
||||
*/
|
||||
public void setGameProfile(@Nullable GameProfile gameProfile) {
|
||||
public void setProfileToUse(@Nullable GameProfile gameProfile) {
|
||||
this.gameProfile = gameProfile;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.velocitypowered.api.event.ResultedEvent;
|
||||
import com.velocitypowered.api.event.annotation.AwaitingEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import java.util.Optional;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
@@ -25,11 +25,11 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
*/
|
||||
@AwaitingEvent
|
||||
public final class KickedFromServerEvent implements
|
||||
ResultedEvent<KickedFromServerEvent.ServerKickResult> {
|
||||
ResultedEvent<KickedFromServerEvent.ServerKickResult>, PlayerReferentEvent {
|
||||
|
||||
private final Player player;
|
||||
private final RegisteredServer server;
|
||||
private final net.kyori.adventure.text.@Nullable Component originalReason;
|
||||
private final @Nullable Component originalReason;
|
||||
private final boolean duringServerConnect;
|
||||
private ServerKickResult result;
|
||||
|
||||
@@ -43,8 +43,8 @@ public final class KickedFromServerEvent implements
|
||||
* @param result the initial result
|
||||
*/
|
||||
public KickedFromServerEvent(Player player, RegisteredServer server,
|
||||
net.kyori.adventure.text.@Nullable Component originalReason,
|
||||
boolean duringServerConnect, ServerKickResult result) {
|
||||
@Nullable Component originalReason, boolean duringServerConnect,
|
||||
ServerKickResult result) {
|
||||
this.player = Preconditions.checkNotNull(player, "player");
|
||||
this.server = Preconditions.checkNotNull(server, "server");
|
||||
this.originalReason = originalReason;
|
||||
@@ -53,7 +53,7 @@ public final class KickedFromServerEvent implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerKickResult getResult() {
|
||||
public ServerKickResult result() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -62,16 +62,16 @@ public final class KickedFromServerEvent implements
|
||||
this.result = Preconditions.checkNotNull(result, "result");
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public RegisteredServer getServer() {
|
||||
public RegisteredServer server() {
|
||||
return server;
|
||||
}
|
||||
|
||||
public Optional<net.kyori.adventure.text.Component> getServerKickReason() {
|
||||
return Optional.ofNullable(originalReason);
|
||||
public @Nullable Component kickReason() {
|
||||
return originalReason;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,18 +107,18 @@ public final class KickedFromServerEvent implements
|
||||
*/
|
||||
public static final class DisconnectPlayer implements ServerKickResult {
|
||||
|
||||
private final net.kyori.adventure.text.Component component;
|
||||
private final Component component;
|
||||
|
||||
private DisconnectPlayer(net.kyori.adventure.text.Component component) {
|
||||
private DisconnectPlayer(Component component) {
|
||||
this.component = Preconditions.checkNotNull(component, "component");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowed() {
|
||||
public boolean allowed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public net.kyori.adventure.text.Component getReasonComponent() {
|
||||
public Component reason() {
|
||||
return component;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public final class KickedFromServerEvent implements
|
||||
* @param reason the reason to use when disconnecting the player
|
||||
* @return the disconnect result
|
||||
*/
|
||||
public static DisconnectPlayer create(net.kyori.adventure.text.Component reason) {
|
||||
public static DisconnectPlayer disconnect(Component reason) {
|
||||
return new DisconnectPlayer(reason);
|
||||
}
|
||||
}
|
||||
@@ -138,17 +138,17 @@ public final class KickedFromServerEvent implements
|
||||
*/
|
||||
public static final class RedirectPlayer implements ServerKickResult {
|
||||
|
||||
private final net.kyori.adventure.text.Component message;
|
||||
private final Component message;
|
||||
private final RegisteredServer server;
|
||||
|
||||
private RedirectPlayer(RegisteredServer server,
|
||||
net.kyori.adventure.text.@Nullable Component message) {
|
||||
@Nullable Component message) {
|
||||
this.server = Preconditions.checkNotNull(server, "server");
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowed() {
|
||||
public boolean allowed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public final class KickedFromServerEvent implements
|
||||
return server;
|
||||
}
|
||||
|
||||
public net.kyori.adventure.text.@Nullable Component getMessageComponent() {
|
||||
public @Nullable Component getMessageComponent() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -169,8 +169,8 @@ public final class KickedFromServerEvent implements
|
||||
* @param message the message will be sent to the player after redirecting
|
||||
* @return the redirect result
|
||||
*/
|
||||
public static RedirectPlayer create(RegisteredServer server,
|
||||
net.kyori.adventure.text.Component message) {
|
||||
public static RedirectPlayer redirect(RegisteredServer server,
|
||||
Component message) {
|
||||
return new RedirectPlayer(server, message);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public final class KickedFromServerEvent implements
|
||||
* @param server the server to send the player to
|
||||
* @return the redirect result
|
||||
*/
|
||||
public static ServerKickResult create(RegisteredServer server) {
|
||||
public static ServerKickResult redirect(RegisteredServer server) {
|
||||
return new RedirectPlayer(server, null);
|
||||
}
|
||||
}
|
||||
@@ -193,18 +193,18 @@ public final class KickedFromServerEvent implements
|
||||
*/
|
||||
public static final class Notify implements ServerKickResult {
|
||||
|
||||
private final net.kyori.adventure.text.Component message;
|
||||
private final Component message;
|
||||
|
||||
private Notify(net.kyori.adventure.text.Component message) {
|
||||
private Notify(Component message) {
|
||||
this.message = Preconditions.checkNotNull(message, "message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowed() {
|
||||
public boolean allowed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public net.kyori.adventure.text.Component getMessageComponent() {
|
||||
public Component reason() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ public final class KickedFromServerEvent implements
|
||||
* @param message the server to send the player to
|
||||
* @return the redirect result
|
||||
*/
|
||||
public static Notify create(net.kyori.adventure.text.Component message) {
|
||||
public static Notify notify(Component message) {
|
||||
return new Notify(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
* This event is fired when a client ({@link Player}) sends a plugin message through the
|
||||
* register channel. Velocity will not wait on this event to finish firing.
|
||||
*/
|
||||
public final class PlayerChannelRegisterEvent {
|
||||
public final class PlayerChannelRegisterEvent implements PlayerReferentEvent {
|
||||
|
||||
private final Player player;
|
||||
private final List<ChannelIdentifier> channels;
|
||||
@@ -26,11 +26,11 @@ public final class PlayerChannelRegisterEvent {
|
||||
this.channels = Preconditions.checkNotNull(channels, "channels");
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public List<ChannelIdentifier> getChannels() {
|
||||
public List<ChannelIdentifier> channels() {
|
||||
return channels;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
* to finish firing before forwarding it to the server, if the result allows it.
|
||||
*/
|
||||
@AwaitingEvent
|
||||
public final class PlayerChatEvent implements ResultedEvent<PlayerChatEvent.ChatResult> {
|
||||
public final class PlayerChatEvent implements ResultedEvent<PlayerChatEvent.ChatResult>,
|
||||
PlayerReferentEvent {
|
||||
|
||||
private final Player player;
|
||||
private final String message;
|
||||
@@ -35,19 +36,19 @@ public final class PlayerChatEvent implements ResultedEvent<PlayerChatEvent.Chat
|
||||
public PlayerChatEvent(Player player, String message) {
|
||||
this.player = Preconditions.checkNotNull(player, "player");
|
||||
this.message = Preconditions.checkNotNull(message, "message");
|
||||
this.result = ChatResult.allowed();
|
||||
this.result = ChatResult.allow();
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
public String message() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatResult getResult() {
|
||||
public ChatResult result() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -81,12 +82,12 @@ public final class PlayerChatEvent implements ResultedEvent<PlayerChatEvent.Chat
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Optional<String> getMessage() {
|
||||
public Optional<String> modifiedMessage() {
|
||||
return Optional.ofNullable(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowed() {
|
||||
public boolean allowed() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -100,7 +101,7 @@ public final class PlayerChatEvent implements ResultedEvent<PlayerChatEvent.Chat
|
||||
*
|
||||
* @return the allowed result
|
||||
*/
|
||||
public static ChatResult allowed() {
|
||||
public static ChatResult allow() {
|
||||
return ALLOWED;
|
||||
}
|
||||
|
||||
@@ -109,7 +110,7 @@ public final class PlayerChatEvent implements ResultedEvent<PlayerChatEvent.Chat
|
||||
*
|
||||
* @return the denied result
|
||||
*/
|
||||
public static ChatResult denied() {
|
||||
public static ChatResult deny() {
|
||||
return DENIED;
|
||||
}
|
||||
|
||||
@@ -119,7 +120,7 @@ public final class PlayerChatEvent implements ResultedEvent<PlayerChatEvent.Chat
|
||||
* @param message the message to use instead
|
||||
* @return a result with a new message
|
||||
*/
|
||||
public static ChatResult message(@NonNull String message) {
|
||||
public static ChatResult modify(@NonNull String message) {
|
||||
Preconditions.checkNotNull(message, "message");
|
||||
return new ChatResult(true, message);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
* {@link KickedFromServerEvent} as normal.
|
||||
*/
|
||||
@AwaitingEvent
|
||||
public class PlayerChooseInitialServerEvent {
|
||||
public class PlayerChooseInitialServerEvent implements PlayerReferentEvent {
|
||||
|
||||
private final Player player;
|
||||
private @Nullable RegisteredServer initialServer;
|
||||
@@ -37,7 +37,8 @@ public class PlayerChooseInitialServerEvent {
|
||||
this.initialServer = initialServer;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
@Override
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.velocitypowered.api.proxy.Player;
|
||||
* Fired when a {@link Player} sends the <code>minecraft:brand</code> plugin message. Velocity will
|
||||
* not wait on the result of this event.
|
||||
*/
|
||||
public final class PlayerClientBrandEvent {
|
||||
public final class PlayerClientBrandEvent implements PlayerReferentEvent {
|
||||
private final Player player;
|
||||
private final String brand;
|
||||
|
||||
@@ -29,7 +29,8 @@ public final class PlayerClientBrandEvent {
|
||||
this.brand = Preconditions.checkNotNull(brand);
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
@Override
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.velocitypowered.api.util.ModInfo;
|
||||
* This event is fired when a Forge client sends its mods to the proxy while connecting to a server.
|
||||
* Velocity will not wait on this event to finish firing.
|
||||
*/
|
||||
public final class PlayerModInfoEvent {
|
||||
public final class PlayerModInfoEvent implements PlayerReferentEvent {
|
||||
|
||||
private final Player player;
|
||||
private final ModInfo modInfo;
|
||||
@@ -26,11 +26,12 @@ public final class PlayerModInfoEvent {
|
||||
this.modInfo = Preconditions.checkNotNull(modInfo, "modInfo");
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
@Override
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public ModInfo getModInfo() {
|
||||
public ModInfo modInfo() {
|
||||
return modInfo;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2023 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.event.player;
|
||||
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
|
||||
/**
|
||||
* Defines any event that refers to a player.
|
||||
*/
|
||||
public interface PlayerReferentEvent {
|
||||
|
||||
Player player();
|
||||
}
|
||||
@@ -21,26 +21,13 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
* the player may be kicked from the server.
|
||||
*/
|
||||
@AwaitingEvent
|
||||
public class PlayerResourcePackStatusEvent {
|
||||
public class PlayerResourcePackStatusEvent implements PlayerReferentEvent {
|
||||
|
||||
private final Player player;
|
||||
private final Status status;
|
||||
private final @MonotonicNonNull ResourcePackInfo packInfo;
|
||||
private boolean overwriteKick;
|
||||
|
||||
/**
|
||||
* Instantiates this event.
|
||||
*
|
||||
* @deprecated Use {@link PlayerResourcePackStatusEvent#PlayerResourcePackStatusEvent
|
||||
* (Player, Status, ResourcePackInfo)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public PlayerResourcePackStatusEvent(Player player, Status status) {
|
||||
this.player = Preconditions.checkNotNull(player, "player");
|
||||
this.status = Preconditions.checkNotNull(status, "status");
|
||||
this.packInfo = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates this event.
|
||||
*/
|
||||
@@ -55,7 +42,8 @@ public class PlayerResourcePackStatusEvent {
|
||||
*
|
||||
* @return the player
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
@Override
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@@ -80,7 +68,7 @@ public class PlayerResourcePackStatusEvent {
|
||||
|
||||
/**
|
||||
* Gets whether or not to override the kick resulting from
|
||||
* {@link ResourcePackInfo#getShouldForce()} being true.
|
||||
* {@link ResourcePackInfo#required()} being true.
|
||||
*
|
||||
* @return whether or not to overwrite the result
|
||||
*/
|
||||
@@ -89,7 +77,7 @@ public class PlayerResourcePackStatusEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to true to prevent {@link ResourcePackInfo#getShouldForce()}
|
||||
* Set to true to prevent {@link ResourcePackInfo#required()}
|
||||
* from kicking the player.
|
||||
* Overwriting this kick is only possible on versions older than 1.17,
|
||||
* as the client or server will enforce this regardless. Cancelling the resulting
|
||||
@@ -99,7 +87,7 @@ public class PlayerResourcePackStatusEvent {
|
||||
* @throws IllegalArgumentException if the player version is 1.17 or newer
|
||||
*/
|
||||
public void setOverwriteKick(boolean overwriteKick) {
|
||||
Preconditions.checkArgument(player.getProtocolVersion()
|
||||
Preconditions.checkArgument(player.protocolVersion()
|
||||
.compareTo(ProtocolVersion.MINECRAFT_1_17) < 0,
|
||||
"overwriteKick is not supported on 1.17 or newer");
|
||||
this.overwriteKick = overwriteKick;
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.velocitypowered.api.proxy.player.PlayerSettings;
|
||||
* and typically will be fired multiple times per connection. Velocity will not wait on this event
|
||||
* to finish firing.
|
||||
*/
|
||||
public final class PlayerSettingsChangedEvent {
|
||||
public final class PlayerSettingsChangedEvent implements PlayerReferentEvent {
|
||||
|
||||
private final Player player;
|
||||
private final PlayerSettings playerSettings;
|
||||
@@ -27,7 +27,8 @@ public final class PlayerSettingsChangedEvent {
|
||||
this.playerSettings = Preconditions.checkNotNull(playerSettings, "playerSettings");
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
@Override
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.google.common.base.Preconditions;
|
||||
import com.velocitypowered.api.event.annotation.AwaitingEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import java.util.Optional;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
/**
|
||||
@@ -25,7 +24,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
* </p>
|
||||
*/
|
||||
@AwaitingEvent
|
||||
public final class ServerConnectedEvent {
|
||||
public final class ServerConnectedEvent implements PlayerReferentEvent {
|
||||
|
||||
private final Player player;
|
||||
private final RegisteredServer server;
|
||||
@@ -45,16 +44,16 @@ public final class ServerConnectedEvent {
|
||||
this.previousServer = previousServer;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public RegisteredServer getServer() {
|
||||
public RegisteredServer newServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
public Optional<RegisteredServer> getPreviousServer() {
|
||||
return Optional.ofNullable(previousServer);
|
||||
public @Nullable RegisteredServer previousServer() {
|
||||
return previousServer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ServerLoginPluginMessageEvent implements ResultedEvent<ResponseResu
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult getResult() {
|
||||
public ResponseResult result() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
@@ -63,11 +63,11 @@ public class ServerLoginPluginMessageEvent implements ResultedEvent<ResponseResu
|
||||
this.result = checkNotNull(result, "result");
|
||||
}
|
||||
|
||||
public ServerConnection getConnection() {
|
||||
public ServerConnection connection() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
public ChannelIdentifier getIdentifier() {
|
||||
public ChannelIdentifier identifier() {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ServerLoginPluginMessageEvent implements ResultedEvent<ResponseResu
|
||||
*
|
||||
* @return the contents of the message
|
||||
*/
|
||||
public byte[] getContents() {
|
||||
public byte[] rawData() {
|
||||
return contents.clone();
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class ServerLoginPluginMessageEvent implements ResultedEvent<ResponseResu
|
||||
*
|
||||
* @return the contents of the message as a stream
|
||||
*/
|
||||
public ByteArrayInputStream contentsAsInputStream() {
|
||||
public ByteArrayInputStream dataAsInputStream() {
|
||||
return new ByteArrayInputStream(contents);
|
||||
}
|
||||
|
||||
@@ -96,11 +96,11 @@ public class ServerLoginPluginMessageEvent implements ResultedEvent<ResponseResu
|
||||
*
|
||||
* @return the contents of the message as a {@link java.io.DataInput}
|
||||
*/
|
||||
public ByteArrayDataInput contentsAsDataStream() {
|
||||
public ByteArrayDataInput dataAsDataInput() {
|
||||
return ByteStreams.newDataInput(contents);
|
||||
}
|
||||
|
||||
public int getSequenceId() {
|
||||
public int sequenceId() {
|
||||
return sequenceId;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class ServerLoginPluginMessageEvent implements ResultedEvent<ResponseResu
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowed() {
|
||||
public boolean allowed() {
|
||||
return response != null;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class ServerLoginPluginMessageEvent implements ResultedEvent<ResponseResu
|
||||
* @return the response to the message
|
||||
* @throws IllegalStateException if there is no reply (an unknown message)
|
||||
*/
|
||||
public byte[] getResponse() {
|
||||
public byte[] response() {
|
||||
if (response == null) {
|
||||
throw new IllegalStateException("Fetching response of unknown message result");
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
package com.velocitypowered.api.event.player;
|
||||
|
||||
import com.google.common.annotations.Beta;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
@@ -15,11 +14,10 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
/**
|
||||
* Fired after the player has connected to a server. The server the player is now connected to is
|
||||
* available in {@link Player#getCurrentServer()}. Velocity will not wait on this event to finish
|
||||
* available in {@link Player#connectedServer()}. Velocity will not wait on this event to finish
|
||||
* firing.
|
||||
*/
|
||||
@Beta
|
||||
public class ServerPostConnectEvent {
|
||||
public class ServerPostConnectEvent implements PlayerReferentEvent {
|
||||
private final Player player;
|
||||
private final RegisteredServer previousServer;
|
||||
|
||||
@@ -34,7 +32,7 @@ public class ServerPostConnectEvent {
|
||||
*
|
||||
* @return the player
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@@ -44,7 +42,7 @@ public class ServerPostConnectEvent {
|
||||
*
|
||||
* @return the previous server the player was connected to
|
||||
*/
|
||||
public @Nullable RegisteredServer getPreviousServer() {
|
||||
public @Nullable RegisteredServer previousServer() {
|
||||
return previousServer;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
*/
|
||||
@AwaitingEvent
|
||||
public final class ServerPreConnectEvent implements
|
||||
ResultedEvent<ServerPreConnectEvent.ServerResult> {
|
||||
ResultedEvent<ServerPreConnectEvent.ServerResult>, PlayerReferentEvent {
|
||||
|
||||
private final Player player;
|
||||
private final RegisteredServer originalServer;
|
||||
@@ -39,7 +39,7 @@ public final class ServerPreConnectEvent implements
|
||||
*/
|
||||
public ServerPreConnectEvent(Player player, RegisteredServer originalServer) {
|
||||
this(player, originalServer,
|
||||
player.getCurrentServer().map(ServerConnection::getServer).orElse(null));
|
||||
player.connectedServer().map(ServerConnection::server).orElse(null));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ public final class ServerPreConnectEvent implements
|
||||
this.player = Preconditions.checkNotNull(player, "player");
|
||||
this.originalServer = Preconditions.checkNotNull(originalServer, "originalServer");
|
||||
this.previousServer = previousServer;
|
||||
this.result = ServerResult.allowed(originalServer);
|
||||
this.result = ServerResult.connectTo(originalServer);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,12 +62,13 @@ public final class ServerPreConnectEvent implements
|
||||
*
|
||||
* @return the player connecting to the server
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
@Override
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerResult getResult() {
|
||||
public ServerResult result() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -89,7 +90,7 @@ public final class ServerPreConnectEvent implements
|
||||
|
||||
/**
|
||||
* Returns the server that the player is currently connected to. Prefer this method over using
|
||||
* {@link Player#getCurrentServer()} as the current server might get reset after server kicks to
|
||||
* {@link Player#connectedServer()} as the current server might get reset after server kicks to
|
||||
* prevent connection issues. This is {@code null} if they were not connected to another server
|
||||
* beforehand (for instance, if the player has just joined the proxy).
|
||||
*
|
||||
@@ -122,7 +123,7 @@ public final class ServerPreConnectEvent implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowed() {
|
||||
public boolean allowed() {
|
||||
return server != null;
|
||||
}
|
||||
|
||||
@@ -133,7 +134,7 @@ public final class ServerPreConnectEvent implements
|
||||
@Override
|
||||
public String toString() {
|
||||
if (server != null) {
|
||||
return "allowed: connect to " + server.getServerInfo().getName();
|
||||
return "allowed: connect to " + server.serverInfo().name();
|
||||
}
|
||||
return "denied";
|
||||
}
|
||||
@@ -145,7 +146,7 @@ public final class ServerPreConnectEvent implements
|
||||
*
|
||||
* @return a result to deny conneections
|
||||
*/
|
||||
public static ServerResult denied() {
|
||||
public static ServerResult deny() {
|
||||
return DENIED;
|
||||
}
|
||||
|
||||
@@ -155,7 +156,7 @@ public final class ServerPreConnectEvent implements
|
||||
* @param server the new server to connect to
|
||||
* @return a result to allow the player to connect to the specified server
|
||||
*/
|
||||
public static ServerResult allowed(RegisteredServer server) {
|
||||
public static ServerResult connectTo(RegisteredServer server) {
|
||||
Preconditions.checkNotNull(server, "server");
|
||||
return new ServerResult(server);
|
||||
}
|
||||
|
||||
@@ -36,21 +36,21 @@ public class ServerResourcePackSendEvent implements ResultedEvent<ResultedEvent.
|
||||
ResourcePackInfo receivedResourcePack,
|
||||
ServerConnection serverConnection
|
||||
) {
|
||||
this.result = ResultedEvent.GenericResult.allowed();
|
||||
this.result = ResultedEvent.GenericResult.allow();
|
||||
this.receivedResourcePack = receivedResourcePack;
|
||||
this.serverConnection = serverConnection;
|
||||
this.providedResourcePack = receivedResourcePack;
|
||||
}
|
||||
|
||||
public ServerConnection getServerConnection() {
|
||||
public ServerConnection connection() {
|
||||
return serverConnection;
|
||||
}
|
||||
|
||||
public ResourcePackInfo getReceivedResourcePack() {
|
||||
public ResourcePackInfo receivedResourcePack() {
|
||||
return receivedResourcePack;
|
||||
}
|
||||
|
||||
public ResourcePackInfo getProvidedResourcePack() {
|
||||
public ResourcePackInfo providedResourcePack() {
|
||||
return providedResourcePack;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ServerResourcePackSendEvent implements ResultedEvent<ResultedEvent.
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenericResult getResult() {
|
||||
public GenericResult result() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
* the tab complete results.
|
||||
*/
|
||||
@AwaitingEvent
|
||||
public class TabCompleteEvent {
|
||||
public class TabCompleteEvent implements PlayerReferentEvent {
|
||||
private final Player player;
|
||||
private final String partialMessage;
|
||||
private final List<String> suggestions;
|
||||
@@ -45,7 +45,7 @@ public class TabCompleteEvent {
|
||||
*
|
||||
* @return the requesting player
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
public Player player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class TabCompleteEvent {
|
||||
*
|
||||
* @return the partial message
|
||||
*/
|
||||
public String getPartialMessage() {
|
||||
public String partialMessage() {
|
||||
return partialMessage;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class TabCompleteEvent {
|
||||
*
|
||||
* @return the suggestions
|
||||
*/
|
||||
public List<String> getSuggestions() {
|
||||
public List<String> suggestions() {
|
||||
return suggestions;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ public final class ListenerBoundEvent {
|
||||
this.listenerType = Preconditions.checkNotNull(listenerType, "listenerType");
|
||||
}
|
||||
|
||||
public SocketAddress getAddress() {
|
||||
public SocketAddress address() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public ListenerType getListenerType() {
|
||||
public ListenerType listenerType() {
|
||||
return listenerType;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ public final class ListenerCloseEvent {
|
||||
this.listenerType = Preconditions.checkNotNull(listenerType, "listenerType");
|
||||
}
|
||||
|
||||
public SocketAddress getAddress() {
|
||||
public SocketAddress address() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public ListenerType getListenerType() {
|
||||
public ListenerType listenerType() {
|
||||
return listenerType;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,11 +30,11 @@ public final class ProxyPingEvent {
|
||||
this.ping = Preconditions.checkNotNull(ping, "ping");
|
||||
}
|
||||
|
||||
public InboundConnection getConnection() {
|
||||
public InboundConnection connection() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
public ServerPing getPing() {
|
||||
public ServerPing ping() {
|
||||
return ping;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public final class ProxyQueryEvent {
|
||||
*
|
||||
* @return query type
|
||||
*/
|
||||
public QueryType getQueryType() {
|
||||
public QueryType queryType() {
|
||||
return queryType;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public final class ProxyQueryEvent {
|
||||
*
|
||||
* @return querier address
|
||||
*/
|
||||
public InetAddress getQuerierAddress() {
|
||||
public InetAddress remoteAddress() {
|
||||
return querierAddress;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public final class ProxyQueryEvent {
|
||||
*
|
||||
* @return the current query response
|
||||
*/
|
||||
public QueryResponse getResponse() {
|
||||
public QueryResponse response() {
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public interface PermissionSubject {
|
||||
* @return whether or not the subject has the permission
|
||||
*/
|
||||
default boolean hasPermission(String permission) {
|
||||
return this.getPermissionChecker().test(permission);
|
||||
return this.permissionChecker().test(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ public interface PermissionSubject {
|
||||
* @return the value the permission is set to
|
||||
*/
|
||||
default TriState getPermissionValue(String permission) {
|
||||
return this.getPermissionChecker().value(permission);
|
||||
return this.permissionChecker().value(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,5 +40,5 @@ public interface PermissionSubject {
|
||||
*
|
||||
* @return subject's permission checker
|
||||
*/
|
||||
PermissionChecker getPermissionChecker();
|
||||
PermissionChecker permissionChecker();
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@ public interface PluginContainer {
|
||||
*
|
||||
* @return the plugin's description
|
||||
*/
|
||||
PluginDescription getDescription();
|
||||
PluginDescription description();
|
||||
|
||||
/**
|
||||
* Returns the created plugin if it is available.
|
||||
*
|
||||
* @return the instance if available
|
||||
*/
|
||||
default Optional<?> getInstance() {
|
||||
default Optional<?> instance() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@@ -37,5 +37,5 @@ public interface PluginContainer {
|
||||
*
|
||||
* @return an {@link ExecutorService} associated with this plugin
|
||||
*/
|
||||
ExecutorService getExecutorService();
|
||||
ExecutorService executorService();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public interface PluginDescription {
|
||||
* @return the plugin ID
|
||||
* @see Plugin#id()
|
||||
*/
|
||||
String getId();
|
||||
String id();
|
||||
|
||||
/**
|
||||
* Gets the name of the {@link Plugin} within this container.
|
||||
@@ -42,7 +42,7 @@ public interface PluginDescription {
|
||||
* @return an {@link Optional} with the plugin name, may be empty
|
||||
* @see Plugin#name()
|
||||
*/
|
||||
default Optional<String> getName() {
|
||||
default Optional<String> name() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public interface PluginDescription {
|
||||
* @return an {@link Optional} with the plugin version, may be empty
|
||||
* @see Plugin#version()
|
||||
*/
|
||||
default Optional<String> getVersion() {
|
||||
default Optional<String> version() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public interface PluginDescription {
|
||||
* @return an {@link Optional} with the plugin description, may be empty
|
||||
* @see Plugin#description()
|
||||
*/
|
||||
default Optional<String> getDescription() {
|
||||
default Optional<String> description() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public interface PluginDescription {
|
||||
* @return an {@link Optional} with the plugin url, may be empty
|
||||
* @see Plugin#url()
|
||||
*/
|
||||
default Optional<String> getUrl() {
|
||||
default Optional<String> url() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public interface PluginDescription {
|
||||
* @return the plugin authors, may be empty
|
||||
* @see Plugin#authors()
|
||||
*/
|
||||
default List<String> getAuthors() {
|
||||
default List<String> authors() {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@@ -92,11 +92,11 @@ public interface PluginDescription {
|
||||
* @return the plugin dependencies, can be empty
|
||||
* @see Plugin#dependencies()
|
||||
*/
|
||||
default Collection<PluginDependency> getDependencies() {
|
||||
default Collection<PluginDependency> dependencies() {
|
||||
return ImmutableSet.of();
|
||||
}
|
||||
|
||||
default Optional<PluginDependency> getDependency(String id) {
|
||||
default Optional<PluginDependency> dependency(String id) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
|
||||
@@ -32,14 +32,14 @@ public interface PluginManager {
|
||||
* @param id the plugin ID
|
||||
* @return the plugin, if available
|
||||
*/
|
||||
Optional<PluginContainer> getPlugin(String id);
|
||||
Optional<PluginContainer> plugin(String id);
|
||||
|
||||
/**
|
||||
* Gets a {@link Collection} of all {@link PluginContainer}s.
|
||||
*
|
||||
* @return the plugins
|
||||
*/
|
||||
Collection<PluginContainer> getPlugins();
|
||||
Collection<PluginContainer> plugins();
|
||||
|
||||
/**
|
||||
* Checks if a plugin is loaded based on its ID.
|
||||
|
||||
@@ -44,7 +44,7 @@ public final class PluginDependency {
|
||||
*
|
||||
* @return the plugin ID
|
||||
*/
|
||||
public String getId() {
|
||||
public String id() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public final class PluginDependency {
|
||||
*
|
||||
* @return an {@link Optional} with the plugin version, may be empty
|
||||
*/
|
||||
public Optional<String> getVersion() {
|
||||
public Optional<String> version() {
|
||||
return Optional.ofNullable(version);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public final class PluginDependency {
|
||||
*
|
||||
* @return true if dependency is optional
|
||||
*/
|
||||
public boolean isOptional() {
|
||||
public boolean optional() {
|
||||
return optional;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ package com.velocitypowered.api.proxy;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
/**
|
||||
* Provides a fluent interface to send a connection request to another server on the proxy. A
|
||||
@@ -22,7 +23,7 @@ public interface ConnectionRequestBuilder {
|
||||
*
|
||||
* @return the server this request will connect to
|
||||
*/
|
||||
RegisteredServer getServer();
|
||||
RegisteredServer server();
|
||||
|
||||
/**
|
||||
* Initiates the connection to the remote server and emits a result on the {@link
|
||||
@@ -59,7 +60,7 @@ public interface ConnectionRequestBuilder {
|
||||
* @return whether or not the request succeeded
|
||||
*/
|
||||
default boolean isSuccessful() {
|
||||
return getStatus() == Status.SUCCESS;
|
||||
return status() == Status.SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,21 +68,21 @@ public interface ConnectionRequestBuilder {
|
||||
*
|
||||
* @return the status for this result
|
||||
*/
|
||||
Status getStatus();
|
||||
Status status();
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
Optional<net.kyori.adventure.text.Component> getReasonComponent();
|
||||
Optional<Component> reason();
|
||||
|
||||
/**
|
||||
* Returns the server we actually tried to connect to.
|
||||
*
|
||||
* @return the server we actually tried to connect to
|
||||
*/
|
||||
RegisteredServer getAttemptedConnection();
|
||||
RegisteredServer attemptedConnectedTo();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,14 +22,14 @@ public interface InboundConnection {
|
||||
*
|
||||
* @return the player's remote address
|
||||
*/
|
||||
SocketAddress getRemoteAddress();
|
||||
SocketAddress remoteAddress();
|
||||
|
||||
/**
|
||||
* Returns the hostname that the user entered into the client, if applicable.
|
||||
*
|
||||
* @return the hostname from the client
|
||||
*/
|
||||
Optional<InetSocketAddress> getVirtualHost();
|
||||
Optional<InetSocketAddress> virtualHost();
|
||||
|
||||
/**
|
||||
* Determine whether or not the player remains online.
|
||||
@@ -43,5 +43,5 @@ public interface InboundConnection {
|
||||
*
|
||||
* @return the protocol version the connection uses
|
||||
*/
|
||||
ProtocolVersion getProtocolVersion();
|
||||
ProtocolVersion protocolVersion();
|
||||
}
|
||||
|
||||
@@ -47,17 +47,17 @@ public interface Player extends
|
||||
*
|
||||
* @return the username
|
||||
*/
|
||||
String getUsername();
|
||||
String username();
|
||||
|
||||
/**
|
||||
* Returns the locale the proxy will use to send messages translated via the Adventure global
|
||||
* translator. By default, the value of {@link PlayerSettings#getLocale()} is used.
|
||||
* translator. By default, the value of {@link PlayerSettings#locale()} is used.
|
||||
*
|
||||
* <p>This can be {@code null} when the client has not yet connected to any server.</p>
|
||||
*
|
||||
* @return the locale.
|
||||
*/
|
||||
@Nullable Locale getEffectiveLocale();
|
||||
@Nullable Locale effectiveLocale();
|
||||
|
||||
/**
|
||||
* Change the locale the proxy will be translating its messages to.
|
||||
@@ -71,21 +71,21 @@ public interface Player extends
|
||||
*
|
||||
* @return the UUID
|
||||
*/
|
||||
UUID getUniqueId();
|
||||
UUID uuid();
|
||||
|
||||
/**
|
||||
* Returns the server that the player is currently connected to.
|
||||
*
|
||||
* @return an {@link Optional} the server that the player is connected to, which may be empty
|
||||
*/
|
||||
Optional<ServerConnection> getCurrentServer();
|
||||
Optional<ServerConnection> connectedServer();
|
||||
|
||||
/**
|
||||
* Returns the player's client settings.
|
||||
*
|
||||
* @return the settings
|
||||
*/
|
||||
PlayerSettings getPlayerSettings();
|
||||
PlayerSettings settings();
|
||||
|
||||
/**
|
||||
* Returns whether the player has sent its client settings.
|
||||
@@ -99,14 +99,14 @@ public interface Player extends
|
||||
*
|
||||
* @return an {@link Optional} the mod info. which may be empty
|
||||
*/
|
||||
Optional<ModInfo> getModInfo();
|
||||
Optional<ModInfo> modInfo();
|
||||
|
||||
/**
|
||||
* Gets the player's estimated ping in milliseconds.
|
||||
*
|
||||
* @return the player's ping or -1 if ping information is currently unknown
|
||||
*/
|
||||
long getPing();
|
||||
long ping();
|
||||
|
||||
/**
|
||||
* Returns the player's connection status.
|
||||
@@ -130,29 +130,19 @@ public interface Player extends
|
||||
*
|
||||
* @return the player's profile properties
|
||||
*/
|
||||
List<GameProfile.Property> getGameProfileProperties();
|
||||
List<GameProfile.Property> profileProperties();
|
||||
|
||||
/**
|
||||
* Sets the player's profile properties.
|
||||
*
|
||||
* @param properties the properties
|
||||
*/
|
||||
void setGameProfileProperties(List<GameProfile.Property> properties);
|
||||
void setProfileProperties(List<GameProfile.Property> properties);
|
||||
|
||||
/**
|
||||
* Returns the player's game profile.
|
||||
*/
|
||||
GameProfile getGameProfile();
|
||||
|
||||
/**
|
||||
* Clears the tab list header and footer for the player.
|
||||
*
|
||||
* @deprecated Use {@link Player#clearPlayerListHeaderAndFooter()}.
|
||||
*/
|
||||
@Deprecated
|
||||
default void clearHeaderAndFooter() {
|
||||
clearPlayerListHeaderAndFooter();
|
||||
}
|
||||
GameProfile profile();
|
||||
|
||||
/**
|
||||
* Clears the player list header and footer.
|
||||
@@ -178,7 +168,7 @@ public interface Player extends
|
||||
*
|
||||
* @return this player's tab list
|
||||
*/
|
||||
TabList getTabList();
|
||||
TabList tabList();
|
||||
|
||||
/**
|
||||
* Disconnects the player with the specified reason. Once this method is called, further calls to
|
||||
@@ -186,7 +176,7 @@ public interface Player extends
|
||||
*
|
||||
* @param reason component with the reason
|
||||
*/
|
||||
void disconnect(net.kyori.adventure.text.Component reason);
|
||||
void disconnect(Component reason);
|
||||
|
||||
/**
|
||||
* Sends chat input onto the players current server as if they typed it into the client chat box.
|
||||
@@ -195,29 +185,6 @@ public interface Player extends
|
||||
*/
|
||||
void spoofChatInput(String input);
|
||||
|
||||
/**
|
||||
* Sends the specified resource pack from {@code url} to the user. If at all possible, send the
|
||||
* resource pack using {@link #sendResourcePack(String, byte[])}. To monitor the status of the
|
||||
* sent resource pack, subscribe to {@link PlayerResourcePackStatusEvent}.
|
||||
*
|
||||
* @param url the URL for the resource pack
|
||||
* @deprecated Use {@link #sendResourcePackOffer(ResourcePackInfo)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
void sendResourcePack(String url);
|
||||
|
||||
/**
|
||||
* Sends the specified resource pack from {@code url} to the user, using the specified 20-byte
|
||||
* SHA-1 hash. To monitor the status of the sent resource pack, subscribe to
|
||||
* {@link PlayerResourcePackStatusEvent}.
|
||||
*
|
||||
* @param url the URL for the resource pack
|
||||
* @param hash the SHA-1 hash value for the resource pack
|
||||
* @deprecated Use {@link #sendResourcePackOffer(ResourcePackInfo)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
void sendResourcePack(String url, byte[] hash);
|
||||
|
||||
/**
|
||||
* Queues and sends a new Resource-pack offer to the player.
|
||||
* To monitor the status of the sent resource pack, subscribe to
|
||||
@@ -236,7 +203,7 @@ public interface Player extends
|
||||
* @return the applied resource pack or null if none.
|
||||
*/
|
||||
@Nullable
|
||||
ResourcePackInfo getAppliedResourcePack();
|
||||
ResourcePackInfo appliedResourcePack();
|
||||
|
||||
/**
|
||||
* Gets the {@link ResourcePackInfo} of the resource pack
|
||||
@@ -246,14 +213,14 @@ public interface Player extends
|
||||
* @return the pending resource pack or null if none
|
||||
*/
|
||||
@Nullable
|
||||
ResourcePackInfo getPendingResourcePack();
|
||||
ResourcePackInfo pendingResourcePack();
|
||||
|
||||
/**
|
||||
* <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
|
||||
* with a mod that is installed on the player's client. To send a plugin message to the server
|
||||
* from the player, you should use the equivalent method on the instance returned by
|
||||
* {@link #getCurrentServer()}.
|
||||
* {@link #connectedServer()}.
|
||||
*
|
||||
* @inheritDoc
|
||||
*/
|
||||
@@ -268,8 +235,8 @@ public interface Player extends
|
||||
@Override
|
||||
default @NotNull HoverEvent<HoverEvent.ShowEntity> asHoverEvent(
|
||||
@NotNull UnaryOperator<HoverEvent.ShowEntity> op) {
|
||||
return HoverEvent.showEntity(op.apply(HoverEvent.ShowEntity.of(this, getUniqueId(),
|
||||
Component.text(getUsername()))));
|
||||
return HoverEvent.showEntity(op.apply(HoverEvent.ShowEntity.showEntity(this, uuid(),
|
||||
Component.text(username()))));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ public interface ProxyServer extends Audience {
|
||||
*
|
||||
* <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 resource pack with {@link ResourcePackInfo.Builder#setHash(byte[])}
|
||||
* of the resource pack with {@link ResourcePackInfo.Builder#hash(byte[])}
|
||||
* whenever possible to save bandwidth. If a hash is present the client will first check
|
||||
* if it already has a resource pack by that hash cached.</p>
|
||||
*
|
||||
|
||||
@@ -23,7 +23,7 @@ public interface ServerConnection extends ChannelMessageSource, ChannelMessageSi
|
||||
*
|
||||
* @return the server this connection is connected to
|
||||
*/
|
||||
RegisteredServer getServer();
|
||||
RegisteredServer server();
|
||||
|
||||
/**
|
||||
* Returns the server that the player associated with this connection was connected to before
|
||||
@@ -31,19 +31,19 @@ public interface ServerConnection extends ChannelMessageSource, ChannelMessageSi
|
||||
*
|
||||
* @return the server the player was connected to.
|
||||
*/
|
||||
Optional<RegisteredServer> getPreviousServer();
|
||||
Optional<RegisteredServer> previousServer();
|
||||
|
||||
/**
|
||||
* Returns the server info for this connection.
|
||||
*
|
||||
* @return the server info for this connection
|
||||
*/
|
||||
ServerInfo getServerInfo();
|
||||
ServerInfo serverInfo();
|
||||
|
||||
/**
|
||||
* Returns the player that this connection is associated with.
|
||||
*
|
||||
* @return the player for this connection
|
||||
*/
|
||||
Player getPlayer();
|
||||
Player player();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.velocitypowered.api.util.Favicon;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
/**
|
||||
* Exposes certain proxy configuration information that plugins may use.
|
||||
@@ -51,7 +52,7 @@ public interface ProxyConfig {
|
||||
*
|
||||
* @return the motd component
|
||||
*/
|
||||
net.kyori.adventure.text.Component getMotd();
|
||||
Component getMotd();
|
||||
|
||||
/**
|
||||
* Get the maximum players shown in the tab list.
|
||||
|
||||
@@ -25,7 +25,7 @@ public interface IdentifiedKey extends KeySigned {
|
||||
*
|
||||
* @return the RSA public key in question
|
||||
*/
|
||||
PublicKey getSignedPublicKey();
|
||||
PublicKey publicKey();
|
||||
|
||||
|
||||
/**
|
||||
@@ -45,14 +45,14 @@ public interface IdentifiedKey extends KeySigned {
|
||||
* @return the holder UUID or null if not present
|
||||
*/
|
||||
@Nullable
|
||||
UUID getSignatureHolder();
|
||||
UUID signatureHolder();
|
||||
|
||||
/**
|
||||
* Retrieves the key revision.
|
||||
*
|
||||
* @return the key revision
|
||||
*/
|
||||
Revision getKeyRevision();
|
||||
Revision revision();
|
||||
|
||||
/**
|
||||
* The different versions of player keys, per Minecraft version.
|
||||
@@ -69,11 +69,11 @@ public interface IdentifiedKey extends KeySigned {
|
||||
this.applicableTo = applicableTo;
|
||||
}
|
||||
|
||||
public Set<Revision> getBackwardsCompatibleTo() {
|
||||
public Set<Revision> backwardsCompatibleTo() {
|
||||
return backwardsCompatibleTo;
|
||||
}
|
||||
|
||||
public Set<ProtocolVersion> getApplicableTo() {
|
||||
public Set<ProtocolVersion> applicableTo() {
|
||||
return applicableTo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,5 +20,5 @@ public interface KeyIdentifiable {
|
||||
*
|
||||
* @return the key or null if not available
|
||||
*/
|
||||
@Nullable IdentifiedKey getIdentifiedKey();
|
||||
@Nullable IdentifiedKey identifiedKey();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public interface KeySigned {
|
||||
*
|
||||
* @return the key
|
||||
*/
|
||||
PublicKey getSigner();
|
||||
PublicKey signer();
|
||||
|
||||
/**
|
||||
* Returns the expiry time point of the key.
|
||||
@@ -32,7 +32,7 @@ public interface KeySigned {
|
||||
*
|
||||
* @return the expiry time point
|
||||
*/
|
||||
Instant getExpiryTemporal();
|
||||
Instant signatureExpiry();
|
||||
|
||||
|
||||
/**
|
||||
@@ -41,7 +41,7 @@ public interface KeySigned {
|
||||
* @return true if proxy time is after expiry time
|
||||
*/
|
||||
default boolean hasExpired() {
|
||||
return Instant.now().isAfter(getExpiryTemporal());
|
||||
return Instant.now().isAfter(signatureExpiry());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +50,7 @@ public interface KeySigned {
|
||||
* @return an RSA signature
|
||||
*/
|
||||
@Nullable
|
||||
byte[] getSignature();
|
||||
byte[] signature();
|
||||
|
||||
/**
|
||||
* Validates the signature, expiry temporal and key against the
|
||||
@@ -71,7 +71,7 @@ public interface KeySigned {
|
||||
*
|
||||
* @return signature salt or null
|
||||
*/
|
||||
default byte[] getSalt() {
|
||||
default byte[] salt() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ public interface SignedMessage extends KeySigned {
|
||||
*
|
||||
* @return the message
|
||||
*/
|
||||
String getMessage();
|
||||
String message();
|
||||
|
||||
/**
|
||||
* Returns the signers UUID.
|
||||
*
|
||||
* @return the uuid
|
||||
*/
|
||||
UUID getSignerUuid();
|
||||
UUID signerUuid();
|
||||
|
||||
/**
|
||||
* If true the signature of this message applies to a stylized component instead.
|
||||
|
||||
@@ -17,5 +17,5 @@ public interface ChannelIdentifier {
|
||||
*
|
||||
* @return the textual representation of the identifier
|
||||
*/
|
||||
String getId();
|
||||
String id();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public final class LegacyChannelIdentifier implements ChannelIdentifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
public String id() {
|
||||
return this.getName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public final class MinecraftChannelIdentifier implements ChannelIdentifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
public String id() {
|
||||
return namespace + ":" + name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ public interface ChatSession extends KeyIdentifiable {
|
||||
*
|
||||
* @return the session UUID
|
||||
*/
|
||||
UUID getSessionId();
|
||||
UUID sessionId();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public interface PlayerSettings {
|
||||
*
|
||||
* @return the client locale
|
||||
*/
|
||||
Locale getLocale();
|
||||
Locale locale();
|
||||
|
||||
/**
|
||||
* Returns the client's view distance. This does not guarantee the client will see this many
|
||||
@@ -27,14 +27,14 @@ public interface PlayerSettings {
|
||||
*
|
||||
* @return the client view distance
|
||||
*/
|
||||
byte getViewDistance();
|
||||
byte viewDistance();
|
||||
|
||||
/**
|
||||
* Returns the chat setting for the client.
|
||||
*
|
||||
* @return the chat setting
|
||||
*/
|
||||
ChatMode getChatMode();
|
||||
ChatMode chatMode();
|
||||
|
||||
/**
|
||||
* Returns whether or not the client has chat colors disabled.
|
||||
@@ -48,14 +48,14 @@ public interface PlayerSettings {
|
||||
*
|
||||
* @return the skin parts for the client
|
||||
*/
|
||||
SkinParts getSkinParts();
|
||||
SkinParts skinParts();
|
||||
|
||||
/**
|
||||
* Returns the primary hand of the client.
|
||||
*
|
||||
* @return the primary hand of the client
|
||||
*/
|
||||
MainHand getMainHand();
|
||||
MainHand mainHand();
|
||||
|
||||
/**
|
||||
* Returns whether the client explicitly allows listing on the
|
||||
|
||||
@@ -20,7 +20,7 @@ public interface ResourcePackInfo {
|
||||
*
|
||||
* @return the location of the resource-pack
|
||||
*/
|
||||
String getUrl();
|
||||
String url();
|
||||
|
||||
/**
|
||||
* Gets the {@link Component} that is displayed on the resource-pack prompt.
|
||||
@@ -29,31 +29,31 @@ public interface ResourcePackInfo {
|
||||
* @return the prompt if present or null otherwise
|
||||
*/
|
||||
@Nullable
|
||||
Component getPrompt();
|
||||
Component prompt();
|
||||
|
||||
/**
|
||||
* Gets whether or not the acceptance of the resource-pack is enforced.
|
||||
* See {@link Builder#setShouldForce(boolean)} for more information.
|
||||
* See {@link Builder#required(boolean)} for more information.
|
||||
*
|
||||
* @return whether or not to force usage of this resource-pack
|
||||
*/
|
||||
boolean getShouldForce();
|
||||
boolean required();
|
||||
|
||||
/**
|
||||
* Gets the SHA-1 hash of the resource-pack
|
||||
* See {@link Builder#setHash(byte[])} for more information.
|
||||
* See {@link Builder#hash(byte[])} for more information.
|
||||
*
|
||||
* @return the hash if present or null otherwise
|
||||
*/
|
||||
@Nullable
|
||||
byte[] getHash();
|
||||
byte[] hash();
|
||||
|
||||
/**
|
||||
* Gets the {@link Origin} of this resource-pack.
|
||||
*
|
||||
* @return the origin of the resource pack
|
||||
*/
|
||||
Origin getOrigin();
|
||||
Origin origin();
|
||||
|
||||
/**
|
||||
* Gets the original {@link Origin} of the resource-pack.
|
||||
@@ -62,16 +62,15 @@ public interface ResourcePackInfo {
|
||||
*
|
||||
* @return the origin of the resource pack
|
||||
*/
|
||||
Origin getOriginalOrigin();
|
||||
Origin originalOrigin();
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@link ResourcePackInfo} instance as a builder so that it can
|
||||
* be modified.
|
||||
* It is <b>not</b> guaranteed that
|
||||
* {@code resourcePackInfo.asBuilder().build().equals(resourcePackInfo)} is true. That is due to
|
||||
* the transient {@link ResourcePackInfo#getOrigin()} and
|
||||
* {@link ResourcePackInfo#getOriginalOrigin()} fields.
|
||||
*
|
||||
* the transient {@link ResourcePackInfo#origin()} and
|
||||
* {@link ResourcePackInfo#originalOrigin()} fields.
|
||||
*
|
||||
* @return a content-copy of this instance as a {@link ResourcePackInfo.Builder}
|
||||
*/
|
||||
@@ -82,8 +81,8 @@ public interface ResourcePackInfo {
|
||||
* <p/>
|
||||
* It is <b>not</b> guaranteed that
|
||||
* {@code resourcePackInfo.asBuilder(resourcePackInfo.getUrl()).build().equals(resourcePackInfo)}
|
||||
* is true, because the {@link ResourcePackInfo#getOrigin()} and
|
||||
* {@link ResourcePackInfo#getOriginalOrigin()} fields are transient.
|
||||
* is true, because the {@link ResourcePackInfo#origin()} and
|
||||
* {@link ResourcePackInfo#originalOrigin()} fields are transient.
|
||||
*
|
||||
* @param newUrl The new URL to use in the updated builder.
|
||||
*
|
||||
@@ -114,7 +113,7 @@ public interface ResourcePackInfo {
|
||||
*
|
||||
* @param shouldForce whether or not to force the client to accept the resource pack
|
||||
*/
|
||||
Builder setShouldForce(boolean shouldForce);
|
||||
Builder required(boolean shouldForce);
|
||||
|
||||
/**
|
||||
* Sets the SHA-1 hash of the provided resource pack.
|
||||
@@ -126,7 +125,7 @@ public interface ResourcePackInfo {
|
||||
*
|
||||
* @param hash the SHA-1 hash of the resource-pack
|
||||
*/
|
||||
Builder setHash(@Nullable byte[] hash);
|
||||
Builder hash(@Nullable byte[] hash);
|
||||
|
||||
/**
|
||||
* Sets a {@link Component} to display on the download prompt.
|
||||
@@ -134,7 +133,7 @@ public interface ResourcePackInfo {
|
||||
*
|
||||
* @param prompt the component to display
|
||||
*/
|
||||
Builder setPrompt(@Nullable Component prompt);
|
||||
Builder prompt(@Nullable Component prompt);
|
||||
|
||||
/**
|
||||
* Builds the {@link ResourcePackInfo} from the provided info for use with
|
||||
|
||||
@@ -97,7 +97,7 @@ public interface TabList {
|
||||
*
|
||||
* @return immutable {@link Collection} of tab list entries
|
||||
*/
|
||||
Collection<TabListEntry> getEntries();
|
||||
Collection<TabListEntry> entries();
|
||||
|
||||
/**
|
||||
* Clears all entries from the tab list.
|
||||
|
||||
@@ -26,12 +26,12 @@ public interface TabListEntry extends KeyIdentifiable {
|
||||
@Nullable ChatSession getChatSession();
|
||||
|
||||
@Override
|
||||
default IdentifiedKey getIdentifiedKey() {
|
||||
default IdentifiedKey identifiedKey() {
|
||||
ChatSession session = getChatSession();
|
||||
if (session == null) {
|
||||
return null;
|
||||
}
|
||||
return getChatSession().getIdentifiedKey();
|
||||
return getChatSession().identifiedKey();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,7 +53,7 @@ public interface TabListEntry extends KeyIdentifiable {
|
||||
/**
|
||||
* Returns {@link Optional} text {@link net.kyori.adventure.text.Component}, which if present is
|
||||
* the text displayed for {@code this} entry in the {@link TabList}, otherwise
|
||||
* {@link GameProfile#getName()} is shown.
|
||||
* {@link GameProfile#name()} is shown.
|
||||
*
|
||||
* @return {@link Optional} text {@link net.kyori.adventure.text.Component} of name displayed in
|
||||
* the tab list
|
||||
@@ -62,7 +62,7 @@ public interface TabListEntry extends KeyIdentifiable {
|
||||
|
||||
/**
|
||||
* Sets the text {@link Component} to be displayed for {@code this} {@link TabListEntry}. If
|
||||
* {@code null}, {@link GameProfile#getName()} will be shown.
|
||||
* {@code null}, {@link GameProfile#name()} will be shown.
|
||||
*
|
||||
* @param displayName to show in the {@link TabList} for {@code this} entry
|
||||
* @return {@code this}, for chaining
|
||||
|
||||
@@ -41,7 +41,7 @@ public final class PingOptions {
|
||||
*
|
||||
* @return the emulated Minecraft version
|
||||
*/
|
||||
public ProtocolVersion getProtocolVersion() {
|
||||
public ProtocolVersion protocolVersion() {
|
||||
return this.protocolVersion;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public final class PingOptions {
|
||||
*
|
||||
* @return the server ping timeout in milliseconds
|
||||
*/
|
||||
public long getTimeout() {
|
||||
public long timeout() {
|
||||
return this.timeout;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public final class QueryResponse {
|
||||
*
|
||||
* @return hostname
|
||||
*/
|
||||
public String getHostname() {
|
||||
public String hostname() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public final class QueryResponse {
|
||||
*
|
||||
* @return game version
|
||||
*/
|
||||
public String getGameVersion() {
|
||||
public String gameVersion() {
|
||||
return gameVersion;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public final class QueryResponse {
|
||||
*
|
||||
* @return map name
|
||||
*/
|
||||
public String getMap() {
|
||||
public String map() {
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public final class QueryResponse {
|
||||
*
|
||||
* @return online player count
|
||||
*/
|
||||
public int getCurrentPlayers() {
|
||||
public int currentPlayers() {
|
||||
return currentPlayers;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public final class QueryResponse {
|
||||
*
|
||||
* @return max player count
|
||||
*/
|
||||
public int getMaxPlayers() {
|
||||
public int maxPlayers() {
|
||||
return maxPlayers;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public final class QueryResponse {
|
||||
*
|
||||
* @return proxy hostname
|
||||
*/
|
||||
public String getProxyHost() {
|
||||
public String proxyHost() {
|
||||
return proxyHost;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public final class QueryResponse {
|
||||
*
|
||||
* @return proxy port
|
||||
*/
|
||||
public int getProxyPort() {
|
||||
public int proxyPort() {
|
||||
return proxyPort;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public final class QueryResponse {
|
||||
*
|
||||
* @return collection of players
|
||||
*/
|
||||
public Collection<String> getPlayers() {
|
||||
public Collection<String> players() {
|
||||
return players;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public final class QueryResponse {
|
||||
*
|
||||
* @return server software
|
||||
*/
|
||||
public String getProxyVersion() {
|
||||
public String proxyVersion() {
|
||||
return proxyVersion;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ public final class QueryResponse {
|
||||
*
|
||||
* @return collection of plugins
|
||||
*/
|
||||
public Collection<PluginInformation> getPlugins() {
|
||||
public Collection<PluginInformation> plugins() {
|
||||
return plugins;
|
||||
}
|
||||
|
||||
@@ -158,16 +158,16 @@ public final class QueryResponse {
|
||||
*/
|
||||
public Builder toBuilder() {
|
||||
return QueryResponse.builder()
|
||||
.hostname(getHostname())
|
||||
.gameVersion(getGameVersion())
|
||||
.map(getMap())
|
||||
.currentPlayers(getCurrentPlayers())
|
||||
.maxPlayers(getMaxPlayers())
|
||||
.proxyHost(getProxyHost())
|
||||
.proxyPort(getProxyPort())
|
||||
.players(getPlayers())
|
||||
.proxyVersion(getProxyVersion())
|
||||
.plugins(getPlugins());
|
||||
.hostname(hostname())
|
||||
.gameVersion(gameVersion())
|
||||
.map(map())
|
||||
.currentPlayers(currentPlayers())
|
||||
.maxPlayers(maxPlayers())
|
||||
.proxyHost(proxyHost())
|
||||
.proxyPort(proxyPort())
|
||||
.players(players())
|
||||
.proxyVersion(proxyVersion())
|
||||
.plugins(plugins());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -347,7 +347,7 @@ public final class QueryResponse {
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all players from the builder. This does not affect {@link #getCurrentPlayers()}.
|
||||
* Removes all players from the builder. This does not affect {@link #currentPlayers()}.
|
||||
*
|
||||
* @return this builder, for chaining
|
||||
*/
|
||||
|
||||
@@ -25,14 +25,14 @@ public interface RegisteredServer extends ChannelMessageSink, Audience {
|
||||
*
|
||||
* @return the server info
|
||||
*/
|
||||
ServerInfo getServerInfo();
|
||||
ServerInfo serverInfo();
|
||||
|
||||
/**
|
||||
* Returns a list of all the players currently connected to this server on this proxy.
|
||||
*
|
||||
* @return the players on this proxy
|
||||
*/
|
||||
Collection<Player> getPlayersConnected();
|
||||
Collection<Player> players();
|
||||
|
||||
/**
|
||||
* Attempts to ping the remote server and return the server list ping result.
|
||||
|
||||
@@ -32,11 +32,11 @@ public final class ServerInfo implements Comparable<ServerInfo> {
|
||||
this.address = Preconditions.checkNotNull(address, "address");
|
||||
}
|
||||
|
||||
public final String getName() {
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public final SocketAddress getAddress() {
|
||||
public SocketAddress address() {
|
||||
return address;
|
||||
}
|
||||
|
||||
@@ -68,6 +68,6 @@ public final class ServerInfo implements Comparable<ServerInfo> {
|
||||
|
||||
@Override
|
||||
public int compareTo(ServerInfo o) {
|
||||
return this.name.compareTo(o.getName());
|
||||
return this.name.compareTo(o.name());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
/**
|
||||
@@ -27,12 +28,12 @@ public final class ServerPing {
|
||||
|
||||
private final Version version;
|
||||
private final @Nullable Players players;
|
||||
private final net.kyori.adventure.text.Component description;
|
||||
private final Component description;
|
||||
private final @Nullable Favicon favicon;
|
||||
private final @Nullable ModInfo modinfo;
|
||||
|
||||
public ServerPing(Version version, @Nullable Players players,
|
||||
net.kyori.adventure.text.Component description, @Nullable Favicon favicon) {
|
||||
Component description, @Nullable Favicon favicon) {
|
||||
this(version, players, description, favicon, ModInfo.DEFAULT);
|
||||
}
|
||||
|
||||
@@ -46,7 +47,7 @@ public final class ServerPing {
|
||||
* @param modinfo the mods this server runs
|
||||
*/
|
||||
public ServerPing(Version version, @Nullable Players players,
|
||||
net.kyori.adventure.text.Component description, @Nullable Favicon favicon,
|
||||
Component description, @Nullable Favicon favicon,
|
||||
@Nullable ModInfo modinfo) {
|
||||
this.version = Preconditions.checkNotNull(version, "version");
|
||||
this.players = players;
|
||||
@@ -55,23 +56,23 @@ public final class ServerPing {
|
||||
this.modinfo = modinfo;
|
||||
}
|
||||
|
||||
public Version getVersion() {
|
||||
public Version version() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public Optional<Players> getPlayers() {
|
||||
public Optional<Players> players() {
|
||||
return Optional.ofNullable(players);
|
||||
}
|
||||
|
||||
public net.kyori.adventure.text.Component getDescriptionComponent() {
|
||||
public Component description() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public Optional<Favicon> getFavicon() {
|
||||
public Optional<Favicon> favicon() {
|
||||
return Optional.ofNullable(favicon);
|
||||
}
|
||||
|
||||
public Optional<ModInfo> getModinfo() {
|
||||
public Optional<ModInfo> modInfo() {
|
||||
return Optional.ofNullable(modinfo);
|
||||
}
|
||||
|
||||
@@ -129,8 +130,8 @@ public final class ServerPing {
|
||||
builder.favicon = favicon;
|
||||
builder.nullOutModinfo = modinfo == null;
|
||||
if (modinfo != null) {
|
||||
builder.modType = modinfo.getType();
|
||||
builder.mods.addAll(modinfo.getMods());
|
||||
builder.modType = modinfo.type();
|
||||
builder.mods.addAll(modinfo.mods());
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
@@ -150,7 +151,7 @@ public final class ServerPing {
|
||||
private final List<SamplePlayer> samplePlayers = new ArrayList<>();
|
||||
private String modType = "FML";
|
||||
private final List<ModInfo.Mod> mods = new ArrayList<>();
|
||||
private net.kyori.adventure.text.Component description;
|
||||
private Component description;
|
||||
private @Nullable Favicon favicon;
|
||||
private boolean nullOutPlayers;
|
||||
private boolean nullOutModinfo;
|
||||
@@ -197,9 +198,9 @@ public final class ServerPing {
|
||||
*/
|
||||
public Builder mods(ModInfo mods) {
|
||||
Preconditions.checkNotNull(mods, "mods");
|
||||
this.modType = mods.getType();
|
||||
this.modType = mods.type();
|
||||
this.mods.clear();
|
||||
this.mods.addAll(mods.getMods());
|
||||
this.mods.addAll(mods.mods());
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -223,7 +224,7 @@ public final class ServerPing {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder description(net.kyori.adventure.text.Component description) {
|
||||
public Builder description(Component description) {
|
||||
this.description = Preconditions.checkNotNull(description, "description");
|
||||
return this;
|
||||
}
|
||||
@@ -272,7 +273,7 @@ public final class ServerPing {
|
||||
return samplePlayers;
|
||||
}
|
||||
|
||||
public Optional<net.kyori.adventure.text.Component> getDescriptionComponent() {
|
||||
public Optional<Component> getDescriptionComponent() {
|
||||
return Optional.ofNullable(description);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,11 +39,11 @@ public final class Favicon {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Base64-encoded URI for this image.
|
||||
* Returns the Base64-encoded URL for this image.
|
||||
*
|
||||
* @return a URL representing this favicon
|
||||
*/
|
||||
public String getBase64Url() {
|
||||
public String url() {
|
||||
return base64Url;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public final class GameProfile {
|
||||
*
|
||||
* @return the undashed UUID
|
||||
*/
|
||||
public String getUndashedId() {
|
||||
public String undashedId() {
|
||||
return undashedId;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public final class GameProfile {
|
||||
*
|
||||
* @return the UUID
|
||||
*/
|
||||
public UUID getId() {
|
||||
public UUID uuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public final class GameProfile {
|
||||
*
|
||||
* @return the username
|
||||
*/
|
||||
public String getName() {
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public final class GameProfile {
|
||||
*
|
||||
* @return the properties associated with this profile
|
||||
*/
|
||||
public List<Property> getProperties() {
|
||||
public List<Property> properties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
@@ -200,15 +200,15 @@ public final class GameProfile {
|
||||
this.signature = Preconditions.checkNotNull(signature, "signature");
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
public String value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getSignature() {
|
||||
public String signature() {
|
||||
return signature;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@ public final class ModInfo {
|
||||
this.modList = ImmutableList.copyOf(modList);
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
public String type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public List<Mod> getMods() {
|
||||
public List<Mod> mods() {
|
||||
return modList;
|
||||
}
|
||||
|
||||
@@ -81,11 +81,11 @@ public final class ModInfo {
|
||||
this.version = Preconditions.checkNotNull(version, "version");
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
public String id() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
public String version() {
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,15 +33,15 @@ public final class ProxyVersion {
|
||||
this.version = Preconditions.checkNotNull(version, "version");
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getVendor() {
|
||||
public String vendor() {
|
||||
return vendor;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
public String version() {
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user