mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-11 09:51:35 +01:00
AsyncPlayerPreLoginEvent getConnection (#2446)
* AsyncPlayerPreLoginEvent getConnection * reorder fields
This commit is contained in:
parent
5e17487155
commit
85ae6ea821
@ -2,6 +2,7 @@ package net.minestom.server.event.player;
|
||||
|
||||
import net.minestom.server.event.Event;
|
||||
import net.minestom.server.network.player.GameProfile;
|
||||
import net.minestom.server.network.player.PlayerConnection;
|
||||
import net.minestom.server.network.plugin.LoginPlugin;
|
||||
import net.minestom.server.network.plugin.LoginPluginMessageProcessor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -15,15 +16,22 @@ import java.util.concurrent.CompletableFuture;
|
||||
*/
|
||||
public class AsyncPlayerPreLoginEvent implements Event {
|
||||
|
||||
private final PlayerConnection connection;
|
||||
private GameProfile gameProfile;
|
||||
private final LoginPluginMessageProcessor pluginMessageProcessor;
|
||||
|
||||
public AsyncPlayerPreLoginEvent(@NotNull GameProfile gameProfile,
|
||||
public AsyncPlayerPreLoginEvent(@NotNull PlayerConnection connection,
|
||||
@NotNull GameProfile gameProfile,
|
||||
@NotNull LoginPluginMessageProcessor pluginMessageProcessor) {
|
||||
this.connection = connection;
|
||||
this.gameProfile = gameProfile;
|
||||
this.pluginMessageProcessor = pluginMessageProcessor;
|
||||
}
|
||||
|
||||
public @NotNull PlayerConnection getConnection() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
public GameProfile getGameProfile() {
|
||||
return gameProfile;
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ public final class ConnectionManager {
|
||||
}
|
||||
// Call pre login event
|
||||
LoginPluginMessageProcessor pluginMessageProcessor = connection.loginPluginMessageProcessor();
|
||||
AsyncPlayerPreLoginEvent asyncPlayerPreLoginEvent = new AsyncPlayerPreLoginEvent(gameProfile, pluginMessageProcessor);
|
||||
AsyncPlayerPreLoginEvent asyncPlayerPreLoginEvent = new AsyncPlayerPreLoginEvent(connection, gameProfile, pluginMessageProcessor);
|
||||
EventDispatcher.call(asyncPlayerPreLoginEvent);
|
||||
if (!connection.isOnline()) return gameProfile; // Player has been kicked
|
||||
// Change UUID/Username based on the event
|
||||
|
Loading…
Reference in New Issue
Block a user