Package dev.satyrn.xpeconomy.utils
Enum Class EconomyMethod
- All Implemented Interfaces:
Serializable
,Comparable<EconomyMethod>
,Constable
Economy processing method.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionEconomy method for levels.Economy method for per-hundred XP points.Economy method for individual points. -
Method Summary
Modifier and TypeMethodDescription@NotNull BigDecimal
fromRawBalance
(BigInteger rawBalance) Converts raw XP values into economy values.@NotNull String
Gets the translated currency name.@NotNull String
Gets the translated plural currency name.static EconomyMethod
Returns the default economy method value.Returns the rounding mode to use when converting the economy method balance.int
getScale()
Returns the decimal scale of the economy method.@NotNull BigDecimal
scale
(@NotNull BigDecimal value) Scales the value to the economy mode.@NotNull BigInteger
toRawBalance
(BigDecimal balance, BigInteger rawBalance) Converts economy values into raw XP values.@NotNull String
toString
(@NotNull BigDecimal value) Transforms a value into a string representation.@NotNull String
toString
(@NotNull BigDecimal value, boolean includeCurrencyName) Transforms a value into a string representation.static EconomyMethod
Returns the enum constant of this class with the specified name.static EconomyMethod[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
POINTS
Economy method for individual points. -
LEVELS
Economy method for levels. -
PER_HUNDRED
Economy method for per-hundred XP points.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getDefault
Returns the default economy method value.- Returns:
- POINTS
-
getScale
public int getScale()Returns the decimal scale of the economy method.- Returns:
- The decimal scale of the economy method.
-
getRoundingMode
Returns the rounding mode to use when converting the economy method balance.- Returns:
- The rounding mode to use when converting the economy method balance.
-
scale
Scales the value to the economy mode.- Parameters:
value
- The value to scale.- Returns:
- The scaled value.
-
toString
Transforms a value into a string representation. Does not append economy name.- Parameters:
value
- The value to convert.- Returns:
- The value as a string.
-
toString
@NotNull public @NotNull String toString(@NotNull @NotNull BigDecimal value, boolean includeCurrencyName) Transforms a value into a string representation.- Parameters:
value
- The value to convert.includeCurrencyName
- Whether to include the translated currency name.- Returns:
- The transformed value.
-
getCurrencyName
Gets the translated currency name.- Returns:
- The translated currency name.
-
getCurrencyNamePlural
Gets the translated plural currency name.- Returns:
- The translated plural currency name.
-
fromRawBalance
Converts raw XP values into economy values.- Parameters:
rawBalance
- The raw XP value.- Returns:
- The economy value.
-
toRawBalance
Converts economy values into raw XP values.- Parameters:
balance
- The current economy value.rawBalance
- The current XP value. Used to properly add levels. Can be set to 0 if it should not be used.- Returns:
- The raw XP value.
-