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 → UUID Name GameProfile EntityPlayer ICommandSender
UUID   PlayerUtils:getName PlayerUtils:getGameProfile PlayerUtils:getPlayer PlayerUtils:getPlayer
Name PlayerUtils:getUUID   PlayerUtils:getGameProfile PlayerUtils:getPlayer PlayerUtils:getPlayer
GameProfile GameProfile:getId GameProfile:getName   PlayerUtils:getPlayer PlayerUtils:getPlayer
EntityPlayer EntityPlayer:getUniqueId ICommandSender:getName EntityPlayer:getProfile   typecast
ICommandSender PlayerUtils:getUUID ICommandSender:getName (only via typecast) typecast