Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,36 @@ public void load() {
}
}

// copied private method out of Configuration
private static Integer castInt(Object o) {
if (o == null) {
return null;
} else if (o instanceof Byte) {
return Integer.valueOf((Byte)o);
} else if (o instanceof Integer) {
return (Integer)o;
} else if (o instanceof Double) {
return (int)((double)o);
} else if (o instanceof Float) {
return (int)(float)o;
} else {
return o instanceof Long ? (int)(long)o : null;
}
}

/**
* The super inplementation will save the default value if one doesnt exist at the storage location. This override does not.
*/
@Override
public int getInt(String path, int def) {
Integer o = castInt(this.getProperty(path));

if (o == null)
return def;

return o;
}

/**
* Creates the parent directories for the configuration file if they do not exist.
* <p>
Expand Down Expand Up @@ -143,4 +173,4 @@ public void saveAndLog() {
pluginName, configFile.getName(), e.getMessage()));
}
}
}
}