Minestom/src/main/java/net/minestom/server/network/PlayerProvider.java

29 lines
958 B
Java
Raw Normal View History

2020-09-01 23:35:14 +02:00
package net.minestom.server.network;
import net.minestom.server.entity.Player;
import net.minestom.server.network.player.PlayerConnection;
import org.jetbrains.annotations.NotNull;
2020-09-01 23:35:14 +02:00
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)}.
*/
2020-09-01 23:35:14 +02:00
@FunctionalInterface
public interface PlayerProvider {
2020-09-01 23:37:12 +02:00
/**
* Creates a new {@link Player} object based on his connection data.
* <p>
* Called once a client want to join the server and need to have an assigned player object.
2020-09-01 23:37:12 +02:00
*
* @param uuid the player {@link UUID}
* @param username the player username
* @param connection the player connection
* @return a newly create {@link Player} object
*/
2021-08-18 00:43:09 +02:00
@NotNull Player createPlayer(@NotNull UUID uuid, @NotNull String username, @NotNull PlayerConnection connection);
2020-09-01 23:35:14 +02:00
}