Class PlayerUtils

java.lang.Object
ua.mcchickenstudio.opencreative.utils.PlayerUtils

public final class PlayerUtils extends Object

PlayerUtils

This class contains most used utilities for manipulating with player and his data.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    clearBossBars(org.bukkit.entity.Player player)
    Clears and removes displayed boss bars for player.
    static void
    clearPlayer(org.bukkit.entity.Player player)
    Clears player from modifications made by world and resets his states, parameters and attributes.
    static void
    clearPlayer(org.bukkit.entity.Player player, boolean clearPermissions)
    Clears player from modifications made by world and resets his states, parameters and attributes.
    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.
    static void
    clearWorldModePermissions(@NotNull org.bukkit.entity.Player player)
    Removes player's permissions that he got in world in Build, Play, Dev mode, or in lobby.
    static boolean
    disableSpying(@NotNull org.bukkit.entity.Player player)
    Disallows player to see local chat message from other worlds.
    static boolean
    enableSpying(@NotNull org.bukkit.entity.Player player)
    Allows player to see local chat message from other worlds.
    static org.bukkit.Location
    Returns a spawn location in lobby world, where players will be connected to on server join.
    static org.bukkit.World
    Returns 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 UUID
    getUUIDFromText(@NotNull String text)
     
    static void
    giveBuildPermissions(@NotNull org.bukkit.entity.Player player)
    Sets player's permissions when they enter planet in build mode.
    static void
    giveDevPermissions(@NotNull org.bukkit.entity.Player player)
    Sets player's permissions when they enter developers planet.
    static void
    giveLobbyPermissions(@NotNull org.bukkit.entity.Player player)
    Sets player's permissions when they enter lobby.
    static void
    givePlayPermissions(@NotNull org.bukkit.entity.Player player)
    Sets player's permissions when they enter planet in play mode.
    static void
    giveVisitorPermissions(@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 void
    hidePlayerInTab(org.bukkit.entity.Player spectator, org.bukkit.entity.Player receiver)
     
    static boolean
    isEntityInDevPlanet(@NotNull org.bukkit.entity.Entity entity)
    Checks if entity is probably in developers planet.
    static boolean
    isEntityInLobby(@NotNull org.bukkit.entity.Entity entity)
    Checks if entity is in lobby.
    static boolean
    isSpying(@NotNull org.bukkit.entity.Player player)
    Checks whether player can see local chat messages from other worlds.
    static void
    Registers permission attachments in memory for all online players.
    static void
    loadPermissions(@NotNull org.bukkit.entity.Player player)
    Registers player's permission attachment to memory.
    static void
    removeFromPermissionsMap(@NotNull org.bukkit.entity.Player player)
    Removes stored player's permission attachment from memory.
    static void
    removePassengers(@NotNull org.bukkit.entity.Player player)
     
    static void
    resetAttributes(org.bukkit.entity.Player player)
    Resets changeable attributes for player.
    static void
    resetResourcePack(org.bukkit.entity.Player player)
    Removes other resource packs and replaces with server's resource pack, or vanilla.
    static void
    sendClosedChestAnimation(org.bukkit.entity.Player player, org.bukkit.block.Block block)
     
    static void
    sendOpenedChestAnimation(org.bukkit.entity.Player player, org.bukkit.block.Block block)
     
    static void
    showPlayerFromTab(org.bukkit.entity.Player spectator, org.bukkit.entity.Player receiver)
     
    static void
    spawnGlowingBlock(org.bukkit.entity.Player player, org.bukkit.Location location)
     
    static void
    teleportToLobby(org.bukkit.entity.Player player)
    Teleports player to lobby.
    static void
    translateBlockSign(org.bukkit.block.Block block)
    Translates sign text on code block.
    static void
    translateBlockSign(org.bukkit.block.Block block, org.bukkit.entity.Player player)
    Translates sign text on code block.
    static void
    translateSigns(org.bukkit.entity.Player player, int radius)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public static Set<org.bukkit.entity.Player> 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

      @Nullable public static @Nullable UUID getUUIDFromText(@NotNull @NotNull String text)