Skip to main content

Player Utils

Player Teleportation

In version 1.10 BaseIO contains multiple teleport implementations. If you encounter issues regarding teleportations, try switching the implementation in BaseIO's config file

PlayerUtils.teleportPlayerUnsafe(EntityPlayerMP player, Position position) teleports a player to the specified position forcibly. If you want to be sure the player doesn't teleport into blocks, use PlayerUtils.teleportPlayer(EntityPlayerMP player, Position position, boolean noisy). When the destination is an unsafe block this method won't teleport the player, returning false and (with noisy = true) printing a message to the player specifying the problem. For convenience teleportPlayer is overloaded with a ICommandSender instead of EntityPlayerMP (other senders than EntityPlayerMP will be discarded).

Identifier conversion

You might want to search a player by it's name quite often. For such cases (and many more "conversions") PlayerUtils provides a full set of conversion methods:
 neu0.png

↓ From | To →UUIDNameGameProfileEntityPlayerICommandSender
UUID PlayerUtils:getNamePlayerUtils:getGameProfilePlayerUtils:getPlayerPlayerUtils:getPlayer
NamePlayerUtils:getUUID PlayerUtils:getGameProfilePlayerUtils:getPlayerPlayerUtils:getPlayer
GameProfileGameProfile:getIdGameProfile:getName PlayerUtils:getPlayerPlayerUtils:getPlayer
EntityPlayerEntityPlayer:getUniqueIdICommandSender:getNameEntityPlayer:getProfile typecast
ICommandSenderPlayerUtils:getUUIDICommandSender:getName(only via typecast)typecast