Package me.manossef.semihardcore.data
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/givelifecommand.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 Summary
ConstructorsConstructorDescriptionOptions(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 aOptionsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDeprecated.booleanDeprecated.booleanDeprecated.booleanDeprecated.final booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of theforceHardDifficultyrecord component.booleanDeprecated.intDeprecated.UselivesLimit().intDeprecated.UsestartingLivesMax().intDeprecated.UsestartingLivesMin().booleanReturns the value of thehardcoreHeartsrecord component.booleanDeprecated.UsehardcoreHearts().final inthashCode()Returns a hash code value for this object.booleanReturns the value of thelifestealEnabledrecord component.booleanReturns the value of thelightningStrikeOnLastDeathrecord component.intReturns the value of thelivesLimitrecord component.voidlogOptions(Logger logger) Logs the current state of the plugin's options to the specified logger in a human-readable way.intReturns the value of themaxLivesToLifestealrecord component.intReturns the value of theminLivesToBeLiferobbedrecord component.booleanReturns the value of theplayersCanBeGenerousrecord component.booleanReturns the value of theplayersCanGiveAwayLastLiferecord component.booleanReturns the value of thesacrificesForRevivalrecord component.voidsaveToFile(org.bukkit.configuration.file.FileConfiguration file) Saves the options to the config.yml file.intReturns the value of thestartingLivesMaxrecord component.intReturns the value of thestartingLivesMinrecord component.final StringtoString()Returns a string representation of this record class.
-
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 aOptionsrecord class.- Parameters:
startingLivesMin- the value for thestartingLivesMinrecord componentstartingLivesMax- the value for thestartingLivesMaxrecord componenthardcoreHearts- the value for thehardcoreHeartsrecord componentforceHardDifficulty- the value for theforceHardDifficultyrecord componentlivesLimit- the value for thelivesLimitrecord componentplayersCanBeGenerous- the value for theplayersCanBeGenerousrecord componentlightningStrikeOnLastDeath- the value for thelightningStrikeOnLastDeathrecord componentsacrificesForRevival- the value for thesacrificesForRevivalrecord componentplayersCanGiveAwayLastLife- the value for theplayersCanGiveAwayLastLiferecord componentlifestealEnabled- the value for thelifestealEnabledrecord componentmaxLivesToLifesteal- the value for themaxLivesToLifestealrecord componentminLivesToBeLiferobbed- the value for theminLivesToBeLiferobbedrecord component
-
-
Method Details
-
logOptions
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.UsestartingLivesMin(). 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.UsestartingLivesMax(). 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.UsehardcoreHearts(). This method is kept for backwards compatibility.Returns whether the server will show players' hearts above the hotbar as hardcore hearts.- Returns:
trueif the server shows hardcore hearts,falseotherwise.
-
forcesHardDifficulty
Deprecated.UseforceHardDifficulty(). This method is kept for backwards compatibility.Returns whether the server enforces hard difficulty on all worlds.- Returns:
trueif the server enforces hard difficulty,falseotherwise.
-
getLivesLimit
Deprecated.UselivesLimit(). 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.UseplayersCanBeGenerous(). This method is kept for backwards compatibility.Returns whether players are allowed to give away lives using the/givelifecommand.- Returns:
trueif players can give away lives,falseotherwise.
-
doesLightningStrikeOnLastDeath
Deprecated.UselightningStrikeOnLastDeath(). 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:
trueif fake lightning strikes on final death,falseotherwise.
-
canPlayersSacrificeToReviveSomeoneDead
Deprecated.UsesacrificesForRevival(). 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:
trueif players can sacrifice themselves,falseotherwise.
-
canPlayersGiveAwayLastLife
Deprecated.UseplayersCanGiveAwayLastLife(). This method is kept for backwards compatibility.Returns whether players are allowed to give away their last life to an alive player.- Returns:
trueif players can give away their last life,falseotherwise.
-
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. -
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. -
equals
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 '=='. -
startingLivesMin
public int startingLivesMin()Returns the value of thestartingLivesMinrecord component.- Returns:
- the value of the
startingLivesMinrecord component
-
startingLivesMax
public int startingLivesMax()Returns the value of thestartingLivesMaxrecord component.- Returns:
- the value of the
startingLivesMaxrecord component
-
hardcoreHearts
public boolean hardcoreHearts()Returns the value of thehardcoreHeartsrecord component.- Returns:
- the value of the
hardcoreHeartsrecord component
-
forceHardDifficulty
public boolean forceHardDifficulty()Returns the value of theforceHardDifficultyrecord component.- Returns:
- the value of the
forceHardDifficultyrecord component
-
livesLimit
public int livesLimit()Returns the value of thelivesLimitrecord component.- Returns:
- the value of the
livesLimitrecord component
-
playersCanBeGenerous
public boolean playersCanBeGenerous()Returns the value of theplayersCanBeGenerousrecord component.- Returns:
- the value of the
playersCanBeGenerousrecord component
-
lightningStrikeOnLastDeath
public boolean lightningStrikeOnLastDeath()Returns the value of thelightningStrikeOnLastDeathrecord component.- Returns:
- the value of the
lightningStrikeOnLastDeathrecord component
-
sacrificesForRevival
public boolean sacrificesForRevival()Returns the value of thesacrificesForRevivalrecord component.- Returns:
- the value of the
sacrificesForRevivalrecord component
-
playersCanGiveAwayLastLife
public boolean playersCanGiveAwayLastLife()Returns the value of theplayersCanGiveAwayLastLiferecord component.- Returns:
- the value of the
playersCanGiveAwayLastLiferecord component
-
lifestealEnabled
public boolean lifestealEnabled()Returns the value of thelifestealEnabledrecord component.- Returns:
- the value of the
lifestealEnabledrecord component
-
maxLivesToLifesteal
public int maxLivesToLifesteal()Returns the value of themaxLivesToLifestealrecord component.- Returns:
- the value of the
maxLivesToLifestealrecord component
-
minLivesToBeLiferobbed
public int minLivesToBeLiferobbed()Returns the value of theminLivesToBeLiferobbedrecord component.- Returns:
- the value of the
minLivesToBeLiferobbedrecord component
-
playersCanBeGenerous().