MI no longer dies when not adding modifier translation

This commit is contained in:
Jules 2022-02-07 20:13:38 +01:00
parent 472822e8c5
commit b9b0f18faa
3 changed files with 6 additions and 11 deletions

View File

@ -58,11 +58,6 @@ public class PlayerListener implements Listener {
public void savePlayerData(PlayerQuitEvent event) { PlayerData.get(event.getPlayer()).save(); }
public static boolean ChanceSuccess(int percentChance) {
Random rand = new Random();
return rand.nextInt(100) <= percentChance;
}
/**
* If the player dies, its time to roll the death-downgrade stat!
*/

View File

@ -104,7 +104,7 @@ public class SkillManager {
}
// Copy mythiclib skills
for (SkillHandler handler : MythicLib.plugin.getSkills().getHandlers()) {
for (SkillHandler<?> handler : MythicLib.plugin.getSkills().getHandlers()) {
/*
* Generate skill configuration files
@ -112,8 +112,8 @@ public class SkillManager {
ConfigFile config = new ConfigFile("/skill", handler.getLowerCaseId());
if (!config.exists()) {
config.getConfig().set("name", MMOUtils.caseOnWords(handler.getId().replace("_", " ").replace("-", " ").toLowerCase()));
for (Object mod : handler.getModifiers()) {
config.getConfig().set("modifier." + mod + ".name", MMOUtils.caseOnWords(mod.toString().replace("-", " ").toLowerCase()));
for (String mod : handler.getModifiers()) {
config.getConfig().set("modifier." + mod + ".name", MMOUtils.caseOnWords(mod.replace("-", " ").toLowerCase()));
config.getConfig().set("modifier." + mod + ".default-value", 0);
}
config.save();

View File

@ -1,5 +1,6 @@
package net.Indyuce.mmoitems.skill;
import io.lumine.mythic.lib.UtilityMethods;
import io.lumine.mythic.lib.skill.handler.SkillHandler;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.MMOUtils;
@ -22,9 +23,8 @@ public class RegisteredSkill {
this.handler = handler;
this.name = Objects.requireNonNull(config.getString("name"), "Could not fill skill name");
for (Object obj : handler.getModifiers()) {
String mod = obj.toString();
modifierNames.put(mod, Objects.requireNonNull(config.getString("modifier." + mod + ".name"), "Could not find translation for modifier '" + mod + "'"));
for (String mod : handler.getModifiers()) {
modifierNames.put(mod, config.getString("modifier." + mod + ".name", UtilityMethods.caseOnWords(mod.replace("-", " "))));
modifierDefaultValues.put(mod, config.getDouble("modifier." + mod + ".default-value"));
}
}