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/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 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 aOptions
record class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Deprecated.boolean
Deprecated.boolean
Deprecated.boolean
Deprecated.final boolean
Indicates whether some other object is "equal to" this one.boolean
Returns the value of theforceHardDifficulty
record component.boolean
Deprecated.int
Deprecated.UselivesLimit()
.int
Deprecated.UsestartingLivesMax()
.int
Deprecated.UsestartingLivesMin()
.boolean
Returns the value of thehardcoreHearts
record component.boolean
Deprecated.UsehardcoreHearts()
.final int
hashCode()
Returns a hash code value for this object.boolean
Returns the value of thelifestealEnabled
record component.boolean
Returns the value of thelightningStrikeOnLastDeath
record component.int
Returns the value of thelivesLimit
record component.void
logOptions
(Logger logger) Logs the current state of the plugin's options to the specified logger in a human-readable way.int
Returns the value of themaxLivesToLifesteal
record component.int
Returns the value of theminLivesToBeLiferobbed
record component.boolean
Returns the value of theplayersCanBeGenerous
record component.boolean
Returns the value of theplayersCanGiveAwayLastLife
record component.boolean
Returns the value of thesacrificesForRevival
record component.void
saveToFile
(org.bukkit.configuration.file.FileConfiguration file) Saves the options to the config.yml file.int
Returns the value of thestartingLivesMax
record component.int
Returns the value of thestartingLivesMin
record component.final String
toString()
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 aOptions
record class.- Parameters:
startingLivesMin
- the value for thestartingLivesMin
record componentstartingLivesMax
- the value for thestartingLivesMax
record componenthardcoreHearts
- the value for thehardcoreHearts
record componentforceHardDifficulty
- the value for theforceHardDifficulty
record componentlivesLimit
- the value for thelivesLimit
record componentplayersCanBeGenerous
- the value for theplayersCanBeGenerous
record componentlightningStrikeOnLastDeath
- the value for thelightningStrikeOnLastDeath
record componentsacrificesForRevival
- the value for thesacrificesForRevival
record componentplayersCanGiveAwayLastLife
- the value for theplayersCanGiveAwayLastLife
record componentlifestealEnabled
- the value for thelifestealEnabled
record componentmaxLivesToLifesteal
- the value for themaxLivesToLifesteal
record componentminLivesToBeLiferobbed
- the value for theminLivesToBeLiferobbed
record 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:
true
if the server shows hardcore hearts,false
otherwise.
-
forcesHardDifficulty
Deprecated.UseforceHardDifficulty()
. 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.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/givelife
command.- Returns:
true
if players can give away lives,false
otherwise.
-
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:
true
if fake lightning strikes on final death,false
otherwise.
-
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:
true
if players can sacrifice themselves,false
otherwise.
-
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:
true
if players can give away their last life,false
otherwise.
-
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 thestartingLivesMin
record component.- Returns:
- the value of the
startingLivesMin
record component
-
startingLivesMax
public int startingLivesMax()Returns the value of thestartingLivesMax
record component.- Returns:
- the value of the
startingLivesMax
record component
-
hardcoreHearts
public boolean hardcoreHearts()Returns the value of thehardcoreHearts
record component.- Returns:
- the value of the
hardcoreHearts
record component
-
forceHardDifficulty
public boolean forceHardDifficulty()Returns the value of theforceHardDifficulty
record component.- Returns:
- the value of the
forceHardDifficulty
record component
-
livesLimit
public int livesLimit()Returns the value of thelivesLimit
record component.- Returns:
- the value of the
livesLimit
record component
-
playersCanBeGenerous
public boolean playersCanBeGenerous()Returns the value of theplayersCanBeGenerous
record component.- Returns:
- the value of the
playersCanBeGenerous
record component
-
lightningStrikeOnLastDeath
public boolean lightningStrikeOnLastDeath()Returns the value of thelightningStrikeOnLastDeath
record component.- Returns:
- the value of the
lightningStrikeOnLastDeath
record component
-
sacrificesForRevival
public boolean sacrificesForRevival()Returns the value of thesacrificesForRevival
record component.- Returns:
- the value of the
sacrificesForRevival
record component
-
playersCanGiveAwayLastLife
public boolean playersCanGiveAwayLastLife()Returns the value of theplayersCanGiveAwayLastLife
record component.- Returns:
- the value of the
playersCanGiveAwayLastLife
record component
-
lifestealEnabled
public boolean lifestealEnabled()Returns the value of thelifestealEnabled
record component.- Returns:
- the value of the
lifestealEnabled
record component
-
maxLivesToLifesteal
public int maxLivesToLifesteal()Returns the value of themaxLivesToLifesteal
record component.- Returns:
- the value of the
maxLivesToLifesteal
record component
-
minLivesToBeLiferobbed
public int minLivesToBeLiferobbed()Returns the value of theminLivesToBeLiferobbed
record component.- Returns:
- the value of the
minLivesToBeLiferobbed
record component
-
playersCanBeGenerous()
.