mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-29 03:21:25 +01:00
Simplified ConfigNode#moveChild
This commit is contained in:
parent
ed67e0763d
commit
d0df3e3fcf
@ -160,14 +160,10 @@ public class ConfigNode {
|
||||
}
|
||||
|
||||
ConfigNode moveFrom = found.get();
|
||||
|
||||
ConfigNode moveTo = addNode(newPath);
|
||||
ConfigNode oldParent = moveFrom.parent;
|
||||
ConfigNode newParent = moveTo.parent;
|
||||
|
||||
oldParent.removeChild(moveFrom);
|
||||
moveTo.copyAll(moveFrom);
|
||||
newParent.addChild(moveTo);
|
||||
removeNode(oldPath);
|
||||
|
||||
return getNode(newPath).isPresent();
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
package com.djrapitops.plan.system.settings.paths.key;
|
||||
|
||||
import com.djrapitops.plan.system.settings.config.ConfigNode;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Predicate;
|
||||
@ -46,6 +47,9 @@ public class TimeSetting extends Setting<Long> {
|
||||
}
|
||||
String unitName = node.getString(path + ".Unit");
|
||||
try {
|
||||
Verify.nullCheck(unitName, () -> new IllegalStateException(
|
||||
"Config value for " + path + ".Unit has a bad value: 'null'"
|
||||
));
|
||||
TimeUnit unit = TimeUnit.valueOf(unitName.toUpperCase());
|
||||
return unit.toMillis(duration);
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user