From 8be7ca9ab5e9e150f14237a4cd10bc5f29ec780c Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sat, 29 Sep 2018 03:38:42 -0400 Subject: [PATCH] Apply final modifier to all classes in the api module. --- .../event/connection/ConnectionHandshakeEvent.java | 2 +- .../api/event/connection/DisconnectEvent.java | 2 +- .../api/event/connection/LoginEvent.java | 2 +- .../api/event/connection/PluginMessageEvent.java | 4 ++-- .../api/event/connection/PostLoginEvent.java | 2 +- .../api/event/connection/PreLoginEvent.java | 4 ++-- .../event/permission/PermissionsSetupEvent.java | 2 +- .../api/event/player/GameProfileRequestEvent.java | 2 +- .../api/event/player/KickedFromServerEvent.java | 6 +++--- .../api/event/player/PlayerChatEvent.java | 4 ++-- .../event/player/PlayerSettingsChangedEvent.java | 2 +- .../api/event/player/ServerConnectedEvent.java | 2 +- .../api/event/player/ServerPreConnectEvent.java | 2 +- .../api/event/proxy/ProxyInitializeEvent.java | 2 +- .../api/event/proxy/ProxyPingEvent.java | 2 +- .../api/event/proxy/ProxyShutdownEvent.java | 2 +- .../api/proxy/player/SkinParts.java | 4 +--- .../api/proxy/server/ServerPing.java | 14 +++++++------- .../com/velocitypowered/api/util/UuidUtils.java | 2 +- .../velocitypowered/api/util/title/TextTitle.java | 2 +- .../com/velocitypowered/api/util/title/Titles.java | 2 +- 21 files changed, 32 insertions(+), 34 deletions(-) diff --git a/api/src/main/java/com/velocitypowered/api/event/connection/ConnectionHandshakeEvent.java b/api/src/main/java/com/velocitypowered/api/event/connection/ConnectionHandshakeEvent.java index f2ecc0547..a590a83ad 100644 --- a/api/src/main/java/com/velocitypowered/api/event/connection/ConnectionHandshakeEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/connection/ConnectionHandshakeEvent.java @@ -7,7 +7,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; /** * This event is fired when a handshake is established between a client and Velocity. */ -public class ConnectionHandshakeEvent { +public final class ConnectionHandshakeEvent { private final @NonNull InboundConnection connection; public ConnectionHandshakeEvent(@NonNull InboundConnection connection) { diff --git a/api/src/main/java/com/velocitypowered/api/event/connection/DisconnectEvent.java b/api/src/main/java/com/velocitypowered/api/event/connection/DisconnectEvent.java index 0ef43909b..5a861dd51 100644 --- a/api/src/main/java/com/velocitypowered/api/event/connection/DisconnectEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/connection/DisconnectEvent.java @@ -8,7 +8,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; * This event is fired when a player disconnects from the proxy. Operations on the provided player, aside from basic * data retrieval operations, may behave in undefined ways. */ -public class DisconnectEvent { +public final class DisconnectEvent { private @NonNull final Player player; public DisconnectEvent(@NonNull Player player) { diff --git a/api/src/main/java/com/velocitypowered/api/event/connection/LoginEvent.java b/api/src/main/java/com/velocitypowered/api/event/connection/LoginEvent.java index 0ac7f9374..fa19da77e 100644 --- a/api/src/main/java/com/velocitypowered/api/event/connection/LoginEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/connection/LoginEvent.java @@ -8,7 +8,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; /** * This event is fired once the player has been authenticated but before they connect to a server on the proxy. */ -public class LoginEvent implements ResultedEvent { +public final class LoginEvent implements ResultedEvent { private final Player player; private ComponentResult result; diff --git a/api/src/main/java/com/velocitypowered/api/event/connection/PluginMessageEvent.java b/api/src/main/java/com/velocitypowered/api/event/connection/PluginMessageEvent.java index b16f933e4..4b2941a94 100644 --- a/api/src/main/java/com/velocitypowered/api/event/connection/PluginMessageEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/connection/PluginMessageEvent.java @@ -15,7 +15,7 @@ import java.util.Arrays; * This event is fired when a plugin message is sent to the proxy, either from a client ({@link com.velocitypowered.api.proxy.Player}) * or a server ({@link com.velocitypowered.api.proxy.ServerConnection}). */ -public class PluginMessageEvent implements ResultedEvent { +public final class PluginMessageEvent implements ResultedEvent { private final ChannelMessageSource source; private final ChannelMessageSink target; private final ChannelIdentifier identifier; @@ -74,7 +74,7 @@ public class PluginMessageEvent implements ResultedEvent { +public final class PreLoginEvent implements ResultedEvent { private final InboundConnection connection; private final String username; private PreLoginComponentResult result; @@ -55,7 +55,7 @@ public class PreLoginEvent implements ResultedEventThis event is only called once per subject, on initialisation.

*/ -public class PermissionsSetupEvent { +public final class PermissionsSetupEvent { private final PermissionSubject subject; private final PermissionProvider defaultProvider; private PermissionProvider provider; diff --git a/api/src/main/java/com/velocitypowered/api/event/player/GameProfileRequestEvent.java b/api/src/main/java/com/velocitypowered/api/event/player/GameProfileRequestEvent.java index ab46c37c1..aec8e445d 100644 --- a/api/src/main/java/com/velocitypowered/api/event/player/GameProfileRequestEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/player/GameProfileRequestEvent.java @@ -9,7 +9,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * This event is fired after the {@link com.velocitypowered.api.event.connection.PreLoginEvent} in order to set up the * game profile for the user. This can be used to configure a custom profile for a user, i.e. skin replacement. */ -public class GameProfileRequestEvent { +public final class GameProfileRequestEvent { private final String username; private final InboundConnection connection; private final GameProfile originalProfile; diff --git a/api/src/main/java/com/velocitypowered/api/event/player/KickedFromServerEvent.java b/api/src/main/java/com/velocitypowered/api/event/player/KickedFromServerEvent.java index bfdf296e6..c24ec0c58 100644 --- a/api/src/main/java/com/velocitypowered/api/event/player/KickedFromServerEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/player/KickedFromServerEvent.java @@ -11,7 +11,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; * Fired when a player is kicked from a server. You may either allow Velocity to kick the player (with an optional reason * override) or redirect the player to a separate server. */ -public class KickedFromServerEvent implements ResultedEvent { +public final class KickedFromServerEvent implements ResultedEvent { private final Player player; private final RegisteredServer server; private final Component originalReason; @@ -60,7 +60,7 @@ public class KickedFromServerEvent implements ResultedEvent { +public final class PlayerChatEvent implements ResultedEvent { private final Player player; private final String message; private ChatResult result; @@ -52,7 +52,7 @@ public class PlayerChatEvent implements ResultedEvent { +public final class ServerPreConnectEvent implements ResultedEvent { private final Player player; private final RegisteredServer originalServer; private ServerResult result; diff --git a/api/src/main/java/com/velocitypowered/api/event/proxy/ProxyInitializeEvent.java b/api/src/main/java/com/velocitypowered/api/event/proxy/ProxyInitializeEvent.java index 14bee8b1e..ea55e9515 100644 --- a/api/src/main/java/com/velocitypowered/api/event/proxy/ProxyInitializeEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/proxy/ProxyInitializeEvent.java @@ -3,7 +3,7 @@ package com.velocitypowered.api.event.proxy; /** * This event is fired by the proxy after plugins have been loaded but before the proxy starts accepting connections. */ -public class ProxyInitializeEvent { +public final class ProxyInitializeEvent { @Override public String toString() { return "ProxyInitializeEvent"; diff --git a/api/src/main/java/com/velocitypowered/api/event/proxy/ProxyPingEvent.java b/api/src/main/java/com/velocitypowered/api/event/proxy/ProxyPingEvent.java index e40d810b9..aa8b605b3 100644 --- a/api/src/main/java/com/velocitypowered/api/event/proxy/ProxyPingEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/proxy/ProxyPingEvent.java @@ -7,7 +7,7 @@ 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 final class ProxyPingEvent { private final InboundConnection connection; private ServerPing ping; diff --git a/api/src/main/java/com/velocitypowered/api/event/proxy/ProxyShutdownEvent.java b/api/src/main/java/com/velocitypowered/api/event/proxy/ProxyShutdownEvent.java index 0ae15f192..76bfac5e7 100644 --- a/api/src/main/java/com/velocitypowered/api/event/proxy/ProxyShutdownEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/proxy/ProxyShutdownEvent.java @@ -4,7 +4,7 @@ package com.velocitypowered.api.event.proxy; * This event is fired by the proxy after the proxy has stopped accepting connections but before the proxy process * exits. */ -public class ProxyShutdownEvent { +public final class ProxyShutdownEvent { @Override public String toString() { return "ProxyShutdownEvent"; diff --git a/api/src/main/java/com/velocitypowered/api/proxy/player/SkinParts.java b/api/src/main/java/com/velocitypowered/api/proxy/player/SkinParts.java index 29a6a501e..fcd43c2c5 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/player/SkinParts.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/player/SkinParts.java @@ -1,8 +1,6 @@ package com.velocitypowered.api.proxy.player; -public class SkinParts { - - static final SkinParts SKIN_SHOW_ALL = new SkinParts((byte) 127); +public final class SkinParts { private final byte bitmask; public SkinParts(byte skinBitmask) { diff --git a/api/src/main/java/com/velocitypowered/api/proxy/server/ServerPing.java b/api/src/main/java/com/velocitypowered/api/proxy/server/ServerPing.java index f4fb7c1ae..4ffaa83a1 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/server/ServerPing.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/server/ServerPing.java @@ -11,7 +11,7 @@ import java.util.*; /** * Represents a 1.7 and above server list ping response. This class is immutable. */ -public class ServerPing { +public final class ServerPing { private final Version version; private final Players players; private final Component description; @@ -87,7 +87,7 @@ public class ServerPing { /** * A builder for {@link ServerPing} objects. */ - public static class Builder { + public static final class Builder { private Version version; private int onlinePlayers; private int maximumPlayers; @@ -217,7 +217,7 @@ public class ServerPing { } } - public static class Version { + public static final class Version { private final int protocol; private final String name; @@ -243,7 +243,7 @@ public class ServerPing { } } - public static class Players { + public static final class Players { private final int online; private final int max; private final List sample; @@ -276,7 +276,7 @@ public class ServerPing { } } - public static class SamplePlayer { + public static final class SamplePlayer { private final String name; private final UUID id; @@ -302,7 +302,7 @@ public class ServerPing { } } - public static class ModInfo { + public static final class ModInfo { public static final ModInfo DEFAULT = new ModInfo("FML", ImmutableList.of()); private final String type; @@ -322,7 +322,7 @@ public class ServerPing { } } - public static class Mod { + public static final class Mod { private final String id; private final String version; diff --git a/api/src/main/java/com/velocitypowered/api/util/UuidUtils.java b/api/src/main/java/com/velocitypowered/api/util/UuidUtils.java index a6c89b9cd..9cec7f6c4 100644 --- a/api/src/main/java/com/velocitypowered/api/util/UuidUtils.java +++ b/api/src/main/java/com/velocitypowered/api/util/UuidUtils.java @@ -10,7 +10,7 @@ import java.util.UUID; /** * Provides a small, useful selection of utilities for working with Minecraft UUIDs. */ -public class UuidUtils { +public final class UuidUtils { private UuidUtils() { throw new AssertionError(); } diff --git a/api/src/main/java/com/velocitypowered/api/util/title/TextTitle.java b/api/src/main/java/com/velocitypowered/api/util/title/TextTitle.java index 53a84fe45..6a3ffd0e5 100644 --- a/api/src/main/java/com/velocitypowered/api/util/title/TextTitle.java +++ b/api/src/main/java/com/velocitypowered/api/util/title/TextTitle.java @@ -10,7 +10,7 @@ import java.util.Optional; /** * Represents a "full" title, including all components. This class is immutable. */ -public class TextTitle implements Title { +public final class TextTitle implements Title { private final Component title; private final Component subtitle; private final int stay; diff --git a/api/src/main/java/com/velocitypowered/api/util/title/Titles.java b/api/src/main/java/com/velocitypowered/api/util/title/Titles.java index 242a04411..9474b575f 100644 --- a/api/src/main/java/com/velocitypowered/api/util/title/Titles.java +++ b/api/src/main/java/com/velocitypowered/api/util/title/Titles.java @@ -3,7 +3,7 @@ package com.velocitypowered.api.util.title; /** * Provides special-purpose titles. */ -public class Titles { +public final class Titles { private Titles() { throw new AssertionError(); }