mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 11:44:19 +01:00
Made ConfigurationNode.getAll() more maintainable. Thanks devinsba!
By: EvilSeph <evilseph@gmail.com>
This commit is contained in:
parent
656403dc86
commit
0c05778bc3
1 changed files with 1 additions and 20 deletions
|
@ -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
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, Object> getAll() {
|
||||
Map<String, Object> map = new TreeMap<String, Object>();
|
||||
|
||||
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;
|
||||
return recursiveBuilder(root);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue