mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-19 06:32:03 +01:00
Give the player username to the UUID provider
This commit is contained in:
parent
ac758e4acb
commit
5837b59a41
@ -110,10 +110,10 @@ public final class ConnectionManager {
|
|||||||
* @return the uuid based on {@code playerConnection}
|
* @return the uuid based on {@code playerConnection}
|
||||||
* return a random UUID if no UUID provider is defined see {@link #setUuidProvider(UuidProvider)}
|
* return a random UUID if no UUID provider is defined see {@link #setUuidProvider(UuidProvider)}
|
||||||
*/
|
*/
|
||||||
public UUID getPlayerConnectionUuid(PlayerConnection playerConnection) {
|
public UUID getPlayerConnectionUuid(PlayerConnection playerConnection, String username) {
|
||||||
if (uuidProvider == null)
|
if (uuidProvider == null)
|
||||||
return UUID.randomUUID();
|
return UUID.randomUUID();
|
||||||
return uuidProvider.provide(playerConnection);
|
return uuidProvider.provide(playerConnection, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,5 +6,5 @@ import java.util.UUID;
|
|||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface UuidProvider {
|
public interface UuidProvider {
|
||||||
UUID provide(PlayerConnection playerConnection);
|
UUID provide(PlayerConnection playerConnection, String username);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ public class LoginStartPacket implements ClientPreplayPacket {
|
|||||||
public void process(PlayerConnection connection, ConnectionManager connectionManager) {
|
public void process(PlayerConnection connection, ConnectionManager connectionManager) {
|
||||||
// TODO send encryption request OR directly login success
|
// TODO send encryption request OR directly login success
|
||||||
|
|
||||||
UUID playerUuid = connectionManager.getPlayerConnectionUuid(connection);
|
UUID playerUuid = connectionManager.getPlayerConnectionUuid(connection, username);
|
||||||
|
|
||||||
LoginSuccessPacket successPacket = new LoginSuccessPacket(playerUuid, username);
|
LoginSuccessPacket successPacket = new LoginSuccessPacket(playerUuid, username);
|
||||||
connection.sendPacket(successPacket);
|
connection.sendPacket(successPacket);
|
||||||
|
Loading…
Reference in New Issue
Block a user