From 6fa4c7961b72363165edf439384cdc691530029f Mon Sep 17 00:00:00 2001 From: Aria Date: Sat, 21 Sep 2019 01:01:01 +0200 Subject: [PATCH] Skill naming is now less strict --- src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java | 2 +- .../Indyuce/mmocore/api/player/profess/PlayerClass.java | 4 ++-- .../java/net/Indyuce/mmocore/manager/SkillManager.java | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java b/src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java index 74644df9..ffff5f64 100644 --- a/src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java +++ b/src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java @@ -34,7 +34,7 @@ public class ConfigMessage { } public void send(Collection players) { - players.forEach(player -> messages.forEach(line -> player.sendMessage(ChatColor.translateAlternateColorCodes('&', line)))); + players.forEach(player -> messages.forEach(line -> player.sendMessage(ChatColor.translateAlternateColorCodes('&', MMOCore.plugin.placeholderParser.parse(player, line))))); } public void sendAsJSon(Player player) { diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java index ca183b69..818ddeef 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java @@ -79,7 +79,7 @@ public class PlayerClass { for (String key : config.getConfigurationSection("skills").getKeys(false)) try { Validate.isTrue(MMOCore.plugin.skillManager.has(key), "Could not find skill " + key); - skills.put(key, MMOCore.plugin.skillManager.get(key).newSkillInfo(config.getConfigurationSection("skills." + key))); + skills.put(key.toUpperCase(), MMOCore.plugin.skillManager.get(key).newSkillInfo(config.getConfigurationSection("skills." + key))); } catch (IllegalArgumentException exception) { MMOCore.log(Level.WARNING, "[PlayerClasses:" + id + "] Could not load skill info '" + key + "': " + exception.getMessage()); } @@ -220,7 +220,7 @@ public class PlayerClass { } public SkillInfo getSkill(String id) { - return skills.get(id); + return skills.get(id.toUpperCase()); } public Set getEventTriggers() { diff --git a/src/main/java/net/Indyuce/mmocore/manager/SkillManager.java b/src/main/java/net/Indyuce/mmocore/manager/SkillManager.java index 4c3c7cc5..27e4c872 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/SkillManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/SkillManager.java @@ -50,7 +50,7 @@ public class SkillManager { if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null) for (File file : mythicMobs.listFiles()) { try { - register(new MythicMobSkill(file.getName().substring(0, file.getName().length() - 4), YamlConfiguration.loadConfiguration(file))); + register(new MythicMobSkill(file.getName().substring(0, file.getName().length() - 4).toUpperCase(), YamlConfiguration.loadConfiguration(file))); } catch (Exception exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load skill from " + file.getName() + ": " + exception.getMessage()); } @@ -88,15 +88,15 @@ public class SkillManager { } public void register(Skill skill) { - skills.put(skill.getId(), skill); + skills.put(skill.getId().toUpperCase(), skill); } public Skill get(String id) { - return skills.get(id); + return skills.get(id.toUpperCase()); } public boolean has(String id) { - return skills.containsKey(id); + return skills.containsKey(id.toUpperCase()); } public Collection getAll() {