mirror of
https://github.com/asofold/CompatNoCheatPlus.git
synced 2024-11-27 12:45:18 +01:00
Reset set-speed hook values for older config versions.
Some people might have had the inoperable set-speed hook enabled.
This commit is contained in:
parent
3103ffbafa
commit
c23e39d156
@ -67,3 +67,6 @@ support for instant spells ? [internalName or name ? <- guess: name]
|
||||
|
||||
|
||||
add class-name inspection methods (!).
|
||||
|
||||
set-speed: per world options ? [per world config concept]
|
||||
set-speed: add option to set speed to default speed on player quit/kick
|
||||
|
@ -5,12 +5,14 @@ import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import me.asofold.bpl.cncp.config.compatlayer.CompatConfig;
|
||||
import me.asofold.bpl.cncp.config.compatlayer.ConfigUtil;
|
||||
import me.asofold.bpl.cncp.config.compatlayer.NewConfig;
|
||||
|
||||
public class Settings {
|
||||
public int configVersion = 1;
|
||||
public static final int configVersion = 2;
|
||||
|
||||
public Set<String> forceEnableLater = new LinkedHashSet<String>();
|
||||
public Set<String> loadPlugins = new LinkedHashSet<String>();
|
||||
@ -19,11 +21,10 @@ public class Settings {
|
||||
|
||||
public static CompatConfig getDefaultConfig(){
|
||||
CompatConfig cfg = new NewConfig(null);
|
||||
Settings ref = new Settings();
|
||||
cfg.set("plugins.force-enable-later", new LinkedList<String>()); // ConfigUtil.asList(new String[]{ "NoCheatPlus" }));
|
||||
cfg.set("plugins.ensure-enable", ConfigUtil.asList(new String[]{ "WorldGuard" }));
|
||||
cfg.set("hooks.prevent-add", new LinkedList<String>());
|
||||
cfg.set("configversion", ref.configVersion);
|
||||
cfg.set("configversion", configVersion);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
@ -31,10 +32,26 @@ public class Settings {
|
||||
boolean changed = false;
|
||||
if (cfg.getInt("configversion", 0) == 0){
|
||||
cfg.remove("plugins");
|
||||
cfg.set("configversion", new Settings().configVersion); // hum.
|
||||
cfg.set("configversion", configVersion);
|
||||
changed = true;
|
||||
}
|
||||
if (cfg.getInt("configversion", 0) <= 1){
|
||||
if (cfg.getDouble("hooks.set-speed.fly-speed", 0.1) != 0.1){
|
||||
changed = true;
|
||||
cfg.set("hooks.set-speed.fly-speed", 0.1);
|
||||
Bukkit.getLogger().warning("[cncp] Reset fly-speed for the set-speed hook to 0.1 (default) as a safety measure.");
|
||||
}
|
||||
if (cfg.getDouble("hooks.set-speed.walk-speed", 0.2) != 0.2){
|
||||
changed = true;
|
||||
cfg.set("hooks.set-speed.walk-speed", 0.2);
|
||||
Bukkit.getLogger().warning("[cncp] Reset walk-speed for the set-speed hook to 0.2 (default) as a safety measure.");
|
||||
}
|
||||
}
|
||||
if (ConfigUtil.forceDefaults(getDefaultConfig(), cfg)) changed = true;
|
||||
if (cfg.getInt("configversion", 0) != configVersion){
|
||||
cfg.set("configversion", configVersion);
|
||||
changed = true;
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user