From 22b461e7b474148e787b14bf5b44e86dea16f813 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sun, 29 Sep 2019 07:52:17 -0700 Subject: [PATCH] Fail earlier when loading a gate configuration with invalid materials --- src/net/TheDgtl/Stargate/Gate.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/net/TheDgtl/Stargate/Gate.java b/src/net/TheDgtl/Stargate/Gate.java index 99609aa..9f2867f 100644 --- a/src/net/TheDgtl/Stargate/Gate.java +++ b/src/net/TheDgtl/Stargate/Gate.java @@ -340,6 +340,9 @@ public class Gate { if (key.length() == 1) { Character symbol = key.charAt(0); Material id = Material.getMaterial(value); + if(id == null) { + throw new Exception("Invalid material in line: " + line); + } types.put(symbol, id); frameTypes.add(id); } else { @@ -349,7 +352,7 @@ public class Gate { } } } catch (Exception ex) { - Stargate.log.log(Level.SEVERE, "Could not load Gate " + file.getName() + " - Invalid block ID given"); + Stargate.log.log(Level.SEVERE, "Could not load Gate " + file.getName() + " - " + ex.getMessage()); return null; } finally { if (scanner != null) scanner.close();