From e670ed38c0c70f7db5e8dab759313cbf97ee6303 Mon Sep 17 00:00:00 2001 From: 4drian3d Date: Mon, 15 Nov 2021 17:31:26 -0500 Subject: [PATCH] Added javadocs --- .../proxy/AuthMeVelocityPlugin.java | 2 +- .../proxy/event/PreSendOnLoginEvent.java | 29 +++++++++++++++++++ .../proxy/event/ProxyLoginEvent.java | 4 ++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/com/glyart/authmevelocity/proxy/AuthMeVelocityPlugin.java b/proxy/src/main/java/com/glyart/authmevelocity/proxy/AuthMeVelocityPlugin.java index dd4c5c2..c4f886b 100644 --- a/proxy/src/main/java/com/glyart/authmevelocity/proxy/AuthMeVelocityPlugin.java +++ b/proxy/src/main/java/com/glyart/authmevelocity/proxy/AuthMeVelocityPlugin.java @@ -54,7 +54,7 @@ public class AuthMeVelocityPlugin { } protected ProxyServer getProxy(){ - return proxy; + return this.proxy; } public static AuthMeVelocityPlugin getInstance(){ 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 9c5ef93..6762804 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 @@ -7,6 +7,10 @@ import com.velocitypowered.api.event.ResultedEvent.GenericResult; import com.velocitypowered.api.proxy.Player; 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 { private GenericResult result = GenericResult.allowed(); @@ -14,29 +18,54 @@ public class PreSendOnLoginEvent implements ResultedEvent { private final RegisteredServer actualserver; private final RegisteredServer serverToSend; + /** + * Create a new PreSendOnLoginEvent + * @param player the player logged + * @param actualServer the server on which the player is located + * @param serverToSend the server to which the player will be sent + */ public PreSendOnLoginEvent(Player player, RegisteredServer actualServer, RegisteredServer serverToSend){ this.player = player; this.actualserver = actualServer; this.serverToSend = serverToSend; } + /** + * Obtain the logged player + * @return the player + */ public Player getPlayer(){ return this.player; } + /** + * Obtain the server on which the player is located + * @return the actual server of the player + */ public RegisteredServer getActualServer(){ return this.actualserver; } + /** + * Obtain the server to which the player will be sent + * @return the server to send the player + */ public RegisteredServer getSendServer(){ return this.serverToSend; } + /** + * Get the result of the event + */ @Override public GenericResult getResult() { return this.result; } + /** + * Set the result of the event + * @param newresult the new result + */ @Override public void setResult(GenericResult newresult) { this.result = Objects.requireNonNull(newresult); 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 c3f82a5..7af8556 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 @@ -3,7 +3,9 @@ package com.glyart.authmevelocity.proxy.event; import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.server.RegisteredServer; +import org.jetbrains.annotations.NotNull; + /** * Event executed in case the player is successfully logged in */ -public record ProxyLoginEvent(Player player, RegisteredServer server) {} +public record ProxyLoginEvent(@NotNull Player player, @NotNull RegisteredServer server) {}