Fail earlier when loading a gate configuration with invalid materials

This commit is contained in:
Michael Smith 2019-09-29 07:52:17 -07:00
parent a182a18ee9
commit 22b461e7b4
No known key found for this signature in database
GPG Key ID: 41F47A53EDE95BE1

View File

@ -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();