feat(docs): Improved PreSendOnLoginEvent documentation

Implement AwaitingEvent annotation
This commit is contained in:
4drian3d 2022-08-15 01:09:42 +00:00
parent 98831c4ae3
commit bc54dd591f

View File

@ -3,6 +3,7 @@ package me.adrianed.authmevelocity.api.velocity.event;
import java.util.Objects; import java.util.Objects;
import com.velocitypowered.api.event.ResultedEvent; import com.velocitypowered.api.event.ResultedEvent;
import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
@ -10,8 +11,12 @@ import org.jetbrains.annotations.NotNull;
/** /**
* Event to be executed just before sending a player to another server after login/registration. * Event to be executed just before sending a player to another server after login/registration.
* Here you have the ability to deny the event. *
* <p>AuthMeVelocity will wait for the execution of this event to perform the given action,
* which means that you can modify the server to which the player will connect
* or if the player should not be sent to any server after being logged in</p>
*/ */
@AwaitingEvent
public final class PreSendOnLoginEvent implements ResultedEvent<ServerResult> { public final class PreSendOnLoginEvent implements ResultedEvent<ServerResult> {
private ServerResult result; private ServerResult result;
private final Player player; private final Player player;
@ -45,18 +50,11 @@ public final class PreSendOnLoginEvent implements ResultedEvent<ServerResult> {
return this.actualserver; return this.actualserver;
} }
/**
* Get the result of the event
*/
@Override @Override
public @NotNull ServerResult getResult() { public @NotNull ServerResult getResult() {
return this.result; return this.result;
} }
/**
* Set the result of the event
* @param newResult the new result
*/
@Override @Override
public void setResult(@NotNull ServerResult newResult) { public void setResult(@NotNull ServerResult newResult) {
this.result = Objects.requireNonNull(newResult); this.result = Objects.requireNonNull(newResult);