From 5820b3b7887e368e5ff402d59391cbbac6e524a3 Mon Sep 17 00:00:00 2001 From: LMBishop <13875753+LMBishop@users.noreply.github.com> Date: Mon, 15 Jul 2019 16:44:40 +0100 Subject: Changed error messages --- src/main/java/com/leonardobishop/quests/Quests.java | 1 + src/main/java/com/leonardobishop/quests/QuestsConfigLoader.java | 3 +-- .../java/com/leonardobishop/quests/commands/CommandQuests.java | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/leonardobishop/quests/Quests.java b/src/main/java/com/leonardobishop/quests/Quests.java index 332eae99..bef7e659 100644 --- a/src/main/java/com/leonardobishop/quests/Quests.java +++ b/src/main/java/com/leonardobishop/quests/Quests.java @@ -181,6 +181,7 @@ public class Quests extends JavaPlugin { for (Map.Entry entry : questsConfigLoader.getBrokenFiles().entrySet()) { Quests.this.getLogger().warning(" - " + entry.getKey() + ": " + entry.getValue().getMessage()); } + Quests.this.getLogger().warning(ChatColor.GRAY.toString() + ChatColor.ITALIC + "If this is your first time using Quests, please delete the Quests folder and RESTART (not reload!) the server."); } for (Player player : Bukkit.getOnlinePlayers()) { diff --git a/src/main/java/com/leonardobishop/quests/QuestsConfigLoader.java b/src/main/java/com/leonardobishop/quests/QuestsConfigLoader.java index 1d37b68e..46678e6b 100644 --- a/src/main/java/com/leonardobishop/quests/QuestsConfigLoader.java +++ b/src/main/java/com/leonardobishop/quests/QuestsConfigLoader.java @@ -38,7 +38,7 @@ public class QuestsConfigLoader { YamlConfiguration config = new YamlConfiguration(); config.load(new File(String.valueOf(plugin.getDataFolder() + File.separator + "config.yml"))); } catch (Exception ex) { - brokenFiles.put("
config.yml", ConfigLoadError.MAIN_CONFIG_ERROR); + brokenFiles.put("
config.yml", ConfigLoadError.MALFORMED_YAML); plugin.setBrokenConfig(true); return; } @@ -189,7 +189,6 @@ public class QuestsConfigLoader { public enum ConfigLoadError { - MAIN_CONFIG_ERROR("You have a YAML error in your Quests config. If this is your first time using Quests, please remove the Quests folder and RESTART (not reload!) the server and try again."), MALFORMED_YAML("Malformed YAML"), INVALID_QUEST_ID("Invalid quest ID (must be alphanumeric)"); diff --git a/src/main/java/com/leonardobishop/quests/commands/CommandQuests.java b/src/main/java/com/leonardobishop/quests/commands/CommandQuests.java index db3f496b..67e4220e 100644 --- a/src/main/java/com/leonardobishop/quests/commands/CommandQuests.java +++ b/src/main/java/com/leonardobishop/quests/commands/CommandQuests.java @@ -31,8 +31,11 @@ public class CommandQuests implements CommandExecutor { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (plugin.isBrokenConfig()) { - sender.sendMessage(ChatColor.RED + "You have a YAML error in your config and Quests cannot load. If this is your first time using Quests, please " + - "delete the Quests folder and RESTART (not reload!) the server. If you have modified the config, check for errors in a YAML parser."); + sender.sendMessage(ChatColor.RED + "The main config must be in tact before quests can be used. Quests has failed to load the following files:"); + for (Map.Entry entry : plugin.getQuestsConfigLoader().getBrokenFiles().entrySet()) { + sender.sendMessage(ChatColor.DARK_GRAY + " * " + ChatColor.RED + entry.getKey() + ": " + ChatColor.GRAY + entry.getValue().getMessage()); + } + sender.sendMessage(ChatColor.GRAY.toString() + ChatColor.ITALIC + "If this is your first time using Quests, please delete the Quests folder and RESTART (not reload!) the server."); return true; } @@ -63,6 +66,7 @@ public class CommandQuests implements CommandExecutor { for (Map.Entry entry : plugin.getQuestsConfigLoader().getBrokenFiles().entrySet()) { sender.sendMessage(ChatColor.DARK_GRAY + " * " + ChatColor.RED + entry.getKey() + ": " + ChatColor.GRAY + entry.getValue().getMessage()); } + sender.sendMessage(ChatColor.GRAY.toString() + ChatColor.ITALIC + "If this is your first time using Quests, please delete the Quests folder and RESTART (not reload!) the server."); } else { sender.sendMessage(ChatColor.GRAY + "Quests was reloaded."); } -- cgit v1.2.3-70-g09d2