Comments for UuidProvider and PlayerProvider

This commit is contained in:
themode 2020-10-31 13:30:11 +01:00
parent c4f36a9cea
commit af3d742b13
3 changed files with 22 additions and 3 deletions

View File

@ -1,9 +1,7 @@
package net.minestom.server.network;
import net.minestom.server.entity.Player;
/**
* Represents the current connection state of a {@link Player}.
* Represents the current connection state of a {@link net.minestom.server.network.player.PlayerConnection}.
*/
public enum ConnectionState {
UNKNOWN, STATUS, LOGIN, PLAY

View File

@ -6,6 +6,11 @@ import org.jetbrains.annotations.NotNull;
import java.util.UUID;
/**
* Used when you want to provide your own player object instead of using the default one.
* <p>
* Sets with {@link ConnectionManager#setPlayerProvider(PlayerProvider)}.
*/
@FunctionalInterface
public interface PlayerProvider {

View File

@ -4,7 +4,23 @@ import net.minestom.server.network.player.PlayerConnection;
import java.util.UUID;
/**
* Used when you want to provide your own {@link UUID} object for players instead of using the default one.
* <p>
* Sets with {@link ConnectionManager#setUuidProvider(UuidProvider)}.
*/
@FunctionalInterface
public interface UuidProvider {
/**
* Called when a new {@link UUID} is requested.
* <p>
* The {@link UUID} does not need to be persistent between restart, but being sure that all players have a different
* one is good practice. Otherwise, undefined behavior can happen.
*
* @param playerConnection the connection who requires a new unique id
* @param username the username given by the connection
* @return the new {@link UUID} for the player
*/
UUID provide(PlayerConnection playerConnection, String username);
}