mirror of https://github.com/Minestom/Minestom.git
Comments for UuidProvider and PlayerProvider
This commit is contained in:
parent
c4f36a9cea
commit
af3d742b13
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue