Package stawa.vitalstrike
Class PlayerManager
java.lang.Object
stawa.vitalstrike.PlayerManager
Manages player preferences and settings for the VitalStrike plugin
Handles loading, saving, and accessing player-specific configuration
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.configuration.file.FileConfigurationGets the player database configurationgetPlayerElement(org.bukkit.entity.Player player) Gets the player's elemental effect typegetStyle(org.bukkit.entity.Player player) Gets the player's custom damage stylebooleanhasPlayerPermission(UUID uuid, String permission) Checks if a player has a specific permission explicitly assignedbooleanisEnabled(org.bukkit.entity.Player player) Gets the player's enabled statusbooleanisHologramEnabled(org.bukkit.entity.Player player) Checks if holograms are enabled for a playerbooleanisPlayerLoaded(org.bukkit.entity.Player player) Checks if a player's data is loaded in memorybooleanisValidStyle(String style) Validates a player style formatbooleanisWorldEnabled(org.bukkit.World world) Checks if VitalStrike features are enabled in the specified worldvoidloadPlayer(org.bukkit.entity.Player player) Loads a player's settings into memoryvoidloadPlayers(Collection<? extends org.bukkit.entity.Player> players) Loads multiple players' settings into memoryvoidSaves the database to filevoidsetEnabled(org.bukkit.entity.Player player, boolean enabled) Sets whether damage indicators are enabled for a playervoidsetHologramEnabled(org.bukkit.entity.Player player, boolean enabled) Sets whether holograms are enabled for a playervoidsetPlayerElement(org.bukkit.entity.Player player, String element) Sets the player's elemental effect typevoidSets the player's custom damage style with validationvoidunloadPlayer(org.bukkit.entity.Player player) Unloads a player's settings from memoryvoidunloadPlayers(Collection<? extends org.bukkit.entity.Player> players) Unloads multiple players' settings from memory
-
Constructor Details
-
PlayerManager
Creates a new PlayerManager instance- Parameters:
plugin- the VitalStrike plugin instance- Throws:
Errors.DatabaseException- if database initialization fails
-
-
Method Details
-
saveDatabase
Saves the database to file- Throws:
Errors.DatabaseException- if saving fails
-
isPlayerLoaded
public boolean isPlayerLoaded(org.bukkit.entity.Player player) Checks if a player's data is loaded in memory- Parameters:
player- the player to check- Returns:
- true if the player is loaded
-
loadPlayers
Loads multiple players' settings into memory- Parameters:
players- the collection of players to load
-
unloadPlayers
Unloads multiple players' settings from memory- Parameters:
players- the collection of players to unload
-
isValidStyle
Validates a player style format- Parameters:
style- the style to validate- Returns:
- true if the style is valid
-
isWorldEnabled
public boolean isWorldEnabled(org.bukkit.World world) Checks if VitalStrike features are enabled in the specified world- Parameters:
world- the world to check- Returns:
- true if features are enabled in this world
-
isEnabled
public boolean isEnabled(org.bukkit.entity.Player player) Gets the player's enabled status- Parameters:
player- the player to check- Returns:
- true if damage indicators are enabled for the player
-
setEnabled
public void setEnabled(org.bukkit.entity.Player player, boolean enabled) Sets whether damage indicators are enabled for a player- Parameters:
player- the player to updateenabled- the new enabled status
-
getStyle
Gets the player's custom damage style- Parameters:
player- the player to check- Returns:
- the player's custom style, or the default style if none is set
-
setStyle
public void setStyle(org.bukkit.entity.Player player, String style) throws Errors.ConfigurationException Sets the player's custom damage style with validation- Parameters:
player- the player to updatestyle- the new style- Throws:
Errors.ConfigurationException- if the style is invalid
-
loadPlayer
public void loadPlayer(org.bukkit.entity.Player player) Loads a player's settings into memory- Parameters:
player- the player to load
-
unloadPlayer
public void unloadPlayer(org.bukkit.entity.Player player) Unloads a player's settings from memory- Parameters:
player- the player to unload
-
getPlayerElement
Gets the player's elemental effect type- Parameters:
player- the player to check- Returns:
- the player's element type or null if not set
-
setPlayerElement
Sets the player's elemental effect type- Parameters:
player- the player to updateelement- the element type to set
-
isHologramEnabled
public boolean isHologramEnabled(org.bukkit.entity.Player player) Checks if holograms are enabled for a player- Parameters:
player- the player to check- Returns:
- true if holograms are enabled for the player
-
setHologramEnabled
public void setHologramEnabled(org.bukkit.entity.Player player, boolean enabled) throws Errors.DatabaseException Sets whether holograms are enabled for a player- Parameters:
player- the player to updateenabled- the new hologram enabled status- Throws:
Errors.DatabaseException- if saving to database fails
-
getDatabase
public org.bukkit.configuration.file.FileConfiguration getDatabase()Gets the player database configuration- Returns:
- the player database configuration
-
hasPlayerPermission
Checks if a player has a specific permission explicitly assigned- Parameters:
uuid- the UUID of the playerpermission- the permission to check- Returns:
- true if the player has the permission explicitly assigned
-