Class DropRateModifier
- java.lang.Object
-
- org.shininet.bukkit.playerheads.events.modifiers.DropRateModifier
-
public class DropRateModifier extends Object
A modifier for the droprate including type and value information- Since:
- 5.2.16-SNAPSHOT
- Author:
- crashdemons (crashenator at gmail.com)
-
-
Constructor Summary
Constructors Constructor Description DropRateModifier(DropRateModifierType type, double value)
Constructs a modifier of a given type and valueDropRateModifier(DropRateModifierType type, double value, int level)
Constructs a modifier with a value that is multiplied by a level of effectiveness
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
apply(double droprate)
Apply the droprate modifier to the droprate valueDouble
getAdditiveMultiplierValue()
Converts the modifier into an equivalent add-multiple value where droprate*(1+newvalue) is equivalent to the current modifier effect.int
getLevel()
Gets the effectiveness level of the modifier.Double
getMultiplierValue()
Converts the modifier value to a multiplier (1.0=no effect) if possible.DropRateModifierType
getType()
Gets the type of modifierdouble
getValue()
Returns the value or rate applied by the modifier
-
-
-
Constructor Detail
-
DropRateModifier
public DropRateModifier(DropRateModifierType type, double value, int level)
Constructs a modifier with a value that is multiplied by a level of effectiveness- Parameters:
type
- the type of modifiervalue
- the base value of the modifierlevel
- the level to be multiplied against the modifier
-
DropRateModifier
public DropRateModifier(DropRateModifierType type, double value)
Constructs a modifier of a given type and value- Parameters:
type
- the type of modifiervalue
- the value of the modifier
-
-
Method Detail
-
getLevel
public int getLevel()
Gets the effectiveness level of the modifier. Note: this only provides a useful result with modifiers of type ADD_MULTIPLE_PER_LEVEL, otherwise it will return 1.- Returns:
- the effectiveness level of the modifier, or 1.
-
getType
public DropRateModifierType getType()
Gets the type of modifier- Returns:
- the type of modifier
-
getValue
public double getValue()
Returns the value or rate applied by the modifier- Returns:
- the value or rate applied by the modifier
-
getAdditiveMultiplierValue
public Double getAdditiveMultiplierValue()
Converts the modifier into an equivalent add-multiple value where droprate*(1+newvalue) is equivalent to the current modifier effect. Note: only other multipliers can be converted.- Returns:
- the equivalent additive multiplier value, or null.
-
getMultiplierValue
public Double getMultiplierValue()
Converts the modifier value to a multiplier (1.0=no effect) if possible. Note: only additive multipliers can be converted to multipliers.- Returns:
- the equivalent multiplier value, or null.
-
apply
public double apply(double droprate)
Apply the droprate modifier to the droprate value- Parameters:
droprate
- a droprate between 0 (0% chance) and 1.0 (100% chance). Higher values also indicate 100% chance.- Returns:
- the effective droprate after modification
-
-