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) { if (key.length() == 1) {
Character symbol = key.charAt(0); Character symbol = key.charAt(0);
Material id = Material.getMaterial(value); Material id = Material.getMaterial(value);
if(id == null) {
throw new Exception("Invalid material in line: " + line);
}
types.put(symbol, id); types.put(symbol, id);
frameTypes.add(id); frameTypes.add(id);
} else { } else {
@ -349,7 +352,7 @@ public class Gate {
} }
} }
} catch (Exception ex) { } 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; return null;
} finally { } finally {
if (scanner != null) scanner.close(); if (scanner != null) scanner.close();