Record Class Options

java.lang.Object
java.lang.Record
me.manossef.semihardcore.data.Options
Record Components:
startingLivesMin - The minimum number of lives a player can start with.
startingLivesMax - The maximum number of lives a player can start with.
hardcoreHearts - Whether the server will show players' hearts above the hotbar as hardcore hearts.
forceHardDifficulty - Whether the server enforces hard difficulty on all worlds.
livesLimit - The maximum number of lives a player can have at any time.
playersCanBeGenerous - Whether players are allowed to give away lives using the /givelife command.
lightningStrikeOnLastDeath - Whether the plugin creates a fake lightning effect at a player's position on their final death.
sacrificesForRevival - Whether players are allowed to sacrifice themselves (give away their last life) to revive a dead player.
playersCanGiveAwayLastLife - Whether players are allowed to give away their last life to an alive player.
lifestealEnabled - Whether players can steal lives by killing other players.
maxLivesToLifesteal - The highest life count that still allows players to steal lives by killing other players.
minLivesToBeLiferobbed - The lowest life count that still leaves players vulnerable to being robbed of lives by being killed by other players.

public record Options(int startingLivesMin, int startingLivesMax, boolean hardcoreHearts, boolean forceHardDifficulty, int livesLimit, boolean playersCanBeGenerous, boolean lightningStrikeOnLastDeath, boolean sacrificesForRevival, boolean playersCanGiveAwayLastLife, boolean lifestealEnabled, int maxLivesToLifesteal, int minLivesToBeLiferobbed) extends Record
Stores the plugin's configuration options. The plugin creates an instance of this record when it's enabled, and uses it throughout the running of the server. Creating any new instances of this record has no effect on the plugin.
  • Constructor Details

    • Options

      public Options(int startingLivesMin, int startingLivesMax, boolean hardcoreHearts, boolean forceHardDifficulty, int livesLimit, boolean playersCanBeGenerous, boolean lightningStrikeOnLastDeath, boolean sacrificesForRevival, boolean playersCanGiveAwayLastLife, boolean lifestealEnabled, int maxLivesToLifesteal, int minLivesToBeLiferobbed)
      Creates an instance of a Options record class.
      Parameters:
      startingLivesMin - the value for the startingLivesMin record component
      startingLivesMax - the value for the startingLivesMax record component
      hardcoreHearts - the value for the hardcoreHearts record component
      forceHardDifficulty - the value for the forceHardDifficulty record component
      livesLimit - the value for the livesLimit record component
      playersCanBeGenerous - the value for the playersCanBeGenerous record component
      lightningStrikeOnLastDeath - the value for the lightningStrikeOnLastDeath record component
      sacrificesForRevival - the value for the sacrificesForRevival record component
      playersCanGiveAwayLastLife - the value for the playersCanGiveAwayLastLife record component
      lifestealEnabled - the value for the lifestealEnabled record component
      maxLivesToLifesteal - the value for the maxLivesToLifesteal record component
      minLivesToBeLiferobbed - the value for the minLivesToBeLiferobbed record component
  • Method Details

    • logOptions

      public void logOptions(Logger logger)
      Logs the current state of the plugin's options to the specified logger in a human-readable way.
      Parameters:
      logger - The logger to log the options to.
    • saveToFile

      public void saveToFile(org.bukkit.configuration.file.FileConfiguration file)
      Saves the options to the config.yml file.
      Parameters:
      file - The config.yml file configuration.
    • getMinimumStartingLives

      @Deprecated(since="2.7.0") public int getMinimumStartingLives()
      Deprecated.
      Use startingLivesMin(). This method is kept for backwards compatibility.
      Returns the minimum number of lives a player can start with.
      Returns:
      The minimum starting lives.
    • getMaximumStartingLives

      @Deprecated(since="2.7.0") public int getMaximumStartingLives()
      Deprecated.
      Use startingLivesMax(). This method is kept for backwards compatibility.
      Returns the maximum number of lives a player can start with.
      Returns:
      The maximum starting lives.
    • hasHardcoreHearts

      @Deprecated(since="2.7.0") public boolean hasHardcoreHearts()
      Deprecated.
      Use hardcoreHearts(). This method is kept for backwards compatibility.
      Returns whether the server will show players' hearts above the hotbar as hardcore hearts.
      Returns:
      true if the server shows hardcore hearts, false otherwise.
    • forcesHardDifficulty

      @Deprecated(since="2.7.0") public boolean forcesHardDifficulty()
      Deprecated.
      Use forceHardDifficulty(). This method is kept for backwards compatibility.
      Returns whether the server enforces hard difficulty on all worlds.
      Returns:
      true if the server enforces hard difficulty, false otherwise.
    • getLivesLimit

      @Deprecated(since="2.7.0") public int getLivesLimit()
      Deprecated.
      Use livesLimit(). This method is kept for backwards compatibility.
      Returns the maximum number of lives a player can have at any time.
      Returns:
      The plugin's upper limit of lives.
    • canPlayersBeGenerous

      @Deprecated(since="2.7.0") public boolean canPlayersBeGenerous()
      Deprecated.
      Use playersCanBeGenerous(). This method is kept for backwards compatibility.
      Returns whether players are allowed to give away lives using the /givelife command.
      Returns:
      true if players can give away lives, false otherwise.
    • doesLightningStrikeOnLastDeath

      @Deprecated(since="2.7.0") public boolean doesLightningStrikeOnLastDeath()
      Deprecated.
      Use lightningStrikeOnLastDeath(). This method is kept for backwards compatibility.
      Returns whether the plugin creates a fake lightning effect at a player's position on their final death.
      Returns:
      true if fake lightning strikes on final death, false otherwise.
    • canPlayersSacrificeToReviveSomeoneDead

      @Deprecated(since="2.7.0") public boolean canPlayersSacrificeToReviveSomeoneDead()
      Deprecated.
      Use sacrificesForRevival(). This method is kept for backwards compatibility.
      Returns whether players are allowed to sacrifice themselves (give away their last life) to revive a dead player.
      Returns:
      true if players can sacrifice themselves, false otherwise.
    • canPlayersGiveAwayLastLife

      @Deprecated(since="2.7.0") public boolean canPlayersGiveAwayLastLife()
      Deprecated.
      Use playersCanGiveAwayLastLife(). This method is kept for backwards compatibility.
      Returns whether players are allowed to give away their last life to an alive player.
      Returns:
      true if players can give away their last life, false otherwise.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • startingLivesMin

      public int startingLivesMin()
      Returns the value of the startingLivesMin record component.
      Returns:
      the value of the startingLivesMin record component
    • startingLivesMax

      public int startingLivesMax()
      Returns the value of the startingLivesMax record component.
      Returns:
      the value of the startingLivesMax record component
    • hardcoreHearts

      public boolean hardcoreHearts()
      Returns the value of the hardcoreHearts record component.
      Returns:
      the value of the hardcoreHearts record component
    • forceHardDifficulty

      public boolean forceHardDifficulty()
      Returns the value of the forceHardDifficulty record component.
      Returns:
      the value of the forceHardDifficulty record component
    • livesLimit

      public int livesLimit()
      Returns the value of the livesLimit record component.
      Returns:
      the value of the livesLimit record component
    • playersCanBeGenerous

      public boolean playersCanBeGenerous()
      Returns the value of the playersCanBeGenerous record component.
      Returns:
      the value of the playersCanBeGenerous record component
    • lightningStrikeOnLastDeath

      public boolean lightningStrikeOnLastDeath()
      Returns the value of the lightningStrikeOnLastDeath record component.
      Returns:
      the value of the lightningStrikeOnLastDeath record component
    • sacrificesForRevival

      public boolean sacrificesForRevival()
      Returns the value of the sacrificesForRevival record component.
      Returns:
      the value of the sacrificesForRevival record component
    • playersCanGiveAwayLastLife

      public boolean playersCanGiveAwayLastLife()
      Returns the value of the playersCanGiveAwayLastLife record component.
      Returns:
      the value of the playersCanGiveAwayLastLife record component
    • lifestealEnabled

      public boolean lifestealEnabled()
      Returns the value of the lifestealEnabled record component.
      Returns:
      the value of the lifestealEnabled record component
    • maxLivesToLifesteal

      public int maxLivesToLifesteal()
      Returns the value of the maxLivesToLifesteal record component.
      Returns:
      the value of the maxLivesToLifesteal record component
    • minLivesToBeLiferobbed

      public int minLivesToBeLiferobbed()
      Returns the value of the minLivesToBeLiferobbed record component.
      Returns:
      the value of the minLivesToBeLiferobbed record component