Class PlayerUtils
java.lang.Object
ua.mcchickenstudio.opencreative.utils.PlayerUtils
PlayerUtils
This class contains most used utilities for manipulating with player and his data.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclearBossBars(org.bukkit.entity.Player player) Clears and removes displayed boss bars for player.static voidclearPlayer(org.bukkit.entity.Player player) Clears player from modifications made by world and resets his states, parameters and attributes.static voidclearPlayer(org.bukkit.entity.Player player, boolean clearPermissions) Clears player from modifications made by world and resets his states, parameters and attributes.static voidclearPlayer(org.bukkit.entity.Player player, boolean clearPermissions, boolean resetGameMode) Clears player from modifications made by world and resets his states, parameters and attributes.static voidclearWorldModePermissions(@NotNull org.bukkit.entity.Player player) Removes player's permissions that he got in world in Build, Play, Dev mode, or in lobby.static booleandisableSpying(@NotNull org.bukkit.entity.Player player) Disallows player to see local chat message from other worlds.static booleanenableSpying(@NotNull org.bukkit.entity.Player player) Allows player to see local chat message from other worlds.static org.bukkit.LocationReturns a spawn location in lobby world, where players will be connected to on server join.static org.bukkit.WorldReturns a lobby world, where player will get lobby items.static Set<org.bukkit.entity.Player> Returns set of players, who can see local chat messages from other worlds.static @Nullable UUIDgetUUIDFromText(@NotNull String text) static voidgiveBuildPermissions(@NotNull org.bukkit.entity.Player player) Sets player's permissions when they enter planet in build mode.static voidgiveDevPermissions(@NotNull org.bukkit.entity.Player player) Sets player's permissions when they enter developers planet.static voidgiveLobbyPermissions(@NotNull org.bukkit.entity.Player player) Sets player's permissions when they enter lobby.static voidgivePlayPermissions(@NotNull org.bukkit.entity.Player player) Sets player's permissions when they enter planet in play mode.static voidgiveVisitorPermissions(@NotNull org.bukkit.entity.Player player) Sets player's permissions when they enter planet in play or build mode, but not being as world builder, developer or owner.static voidhidePlayerInTab(org.bukkit.entity.Player spectator, org.bukkit.entity.Player receiver) static booleanisEntityInDevPlanet(@NotNull org.bukkit.entity.Entity entity) Checks if entity is probably in developers planet.static booleanisEntityInLobby(@NotNull org.bukkit.entity.Entity entity) Checks if entity is in lobby.static booleanisSpying(@NotNull org.bukkit.entity.Player player) Checks whether player can see local chat messages from other worlds.static voidRegisters permission attachments in memory for all online players.static voidloadPermissions(@NotNull org.bukkit.entity.Player player) Registers player's permission attachment to memory.static voidremoveFromPermissionsMap(@NotNull org.bukkit.entity.Player player) Removes stored player's permission attachment from memory.static voidremovePassengers(@NotNull org.bukkit.entity.Player player) static voidresetAttributes(org.bukkit.entity.Player player) Resets changeable attributes for player.static voidresetResourcePack(org.bukkit.entity.Player player) Removes other resource packs and replaces with server's resource pack, or vanilla.static voidsendClosedChestAnimation(org.bukkit.entity.Player player, org.bukkit.block.Block block) static voidsendOpenedChestAnimation(org.bukkit.entity.Player player, org.bukkit.block.Block block) static voidshowPlayerFromTab(org.bukkit.entity.Player spectator, org.bukkit.entity.Player receiver) static voidspawnGlowingBlock(org.bukkit.entity.Player player, org.bukkit.Location location) static voidteleportToLobby(org.bukkit.entity.Player player) Teleports player to lobby.static voidtranslateBlockSign(org.bukkit.block.Block block) Translates sign text on code block.static voidtranslateBlockSign(org.bukkit.block.Block block, org.bukkit.entity.Player player) Translates sign text on code block.static voidtranslateSigns(org.bukkit.entity.Player player, int radius)
-
Constructor Details
-
PlayerUtils
public PlayerUtils()
-
-
Method Details
-
clearPlayer
public static void clearPlayer(org.bukkit.entity.Player player) Clears player from modifications made by world and resets his states, parameters and attributes.- Parameters:
player- player to clear.
-
clearPlayer
public static void clearPlayer(org.bukkit.entity.Player player, boolean clearPermissions) Clears player from modifications made by world and resets his states, parameters and attributes.- Parameters:
player- player to clear.clearPermissions- remove world mode permissions or not.
-
clearPlayer
public static void clearPlayer(org.bukkit.entity.Player player, boolean clearPermissions, boolean resetGameMode) Clears player from modifications made by world and resets his states, parameters and attributes.- Parameters:
player- player to clear.clearPermissions- remove world mode permissions or not.resetGameMode- set game mode to adventure or not.
-
removePassengers
public static void removePassengers(@NotNull @NotNull org.bukkit.entity.Player player) -
resetAttributes
public static void resetAttributes(org.bukkit.entity.Player player) Resets changeable attributes for player.- Parameters:
player- player to clear attributes.
-
clearBossBars
public static void clearBossBars(org.bukkit.entity.Player player) Clears and removes displayed boss bars for player.- Parameters:
player- player to clear boss bars.
-
resetResourcePack
public static void resetResourcePack(org.bukkit.entity.Player player) Removes other resource packs and replaces with server's resource pack, or vanilla.- Parameters:
player- player to reset resource pack.
-
teleportToLobby
public static void teleportToLobby(org.bukkit.entity.Player player) Teleports player to lobby.- Parameters:
player- specified player to teleport.
-
getLobbyWorld
public static org.bukkit.World getLobbyWorld()Returns a lobby world, where player will get lobby items.- Returns:
- lobby world.
-
getLobbyLocation
public static org.bukkit.Location getLobbyLocation()Returns a spawn location in lobby world, where players will be connected to on server join.- Returns:
- spawn location in lobby world.
-
isEntityInDevPlanet
public static boolean isEntityInDevPlanet(@NotNull @NotNull org.bukkit.entity.Entity entity) Checks if entity is probably in developers planet.Note: Can return true, even if planet will be not registered in base.
- Parameters:
entity- entity to check.- Returns:
- true - if entity is probably in developers planet, false - in planet world or lobby.
-
isEntityInLobby
public static boolean isEntityInLobby(@NotNull @NotNull org.bukkit.entity.Entity entity) Checks if entity is in lobby.- Parameters:
entity- entity to check.- Returns:
- true - if entity in lobby, false - in planet or dev planet.
-
loadPermissions
public static void loadPermissions()Registers permission attachments in memory for all online players. -
loadPermissions
public static void loadPermissions(@NotNull @NotNull org.bukkit.entity.Player player) Registers player's permission attachment to memory.- Parameters:
player- player to load permissions.
-
removeFromPermissionsMap
public static void removeFromPermissionsMap(@NotNull @NotNull org.bukkit.entity.Player player) Removes stored player's permission attachment from memory.- Parameters:
player- player to remove attachment.
-
enableSpying
public static boolean enableSpying(@NotNull @NotNull org.bukkit.entity.Player player) Allows player to see local chat message from other worlds.- Parameters:
player- player, that will see messages.
-
disableSpying
public static boolean disableSpying(@NotNull @NotNull org.bukkit.entity.Player player) Disallows player to see local chat message from other worlds.- Parameters:
player- player, that won't see messages anymore.
-
isSpying
public static boolean isSpying(@NotNull @NotNull org.bukkit.entity.Player player) Checks whether player can see local chat messages from other worlds.- Parameters:
player- player to check.- Returns:
- true - can see, false - not.
-
getPlayersWithEnabledSpying
Returns set of players, who can see local chat messages from other worlds.- Returns:
- set of players, who can see local chat.
-
giveDevPermissions
public static void giveDevPermissions(@NotNull @NotNull org.bukkit.entity.Player player) Sets player's permissions when they enter developers planet.- Parameters:
player- player to give permissions.
-
givePlayPermissions
public static void givePlayPermissions(@NotNull @NotNull org.bukkit.entity.Player player) Sets player's permissions when they enter planet in play mode.- Parameters:
player- player to give permissions.
-
giveBuildPermissions
public static void giveBuildPermissions(@NotNull @NotNull org.bukkit.entity.Player player) Sets player's permissions when they enter planet in build mode.- Parameters:
player- player to give permissions.
-
giveVisitorPermissions
public static void giveVisitorPermissions(@NotNull @NotNull org.bukkit.entity.Player player) Sets player's permissions when they enter planet in play or build mode, but not being as world builder, developer or owner.- Parameters:
player- player to give permissions.
-
giveLobbyPermissions
public static void giveLobbyPermissions(@NotNull @NotNull org.bukkit.entity.Player player) Sets player's permissions when they enter lobby.- Parameters:
player- player to give permissions.
-
clearWorldModePermissions
public static void clearWorldModePermissions(@NotNull @NotNull org.bukkit.entity.Player player) Removes player's permissions that he got in world in Build, Play, Dev mode, or in lobby.- Parameters:
player- player to remove permissions.
-
translateBlockSign
public static void translateBlockSign(org.bukkit.block.Block block) Translates sign text on code block.- Parameters:
block- block with sign that will be translated.
-
translateBlockSign
public static void translateBlockSign(org.bukkit.block.Block block, org.bukkit.entity.Player player) Translates sign text on code block.- Parameters:
block- block with sign that will be translated.
-
translateSigns
public static void translateSigns(org.bukkit.entity.Player player, int radius) -
spawnGlowingBlock
public static void spawnGlowingBlock(org.bukkit.entity.Player player, org.bukkit.Location location) -
sendOpenedChestAnimation
public static void sendOpenedChestAnimation(org.bukkit.entity.Player player, org.bukkit.block.Block block) -
sendClosedChestAnimation
public static void sendClosedChestAnimation(org.bukkit.entity.Player player, org.bukkit.block.Block block) -
hidePlayerInTab
public static void hidePlayerInTab(org.bukkit.entity.Player spectator, org.bukkit.entity.Player receiver) -
showPlayerFromTab
public static void showPlayerFromTab(org.bukkit.entity.Player spectator, org.bukkit.entity.Player receiver) -
getUUIDFromText
-