diff --git a/pom.xml b/pom.xml index 483a210..48a002a 100644 --- a/pom.xml +++ b/pom.xml @@ -7,11 +7,11 @@ com.glyart.authmevelocity parent pom - 1.4.0 + 1.5.0 - 16 - 16 + 11 + 11 @@ -34,8 +34,8 @@ maven-compiler-plugin 3.9.0 - 16 - 16 + 11 + 11 diff --git a/proxy/pom.xml b/proxy/pom.xml index 63f4a6f..c3f32ac 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -5,13 +5,13 @@ parent com.glyart.authmevelocity - 1.4.0 + 1.5.0 4.0.0 - 16 - 16 + 11 + 11 proxy diff --git a/proxy/src/main/java/com/glyart/authmevelocity/proxy/config/AuthMeConfig.java b/proxy/src/main/java/com/glyart/authmevelocity/proxy/config/AuthMeConfig.java index 19041c9..8e898e0 100644 --- a/proxy/src/main/java/com/glyart/authmevelocity/proxy/config/AuthMeConfig.java +++ b/proxy/src/main/java/com/glyart/authmevelocity/proxy/config/AuthMeConfig.java @@ -13,12 +13,7 @@ import org.spongepowered.configurate.objectmapping.ConfigSerializable; import org.spongepowered.configurate.objectmapping.meta.Comment; public class AuthMeConfig { - private static final String HEADER = """ - AuthmeVelocity Proxy - - Original Developer: xQuickGlare - Current Developer: 4drian3d - """; + private static final String HEADER = "AuthmeVelocity Proxy\n\nOriginal Developer: xQuickGlare\nCurrent Developer: 4drian3d"; private static final HoconConfigurationLoader.Builder configBuilder = HoconConfigurationLoader.builder() .defaultOptions(opts -> opts .shouldCopyDefaults(true) @@ -70,10 +65,7 @@ public class AuthMeConfig { @Comment("Send logged in players to another server?") private boolean sendToServerOnLogin = false; - @Comment(""" - List of servers to send - One of these servers will be chosen at random - """) + @Comment("List of servers to send\nOne of these servers will be chosen at random") private List teleportServers = List.of( "lobby1", "lobby2" @@ -100,9 +92,7 @@ public class AuthMeConfig { "captcha" ); - @Comment(""" - Sets the message to send in case a non-logged-in player executes an unauthorized command - To deactivate the message, leave it empty""") + @Comment("Sets the message to send in case a non-logged-in player executes an unauthorized command\nTo deactivate the message, leave it empty") private String blockedCommandMessage = "&4You cannot execute commands if you are not logged in yet"; public Set getAllowedCommands(){ diff --git a/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/PreSendOnLoginEvent.java b/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/PreSendOnLoginEvent.java index a4e73d5..41672e8 100644 --- a/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/PreSendOnLoginEvent.java +++ b/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/PreSendOnLoginEvent.java @@ -11,7 +11,7 @@ import com.velocitypowered.api.proxy.server.RegisteredServer; * Event to be executed just before sending a player to another server after login/registration. * Here you have the ability to deny the event. */ -public class PreSendOnLoginEvent implements ResultedEvent { +public final class PreSendOnLoginEvent implements ResultedEvent { private GenericResult result = GenericResult.allowed(); private final Player player; diff --git a/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/ProxyLoginEvent.java b/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/ProxyLoginEvent.java index 8533a39..ea41248 100644 --- a/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/ProxyLoginEvent.java +++ b/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/ProxyLoginEvent.java @@ -7,4 +7,14 @@ import org.jetbrains.annotations.NotNull; /** * Event executed in case the player is successfully logged in */ -public record ProxyLoginEvent(@NotNull Player player) {} +public final class ProxyLoginEvent { + private final Player player; + + public ProxyLoginEvent(@NotNull Player player){ + this.player = player; + } + + public @NotNull Player getPlayer(){ + return this.player; + } +} diff --git a/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/ProxyLogoutEvent.java b/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/ProxyLogoutEvent.java index 416671b..e9975ad 100644 --- a/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/ProxyLogoutEvent.java +++ b/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/ProxyLogoutEvent.java @@ -4,4 +4,14 @@ import com.velocitypowered.api.proxy.Player; import org.jetbrains.annotations.NotNull; -public record ProxyLogoutEvent(@NotNull Player player) {} +public final class ProxyLogoutEvent { + private final Player player; + + public ProxyLogoutEvent(@NotNull Player player){ + this.player = player; + } + + public @NotNull Player getPlayer(){ + return this.player; + } +} diff --git a/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/ProxyRegisterEvent.java b/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/ProxyRegisterEvent.java index 20c2e43..8dd59b9 100644 --- a/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/ProxyRegisterEvent.java +++ b/proxy/src/main/java/com/glyart/authmevelocity/proxy/event/ProxyRegisterEvent.java @@ -4,4 +4,14 @@ import com.velocitypowered.api.proxy.Player; import org.jetbrains.annotations.NotNull; -public record ProxyRegisterEvent(@NotNull Player player){} +public final class ProxyRegisterEvent { + private final Player player; + + public ProxyRegisterEvent(@NotNull Player player){ + this.player = player; + } + + public @NotNull Player getPlayer(){ + return this.player; + } +} diff --git a/proxy/src/main/java/com/glyart/authmevelocity/proxy/listener/PluginMessageListener.java b/proxy/src/main/java/com/glyart/authmevelocity/proxy/listener/PluginMessageListener.java index 0695e01..44e26b6 100644 --- a/proxy/src/main/java/com/glyart/authmevelocity/proxy/listener/PluginMessageListener.java +++ b/proxy/src/main/java/com/glyart/authmevelocity/proxy/listener/PluginMessageListener.java @@ -36,10 +36,11 @@ public class PluginMessageListener { @Subscribe public void onPluginMessage(final PluginMessageEvent event, Continuation continuation) { - if (!(event.getSource() instanceof ServerConnection connection) || !event.getIdentifier().getId().equals("authmevelocity:main")){ + if (!(event.getSource() instanceof ServerConnection) || !event.getIdentifier().getId().equals("authmevelocity:main")){ continuation.resume(); return; } + ServerConnection connection = ((ServerConnection)event.getSource()); event.setResult(PluginMessageEvent.ForwardResult.handled()); @@ -47,24 +48,24 @@ public class PluginMessageListener { final String sChannel = input.readUTF(); final Player loggedPlayer = connection.getPlayer(); switch(sChannel){ - case "LOGIN" -> { + case "LOGIN" : if (AuthmeVelocityAPI.addPlayer(loggedPlayer)){ createServerConnectionRequest(loggedPlayer, config, proxy, logger, connection); } continuation.resume(); - } - case "LOGOUT" -> { + break; + case "LOGOUT": if(AuthmeVelocityAPI.removePlayer(loggedPlayer)){ proxy.getEventManager().fireAndForget(new ProxyLogoutEvent(loggedPlayer)); } continuation.resume(); - } - case "REGISTER" -> { + break; + case "REGISTER": proxy.getEventManager().fireAndForget(new ProxyRegisterEvent(loggedPlayer)); continuation.resume(); - } + break; - default -> continuation.resume(); + default: continuation.resume(); } } diff --git a/spigot/pom.xml b/spigot/pom.xml index 4ac59af..cd2da68 100644 --- a/spigot/pom.xml +++ b/spigot/pom.xml @@ -5,15 +5,15 @@ parent com.glyart.authmevelocity - 1.4.0 + 1.5.0 4.0.0 spigot - 16 - 16 + 11 + 11