(update) config/comaptlayer
This commit is contained in:
parent
218915a702
commit
5312e9573d
|
@ -24,5 +24,6 @@ VERSION HISTORY
|
||||||
- (add) List to enable plugins: plugins.ensure-enable [Forces their events to be processed before NoCheatPlus gets them!]
|
- (add) List to enable plugins: plugins.ensure-enable [Forces their events to be processed before NoCheatPlus gets them!]
|
||||||
- (bugfix) Remove import of mcMMO-hook (use direct package reference instead).
|
- (bugfix) Remove import of mcMMO-hook (use direct package reference instead).
|
||||||
- (bugfix) Preserve order of entries in the lists read from the configuration.
|
- (bugfix) Preserve order of entries in the lists read from the configuration.
|
||||||
|
- (update) config/comaptlayer
|
||||||
|
|
||||||
(0.0.0) [initial version]
|
(0.0.0) [initial version]
|
||||||
|
|
|
@ -118,17 +118,30 @@ public abstract class AbstractNewConfig extends AbstractConfig {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeProperty(String path) {
|
public void removeProperty(String path) {
|
||||||
|
if (path.startsWith(".")) path = path.substring(1);
|
||||||
// VERY EXPENSIVE
|
// VERY EXPENSIVE
|
||||||
MemoryConfiguration temp = new MemoryConfiguration();
|
MemoryConfiguration temp = new MemoryConfiguration();
|
||||||
setOptions(temp);
|
setOptions(temp);
|
||||||
Map<String, Object> values = config.getValues(true);
|
Map<String, Object> values = config.getValues(true);
|
||||||
values.remove(path);
|
if (values.containsKey(path)) values.remove(path);
|
||||||
for ( String p : values.keySet()){
|
else{
|
||||||
temp.set(p, values.get(p));
|
final String altPath = "."+path;
|
||||||
|
if (values.containsKey(altPath)) values.remove(altPath);
|
||||||
|
}
|
||||||
|
for ( String _p : values.keySet()){
|
||||||
|
Object v = values.get(_p);
|
||||||
|
if (v == null) continue;
|
||||||
|
else if (v instanceof ConfigurationSection) continue;
|
||||||
|
String p;
|
||||||
|
if (_p.startsWith(".")) p = _p.substring(1);
|
||||||
|
else p = _p;
|
||||||
|
if (p.startsWith(path)) continue;
|
||||||
|
temp.set(p, v);
|
||||||
}
|
}
|
||||||
config = temp;
|
config = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean getBoolean(String path, Boolean defaultValue) {
|
public Boolean getBoolean(String path, Boolean defaultValue) {
|
||||||
if (!config.contains(path)) return defaultValue;
|
if (!config.contains(path)) return defaultValue;
|
||||||
|
|
|
@ -60,7 +60,17 @@ public interface CompatConfig {
|
||||||
public Object getProperty(String path, Object defaultValue);
|
public Object getProperty(String path, Object defaultValue);
|
||||||
public void set(String path, Object value);
|
public void set(String path, Object value);
|
||||||
public void setProperty(String path, Object value);
|
public void setProperty(String path, Object value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a path (would also remove sub sections, unless for path naming problems).
|
||||||
|
* @param path
|
||||||
|
*/
|
||||||
public void remove(String path);
|
public void remove(String path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Works same as remove(path): removes properties and sections alike.
|
||||||
|
* @param path
|
||||||
|
*/
|
||||||
public void removeProperty(String path);
|
public void removeProperty(String path);
|
||||||
|
|
||||||
// Contains/has
|
// Contains/has
|
||||||
|
|
|
@ -4,7 +4,7 @@ import java.io.File;
|
||||||
|
|
||||||
public class CompatConfigFactory {
|
public class CompatConfigFactory {
|
||||||
|
|
||||||
public static final String version = "0.8.0";
|
public static final String version = "0.8.1";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to get a working file configuration.<br>
|
* Attempt to get a working file configuration.<br>
|
||||||
|
|
Loading…
Reference in New Issue