Class VisibilityManager

java.lang.Object
net.apartium.cocoabeans.spigot.visibility.VisibilityManager

public class VisibilityManager extends Object
Manager class for cocoa beans hide API
See Also:
  • Constructor Details

    • VisibilityManager

      public VisibilityManager(org.bukkit.plugin.java.JavaPlugin plugin)
      Create a new instance of Visibility manager
      Parameters:
      plugin - plugin to associate this instance with
    • VisibilityManager

      public VisibilityManager(org.bukkit.plugin.java.JavaPlugin plugin, PlayerVisibilityController playerVisibilityController)
  • Method Details

    • registerListener

      public void registerListener(VisibilityPlayerRemoveType removeType)
      Register listener to automatically handle player join and quit
      Parameters:
      removeType - See VisibilityPlayerRemoveType If this method is not called the registering plugin is responsible for triggering the following methods:
      See Also:
    • registerListener

      public void registerListener()
      Register listener to automatically handle player join and quit with VisibilityPlayerRemoveType.ON_LEAVE If this method is not called the registering plugin is responsible for triggering the following methods:
      See Also:
    • unregisterListener

      public void unregisterListener()
      Unregisters the listener.
      See Also:
    • reloadVisibility

      public void reloadVisibility()
      Reload visibility for all online players
    • handlePlayerJoin

      public void handlePlayerJoin(org.bukkit.entity.Player joinPlayer)
      Handle player joining the server
      Parameters:
      joinPlayer - player who joined
    • getPlayer

      public VisibilityPlayer getPlayer(UUID uuid)
      Get player instance associated with this manager for given player uuid
      Parameters:
      uuid - player uuid, no checks are performed on this argument
      Returns:
      visibility player instance, cannot be null
    • getPlayer

      public VisibilityPlayer getPlayer(org.bukkit.entity.Player player)
      Get player instance associated with this manager for given player
      Parameters:
      player - player, cannot be null
      Returns:
      visibility player instance, cannot be null
    • removePlayer

      public void removePlayer(UUID uuid)
      Remove player from the in-memory state, including dis-associating with all its groups
      Parameters:
      uuid - player uuid
    • getOrCreateGroup

      public VisibilityGroup getOrCreateGroup(String name)
      Get or create a visiblity group by name.
      Parameters:
      name - unique group name
      Returns:
      a group associated with given name, cannot be null
    • deleteGroup

      public boolean deleteGroup(String name)
      Deletes a group from in-memory state and updating relevant players accordingly
      Parameters:
      name - group name
      Returns:
      true if the group exists, else false
    • canSee

      public boolean canSee(org.bukkit.entity.Player player, org.bukkit.entity.Player target)
      Checks whether 2 players can see each other.
      Parameters:
      player - player
      target - target player
      Returns:
      if can see each other - true, else false
    • getGroups

      public Collection<VisibilityGroup> getGroups()
      Get all visibility groups currently registered in memory
      Returns:
      all visibility groups currently registered in memory
    • getPlayers

      public Stream<VisibilityPlayer> getPlayers()
      Gets all players registered with the in-memory state
      Returns:
      all visibility players currently registered
      See Also: