mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-31 21:48:08 +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 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)
|
||||
return UUID.randomUUID();
|
||||
return uuidProvider.provide(playerConnection);
|
||||
return uuidProvider.provide(playerConnection, username);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,5 +6,5 @@ import java.util.UUID;
|
||||
|
||||
@FunctionalInterface
|
||||
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) {
|
||||
// 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);
|
||||
connection.sendPacket(successPacket);
|
||||
|
Loading…
Reference in New Issue
Block a user