change config accessor materials to be non-null

This commit is contained in:
jascotty2 2019-10-04 14:58:05 -05:00
parent 28386e03af
commit b4cb706b18

View File

@ -106,12 +106,17 @@ public class ConfigSetting {
@NotNull
public CompatibleMaterial getMaterial() {
CompatibleMaterial m = getMaterial(null);
return m != null ? m : CompatibleMaterial.STONE;
CompatibleMaterial val = CompatibleMaterial.getMaterial(config.getString(key));
if (val == null) {
System.out.println(String.format("Config value \"%s\" has an invalid material name: \"%s\"", key, val));
}
return val != null ? val : CompatibleMaterial.STONE;
}
@Nullable
public CompatibleMaterial getMaterial(@Nullable CompatibleMaterial def) {
@NotNull
public CompatibleMaterial getMaterial(@NotNull CompatibleMaterial def) {
//return config.getMaterial(key, def);
String val = config.getString(key);
CompatibleMaterial mat = val != null ? CompatibleMaterial.getMaterial(val) : null;