Class VisibilityManager
java.lang.Object
net.apartium.cocoabeans.spigot.visibility.VisibilityManager
Manager class for cocoa beans hide API
-
Constructor Summary
ConstructorsConstructorDescriptionVisibilityManager(org.bukkit.plugin.java.JavaPlugin plugin) Create a new instance of Visibility managerVisibilityManager(org.bukkit.plugin.java.JavaPlugin plugin, PlayerVisibilityController playerVisibilityController) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanSee(org.bukkit.entity.Player player, org.bukkit.entity.Player target) Checks whether 2 players can see each other.booleandeleteGroup(String name) Deletes a group from in-memory state and updating relevant players accordinglyGet all visibility groups currently registered in memorygetOrCreateGroup(String name) Get or create a visiblity group by name.Get player instance associated with this manager for given player uuidgetPlayer(org.bukkit.entity.Player player) Get player instance associated with this manager for given playerGets all players registered with the in-memory statevoidhandlePlayerJoin(org.bukkit.entity.Player joinPlayer) Handle player joining the servervoidRegister listener to automatically handle player join and quit withVisibilityPlayerRemoveType.ON_LEAVEIf this method is not called the registering plugin is responsible for triggering the following methods:voidregisterListener(VisibilityPlayerRemoveType removeType) Register listener to automatically handle player join and quitvoidReload visibility for all online playersvoidremovePlayer(UUID uuid) Remove player from the in-memory state, including dis-associating with all its groupsvoidUnregisters the listener.
-
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
Register listener to automatically handle player join and quit- Parameters:
removeType- SeeVisibilityPlayerRemoveTypeIf 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 withVisibilityPlayerRemoveType.ON_LEAVEIf this method is not called the registering plugin is responsible for triggering the following methods:- See Also:
-
unregisterListener
public void unregisterListener()Unregisters the listener. -
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
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
Get player instance associated with this manager for given player- Parameters:
player- player, cannot be null- Returns:
- visibility player instance, cannot be null
-
removePlayer
Remove player from the in-memory state, including dis-associating with all its groups- Parameters:
uuid- player uuid
-
getOrCreateGroup
Get or create a visiblity group by name.- Parameters:
name- unique group name- Returns:
- a group associated with given name, cannot be null
-
deleteGroup
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- playertarget- target player- Returns:
- if can see each other - true, else false
-
getGroups
Get all visibility groups currently registered in memory- Returns:
- all visibility groups currently registered in memory
-
getPlayers
Gets all players registered with the in-memory state- Returns:
- all visibility players currently registered
- See Also:
-