Class PlayerManager

java.lang.Object
stawa.vitalstrike.PlayerManager

public class PlayerManager extends Object
Manages player preferences and settings for the VitalStrike plugin Handles loading, saving, and accessing player-specific configuration
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new PlayerManager instance
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.configuration.file.FileConfiguration
    Gets the player database configuration
    getPlayerElement(org.bukkit.entity.Player player)
    Gets the player's elemental effect type
    getStyle(org.bukkit.entity.Player player)
    Gets the player's custom damage style
    boolean
    hasPlayerPermission(UUID uuid, String permission)
    Checks if a player has a specific permission explicitly assigned
    boolean
    isEnabled(org.bukkit.entity.Player player)
    Gets the player's enabled status
    boolean
    isHologramEnabled(org.bukkit.entity.Player player)
    Checks if holograms are enabled for a player
    boolean
    isPlayerLoaded(org.bukkit.entity.Player player)
    Checks if a player's data is loaded in memory
    boolean
    Validates a player style format
    boolean
    isWorldEnabled(org.bukkit.World world)
    Checks if VitalStrike features are enabled in the specified world
    void
    loadPlayer(org.bukkit.entity.Player player)
    Loads a player's settings into memory
    void
    loadPlayers(Collection<? extends org.bukkit.entity.Player> players)
    Loads multiple players' settings into memory
    void
    Saves the database to file
    void
    setEnabled(org.bukkit.entity.Player player, boolean enabled)
    Sets whether damage indicators are enabled for a player
    void
    setHologramEnabled(org.bukkit.entity.Player player, boolean enabled)
    Sets whether holograms are enabled for a player
    void
    setPlayerElement(org.bukkit.entity.Player player, String element)
    Sets the player's elemental effect type
    void
    setStyle(org.bukkit.entity.Player player, String style)
    Sets the player's custom damage style with validation
    void
    unloadPlayer(org.bukkit.entity.Player player)
    Unloads a player's settings from memory
    void
    unloadPlayers(Collection<? extends org.bukkit.entity.Player> players)
    Unloads multiple players' settings from memory

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • saveDatabase

      public void saveDatabase() throws Errors.DatabaseException
      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

      public void loadPlayers(Collection<? extends org.bukkit.entity.Player> players)
      Loads multiple players' settings into memory
      Parameters:
      players - the collection of players to load
    • unloadPlayers

      public void unloadPlayers(Collection<? extends org.bukkit.entity.Player> players)
      Unloads multiple players' settings from memory
      Parameters:
      players - the collection of players to unload
    • isValidStyle

      public boolean isValidStyle(String style)
      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 update
      enabled - the new enabled status
    • getStyle

      public String getStyle(org.bukkit.entity.Player player)
      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 update
      style - 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

      public String getPlayerElement(org.bukkit.entity.Player player)
      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

      public void setPlayerElement(org.bukkit.entity.Player player, String element)
      Sets the player's elemental effect type
      Parameters:
      player - the player to update
      element - 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 update
      enabled - 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

      public boolean hasPlayerPermission(UUID uuid, String permission)
      Checks if a player has a specific permission explicitly assigned
      Parameters:
      uuid - the UUID of the player
      permission - the permission to check
      Returns:
      true if the player has the permission explicitly assigned