From 7eab20ef563383c9ea9e4cab1bb1145c6213d1ca Mon Sep 17 00:00:00 2001 From: Ineusia Date: Fri, 8 Nov 2019 01:11:29 -0600 Subject: [PATCH 1/3] Added error message for missing Repairables section (rather than throw NPE) --- .../gmail/nossr50/config/skills/repair/RepairConfig.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java b/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java index c04a98676..ae908d243 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java +++ b/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java @@ -3,6 +3,7 @@ package com.gmail.nossr50.config.skills.repair; import com.gmail.nossr50.config.ConfigLoader; import com.gmail.nossr50.datatypes.skills.ItemType; import com.gmail.nossr50.datatypes.skills.MaterialType; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.skills.repair.repairables.Repairable; import com.gmail.nossr50.skills.repair.repairables.RepairableFactory; import com.gmail.nossr50.util.ItemUtils; @@ -26,7 +27,13 @@ public class RepairConfig extends ConfigLoader { protected void loadKeys() { repairables = new ArrayList(); + if (!config.isConfigurationSection("Repairables")) { + mcMMO.p.getLogger().severe("Could not find Repairables section in " + fileName); + return; + } + ConfigurationSection section = config.getConfigurationSection("Repairables"); + Set keys = section.getKeys(false); for (String key : keys) { From ca1906fbc58105b82b9bf1822d39226e549717bd Mon Sep 17 00:00:00 2001 From: Ineusia Date: Fri, 8 Nov 2019 01:15:32 -0600 Subject: [PATCH 2/3] Added error message for missing Salvageables section (rather than throw NPE) --- .../gmail/nossr50/config/skills/salvage/SalvageConfig.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java b/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java index 5400ca826..2975e6316 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java +++ b/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java @@ -3,6 +3,7 @@ package com.gmail.nossr50.config.skills.salvage; import com.gmail.nossr50.config.ConfigLoader; import com.gmail.nossr50.datatypes.skills.ItemType; import com.gmail.nossr50.datatypes.skills.MaterialType; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.skills.salvage.salvageables.Salvageable; import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory; import com.gmail.nossr50.util.ItemUtils; @@ -27,6 +28,11 @@ public class SalvageConfig extends ConfigLoader { protected void loadKeys() { salvageables = new ArrayList(); + if (!config.isConfigurationSection("Salvageables")) { + mcMMO.p.getLogger().severe("Could not find Salvageables section in " + fileName); + return; + } + ConfigurationSection section = config.getConfigurationSection("Salvageables"); Set keys = section.getKeys(false); From c5cbab39b6ae789382e35b6216edcb877bc0d0ed Mon Sep 17 00:00:00 2001 From: Ineusia Date: Sun, 10 Nov 2019 11:56:32 -0600 Subject: [PATCH 3/3] Update RepairConfig.java Removed accidental whitespace --- .../com/gmail/nossr50/config/skills/repair/RepairConfig.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java b/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java index ae908d243..848ba8468 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java +++ b/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java @@ -33,7 +33,6 @@ public class RepairConfig extends ConfigLoader { } ConfigurationSection section = config.getConfigurationSection("Repairables"); - Set keys = section.getKeys(false); for (String key : keys) {