Give the player username to the UUID provider

This commit is contained in:
Felix Cravic 2020-06-20 19:07:34 +02:00
parent ac758e4acb
commit 5837b59a41
3 changed files with 4 additions and 4 deletions

View File

@ -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);
}
/**

View File

@ -6,5 +6,5 @@ import java.util.UUID;
@FunctionalInterface
public interface UuidProvider {
UUID provide(PlayerConnection playerConnection);
UUID provide(PlayerConnection playerConnection, String username);
}

View File

@ -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);