diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/manager/PluginUpdateManager.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/manager/PluginUpdateManager.java index b3aa7923..12eb2a43 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/manager/PluginUpdateManager.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/manager/PluginUpdateManager.java @@ -240,7 +240,7 @@ public class PluginUpdateManager { // Apply old modifier name for (String mod : skill.getHandler().getModifiers()) - config.set("modifier." + mod + ".name", Objects.requireNonNullElse(abilities.getString("modifier." + mod), skill.getModifierName(mod))); + config.set("modifier." + mod + ".name", Objects.requireNonNullElse(abilities.getString("modifier." + mod), skill.getParameterName(mod))); configFile.save(); } diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/skill/RegisteredSkill.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/skill/RegisteredSkill.java index 843a1f40..5f1b5bf2 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/skill/RegisteredSkill.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/skill/RegisteredSkill.java @@ -13,16 +13,16 @@ import java.util.Objects; public class RegisteredSkill { @NotNull private final SkillHandler handler; @NotNull private final String name; - @NotNull private final Map modifierNames = new HashMap<>(); - @NotNull private final Map modifierDefaultValues = new HashMap<>(); + @NotNull private final Map parameterNames = new HashMap<>(); + @NotNull private final Map defaultParameterValues = new HashMap<>(); public RegisteredSkill(@NotNull SkillHandler handler, @NotNull ConfigurationSection config) { this.handler = handler; this.name = Objects.requireNonNull(config.getString("name"), "Could not fill skill name"); for (String mod : handler.getModifiers()) { - modifierNames.put(mod, config.getString("modifier." + mod + ".name", UtilityMethods.caseOnWords(mod.replace("_", " ").replace("-", " ").toLowerCase()))); - modifierDefaultValues.put(mod, config.getDouble("modifier." + mod + ".default-value")); + parameterNames.put(mod, config.getString("modifier." + mod + ".name", UtilityMethods.caseOnWords(mod.replace("_", " ").replace("-", " ").toLowerCase()))); + defaultParameterValues.put(mod, config.getDouble("modifier." + mod + ".default-value")); } } @@ -42,20 +42,20 @@ public class RegisteredSkill { @Deprecated public void setDefaultValue(String modifier, double value) { - modifierDefaultValues.put(modifier, value); + defaultParameterValues.put(modifier, value); } @Deprecated public void setName(String modifier, String name) { - modifierNames.put(modifier, name); + parameterNames.put(modifier, name); } @Nullable - public String getModifierName(String modifier) { - return modifierNames.get(modifier); + public String getParameterName(String modifier) { + return parameterNames.get(modifier); } public double getDefaultModifier(String modifier) { - return modifierDefaultValues.get(modifier); + return defaultParameterValues.get(modifier); } } diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/skill/ShulkerMissile.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/skill/ShulkerMissile.java index ed71d4d7..a46ae90e 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/skill/ShulkerMissile.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/skill/ShulkerMissile.java @@ -45,7 +45,7 @@ public class ShulkerMissile extends SkillHandler implements L @Override public void whenCast(VectorSkillResult result, SkillMetadata skillMeta) { - double duration = skillMeta.getModifier("duration"); + double duration = skillMeta.getParameter("duration"); Player caster = skillMeta.getCaster().getPlayer(); @@ -64,7 +64,7 @@ public class ShulkerMissile extends SkillHandler implements L EntityType.SHULKER_BULLET); shulkerBullet.setShooter(caster); - MMOItems.plugin.getEntities().registerCustomEntity(shulkerBullet, new ShulkerMissileEntityData(skillMeta.getCaster(), new DamageMetadata(skillMeta.getModifier("damage"), DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE), skillMeta.getModifier("effect-duration"), null)); + MMOItems.plugin.getEntities().registerCustomEntity(shulkerBullet, new ShulkerMissileEntityData(skillMeta.getCaster(), new DamageMetadata(skillMeta.getParameter("damage"), DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE), skillMeta.getParameter("effect-duration"), null)); new BukkitRunnable() { double ti = 0; diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/stat/Abilities.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/stat/Abilities.java index 9a1fa99d..6af7525d 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/stat/Abilities.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/stat/Abilities.java @@ -64,9 +64,9 @@ public class Abilities extends ItemStat for (String modifier : ability.getModifiers()) { item.getLore().registerPlaceholder("ability_" + ability.getAbility().getHandler().getId().toLowerCase() + "_" + modifier, - MythicLib.plugin.getMMOConfig().decimals.format(ability.getModifier(modifier))); - abilityLore.add(modifierFormat.replace("{modifier}", ability.getAbility().getModifierName(modifier)).replace("{value}", - MythicLib.plugin.getMMOConfig().decimals.format(ability.getModifier(modifier)))); + MythicLib.plugin.getMMOConfig().decimals.format(ability.getParameter(modifier))); + abilityLore.add(modifierFormat.replace("{modifier}", ability.getAbility().getParameterName(modifier)).replace("{value}", + MythicLib.plugin.getMMOConfig().decimals.format(ability.getParameter(modifier)))); } if (splitter) diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/stat/data/AbilityData.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/stat/data/AbilityData.java index b991c60c..d2b2f94d 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/stat/data/AbilityData.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/stat/data/AbilityData.java @@ -108,13 +108,13 @@ public class AbilityData extends Skill { return false; // Check for mana cost - if (hasModifier("mana") && rpgPlayer.getMana() < getModifier("mana")) { + if (hasModifier("mana") && rpgPlayer.getMana() < getParameter("mana")) { Message.NOT_ENOUGH_MANA.format(ChatColor.RED).send(player); return false; } // Check for stamina cost - if (hasModifier("stamina") && rpgPlayer.getStamina() < getModifier("stamina")) { + if (hasModifier("stamina") && rpgPlayer.getStamina() < getParameter("stamina")) { Message.NOT_ENOUGH_STAMINA.format(ChatColor.RED).send(player); return false; } @@ -128,13 +128,13 @@ public class AbilityData extends Skill { RPGPlayer rpgPlayer = playerData.getRPG(); // Apply mana cost - if (hasModifier("mana")) rpgPlayer.giveMana(-meta.getModifier("mana")); + if (hasModifier("mana")) rpgPlayer.giveMana(-meta.getParameter("mana")); // Apply stamina cost - if (hasModifier("stamina")) rpgPlayer.giveStamina(-meta.getModifier("stamina")); + if (hasModifier("stamina")) rpgPlayer.giveStamina(-meta.getParameter("stamina")); // Apply cooldown - double cooldown = meta.getModifier("cooldown") * (1 - Math.min(.8, meta.getCaster().getStat("COOLDOWN_REDUCTION") / 100)); + double cooldown = meta.getParameter("cooldown") * (1 - Math.min(.8, meta.getCaster().getStat("COOLDOWN_REDUCTION") / 100)); if (cooldown > 0) meta.getCaster().getData().getCooldownMap().applyCooldown(this, cooldown); } @@ -144,7 +144,7 @@ public class AbilityData extends Skill { } @Override - public double getModifier(String path) { + public double getParameter(String path) { return modifiers.getOrDefault(path, ability.getDefaultModifier(path)); } @@ -154,7 +154,7 @@ public class AbilityData extends Skill { object.addProperty("CastMode", getTrigger().name()); JsonObject modifiers = new JsonObject(); - this.modifiers.keySet().forEach(modifier -> modifiers.addProperty(modifier, getModifier(modifier))); + this.modifiers.keySet().forEach(modifier -> modifiers.addProperty(modifier, getParameter(modifier))); object.add("Modifiers", modifiers); return object;