feat(docs): Implement LoginByProxyEvent on Paper
This commit is contained in:
parent
bc54dd591f
commit
b2e1e1185e
@ -0,0 +1,31 @@
|
|||||||
|
package me.adrianed.authmevelocity.api.paper.event;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event to be executed in case a player who has already logged
|
||||||
|
* into a previously configured server enters the server.
|
||||||
|
*
|
||||||
|
* <p>AuthMeVelocity will automatically login this player.</p>
|
||||||
|
*/
|
||||||
|
public final class LoginByProxyEvent extends PlayerEvent {
|
||||||
|
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new LoginByProxyEvent
|
||||||
|
* @param who the player to be logged in
|
||||||
|
*/
|
||||||
|
public LoginByProxyEvent(@NotNull Player who) {
|
||||||
|
super(who, !Bukkit.isPrimaryThread());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull HandlerList getHandlers() {
|
||||||
|
return HANDLER_LIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,9 +9,9 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Event executed before a player is sent to another server after being logged in
|
* Event executed before a player is sent to another server after being logged in
|
||||||
* <p>Here you have the possibility to cancel the player's sending
|
* <p>Here you have the possibility to cancel the player's sending</p>
|
||||||
*/
|
*/
|
||||||
public class PreSendLoginEvent extends PlayerEvent implements Cancellable {
|
public final class PreSendLoginEvent extends PlayerEvent implements Cancellable {
|
||||||
private static final HandlerList HANDLERS = new HandlerList();
|
private static final HandlerList HANDLERS = new HandlerList();
|
||||||
private boolean isCancelled = false;
|
private boolean isCancelled = false;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import me.adrianed.authmevelocity.api.paper.event.LoginByProxyEvent;
|
||||||
import me.adrianed.authmevelocity.paper.AuthMeVelocityPlugin;
|
import me.adrianed.authmevelocity.paper.AuthMeVelocityPlugin;
|
||||||
|
|
||||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||||
@ -35,6 +36,7 @@ public class MessageListener implements PluginMessageListener {
|
|||||||
final String msg = input.readUTF();
|
final String msg = input.readUTF();
|
||||||
if ("LOGIN".equals(msg)) {
|
if ("LOGIN".equals(msg)) {
|
||||||
plugin.logDebug("PluginMessage | Login Message");
|
plugin.logDebug("PluginMessage | Login Message");
|
||||||
|
new LoginByProxyEvent(player).callEvent();
|
||||||
AuthMeApi.getInstance().forceLogin(player);
|
AuthMeApi.getInstance().forceLogin(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user