mirror of
https://github.com/asofold/CompatNoCheatPlus.git
synced 2025-01-23 21:41:20 +01:00
(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!]
|
||||
- (bugfix) Remove import of mcMMO-hook (use direct package reference instead).
|
||||
- (bugfix) Preserve order of entries in the lists read from the configuration.
|
||||
- (update) config/comaptlayer
|
||||
|
||||
(0.0.0) [initial version]
|
||||
|
@ -118,17 +118,30 @@ public abstract class AbstractNewConfig extends AbstractConfig {
|
||||
|
||||
@Override
|
||||
public void removeProperty(String path) {
|
||||
if (path.startsWith(".")) path = path.substring(1);
|
||||
// VERY EXPENSIVE
|
||||
MemoryConfiguration temp = new MemoryConfiguration();
|
||||
setOptions(temp);
|
||||
Map<String, Object> values = config.getValues(true);
|
||||
values.remove(path);
|
||||
for ( String p : values.keySet()){
|
||||
temp.set(p, values.get(p));
|
||||
if (values.containsKey(path)) values.remove(path);
|
||||
else{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean getBoolean(String path, Boolean defaultValue) {
|
||||
if (!config.contains(path)) return defaultValue;
|
||||
|
@ -60,7 +60,17 @@ public interface CompatConfig {
|
||||
public Object getProperty(String path, Object defaultValue);
|
||||
public void set(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);
|
||||
|
||||
/**
|
||||
* Works same as remove(path): removes properties and sections alike.
|
||||
* @param path
|
||||
*/
|
||||
public void removeProperty(String path);
|
||||
|
||||
// Contains/has
|
||||
|
@ -4,7 +4,7 @@ import java.io.File;
|
||||
|
||||
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>
|
||||
|
Loading…
Reference in New Issue
Block a user