Skill naming is now less strict

This commit is contained in:
Aria 2019-09-21 01:01:01 +02:00
parent 9a1070eb37
commit 6fa4c7961b
3 changed files with 7 additions and 7 deletions

View File

@ -34,7 +34,7 @@ public class ConfigMessage {
} }
public void send(Collection<? extends Player> players) { public void send(Collection<? extends Player> 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) { public void sendAsJSon(Player player) {

View File

@ -79,7 +79,7 @@ public class PlayerClass {
for (String key : config.getConfigurationSection("skills").getKeys(false)) for (String key : config.getConfigurationSection("skills").getKeys(false))
try { try {
Validate.isTrue(MMOCore.plugin.skillManager.has(key), "Could not find skill " + key); 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) { } catch (IllegalArgumentException exception) {
MMOCore.log(Level.WARNING, "[PlayerClasses:" + id + "] Could not load skill info '" + key + "': " + exception.getMessage()); 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) { public SkillInfo getSkill(String id) {
return skills.get(id); return skills.get(id.toUpperCase());
} }
public Set<String> getEventTriggers() { public Set<String> getEventTriggers() {

View File

@ -50,7 +50,7 @@ public class SkillManager {
if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null) if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null)
for (File file : mythicMobs.listFiles()) { for (File file : mythicMobs.listFiles()) {
try { 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) { } catch (Exception exception) {
MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load skill from " + file.getName() + ": " + exception.getMessage()); 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) { public void register(Skill skill) {
skills.put(skill.getId(), skill); skills.put(skill.getId().toUpperCase(), skill);
} }
public Skill get(String id) { public Skill get(String id) {
return skills.get(id); return skills.get(id.toUpperCase());
} }
public boolean has(String id) { public boolean has(String id) {
return skills.containsKey(id); return skills.containsKey(id.toUpperCase());
} }
public Collection<Skill> getAll() { public Collection<Skill> getAll() {