diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/edition/AbilityListEdition.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/edition/AbilityListEdition.java index 2be016a8..e430bc8f 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/edition/AbilityListEdition.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/edition/AbilityListEdition.java @@ -124,9 +124,13 @@ public class AbilityListEdition extends EditionInventory { for (int j = 1; j < 8; j++) if (!getEditedSection().getConfigurationSection("ability").contains("ability" + j)) { - getEditedSection().createSection("ability.ability" + j); - registerTemplateEdition(); - break; + + // (Fixes MMOItems#1575) Initialize sample ability to avoid console logs + final String tag = "ability" + j; + getEditedSection().set("ability." + tag + ".type", "FIREBOLT"); + getEditedSection().set("ability." + tag + ".mode", "RIGHT_CLICK"); + registerTemplateEdition(); + return; } } diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/manager/ConfigManager.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/manager/ConfigManager.java index ecaaf6d6..0a4c1d74 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/manager/ConfigManager.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/manager/ConfigManager.java @@ -2,7 +2,6 @@ package net.Indyuce.mmoitems.manager; import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.skill.trigger.TriggerType; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.ConfigFile; import net.Indyuce.mmoitems.api.ReforgeOptions; @@ -243,8 +242,14 @@ public class ConfigManager implements Reloadable { return Message.valueOf(UtilityMethods.enumName(path)).getUpdated(); } + @Deprecated @NotNull public String getCastingModeName(@NotNull TriggerType triggerType) { + return getTriggerTypeName(triggerType); + } + + @NotNull + public String getTriggerTypeName(@NotNull TriggerType triggerType) { return Objects.requireNonNull(triggerTypeNames.get(triggerType), "Trigger type name for '" + triggerType.name() + "' not found"); } 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 a57d2098..8f4034ab 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 @@ -89,7 +89,7 @@ public class Abilities extends ItemStat data.getAbilities().forEach(ability -> { final StringBuilder builder = new StringBuilder(generalFormat - .replace("{trigger}", MMOItems.plugin.getLanguage().getCastingModeName(ability.getTrigger())) + .replace("{trigger}", MMOItems.plugin.getLanguage().getTriggerTypeName(ability.getTrigger())) .replace("{ability}", ability.getAbility().getName())); if (!ability.getModifiers().isEmpty()) builder.append(modifierIfAny); diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/stat/data/random/RandomAbilityData.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/stat/data/random/RandomAbilityData.java index 38027968..f39a251f 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/stat/data/random/RandomAbilityData.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/stat/data/random/RandomAbilityData.java @@ -21,7 +21,8 @@ public class RandomAbilityData { private final Map modifiers = new HashMap<>(); public RandomAbilityData(ConfigurationSection config) { - Validate.isTrue(config.contains("type") && config.contains("mode"), "Ability is missing type or mode"); + Validate.isTrue(config.contains("type"), "Missing ability type"); + Validate.isTrue(config.contains("mode"), "Missing ability trigger type/casting mode"); String abilityFormat = config.getString("type").toUpperCase().replace("-", "_").replace(" ", "_"); Validate.isTrue(MMOItems.plugin.getSkills().hasSkill(abilityFormat), "Could not find ability called '" + abilityFormat + "'");