summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/util/config/Configuration.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/util/config/Configuration.java b/src/main/java/org/bukkit/util/config/Configuration.java
index 7d37b067..11303dac 100644
--- a/src/main/java/org/bukkit/util/config/Configuration.java
+++ b/src/main/java/org/bukkit/util/config/Configuration.java
@@ -196,4 +196,24 @@ public class Configuration {
return def;
}
}
+
+ /**
+ * Gets a boolean at a location. This will either return an boolean
+ * or the default value. If the object at the particular location is not
+ * actually a boolean, the default value will be returned.
+ *
+ * @param path SK's dot notation supported
+ * @param def default value
+ * @return boolean or default
+ */
+ public boolean getBoolean(String path, boolean def) {
+ Object o = getProperty(path);
+ if (o == null) {
+ return def;
+ } else if (o instanceof Boolean) {
+ return (Boolean)o;
+ } else {
+ return def;
+ }
+ }
}