mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-25 09:41:29 +01:00
Made ConfigurationNode.getAll() more maintainable. Thanks devinsba!
By: EvilSeph <evilseph@gmail.com>
This commit is contained in:
parent
656403dc86
commit
0c05778bc3
@ -24,27 +24,8 @@ public class ConfigurationNode {
|
|||||||
*
|
*
|
||||||
* @return A map of key value pairs with the path as the key and the object as the value
|
* @return A map of key value pairs with the path as the key and the object as the value
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public Map<String, Object> getAll() {
|
public Map<String, Object> getAll() {
|
||||||
Map<String, Object> map = new TreeMap<String, Object>();
|
return recursiveBuilder(root);
|
||||||
|
|
||||||
Set<String> keys = root.keySet();
|
|
||||||
for( String k : keys ) {
|
|
||||||
Object tmp = root.get(k);
|
|
||||||
if( tmp instanceof Map<?,?> ) {
|
|
||||||
Map<String, Object> rec = recursiveBuilder((Map <String,Object>) tmp);
|
|
||||||
|
|
||||||
Set<String> subkeys = rec.keySet();
|
|
||||||
for( String sk : subkeys ) {
|
|
||||||
map.put(k + "." + sk, rec.get(sk));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
map.put(k, tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user