Added javadocs

This commit is contained in:
4drian3d 2021-11-15 17:31:26 -05:00
parent aa99aae2f7
commit e670ed38c0
3 changed files with 33 additions and 2 deletions

View File

@ -54,7 +54,7 @@ public class AuthMeVelocityPlugin {
}
protected ProxyServer getProxy(){
return proxy;
return this.proxy;
}
public static AuthMeVelocityPlugin getInstance(){

View File

@ -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<GenericResult> {
private GenericResult result = GenericResult.allowed();
@ -14,29 +18,54 @@ public class PreSendOnLoginEvent implements ResultedEvent<GenericResult> {
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);

View File

@ -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) {}