Annotations

This commit is contained in:
Jules 2023-02-02 11:33:15 +01:00
parent 5258c6114a
commit 568ead3eca
2 changed files with 14 additions and 0 deletions

View File

@ -2,7 +2,13 @@ package net.Indyuce.mmocore.api.util.math.formula;
import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.MythicLib;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.jetbrains.annotations.NotNull;
/**
* Bounded linear formula.
*
* @author Jules
*/
public class LinearValue { public class LinearValue {
private final double base, perLevel, min, max; private final double base, perLevel, min, max;
private final boolean hasMin, hasMax; private final boolean hasMin, hasMax;
@ -97,6 +103,7 @@ public class LinearValue {
return hasMin; return hasMin;
} }
@NotNull
public String getDisplay(int level) { public String getDisplay(int level) {
return MythicLib.plugin.getMMOConfig().decimals.format(calculate(level)); return MythicLib.plugin.getMMOConfig().decimals.format(calculate(level));
} }

View File

@ -23,6 +23,8 @@ public class RegisteredSkill implements Unlockable {
private final Map<String, LinearValue> defaultModifiers = new HashMap<>(); private final Map<String, LinearValue> defaultModifiers = new HashMap<>();
private final ItemStack icon; private final ItemStack icon;
private final List<String> lore; private final List<String> lore;
@NotNull
private final TriggerType triggerType; private final TriggerType triggerType;
public RegisteredSkill(SkillHandler<?> handler, ConfigurationSection config) { public RegisteredSkill(SkillHandler<?> handler, ConfigurationSection config) {
@ -94,6 +96,11 @@ public class RegisteredSkill implements Unlockable {
addModifier(mod, defaultValue); addModifier(mod, defaultValue);
} }
/**
* @return Modifier formula.
* Not null as long as the modifier is well defined
*/
@NotNull
public LinearValue getModifierInfo(String modifier) { public LinearValue getModifierInfo(String modifier) {
return defaultModifiers.get(modifier); return defaultModifiers.get(modifier);
} }