mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Added multi-world settings along with a reload function.
This commit is contained in:
1 parent
272bd83382
commit
f2475d5803
6 files changed
+333
-255
No files matched your search
@@ -2,8 +2,12 @@ package net.h31ix.anticheat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
@@ -12,12 +16,38 @@ public class Configuration {
|
||||
private FileConfiguration config;
|
||||
private Anticheat plugin;
|
||||
public boolean logConsole;
|
||||
private List<String> worlds = new ArrayList<String>();
|
||||
|
||||
public Configuration(Anticheat plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
load();
|
||||
}
|
||||
|
||||
private void save()
|
||||
{
|
||||
try {
|
||||
config.save(configFile);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void load()
|
||||
{
|
||||
config = YamlConfiguration.loadConfiguration(configFile);
|
||||
logConsole = config.getBoolean("Logging.Log to console");
|
||||
if(config.getList("Enable in") == null)
|
||||
{
|
||||
List<String> w = new ArrayList<String>();
|
||||
for(World world : Bukkit.getServer().getWorlds())
|
||||
{
|
||||
w.add(world.getName());
|
||||
}
|
||||
config.set("Enable in", w);
|
||||
save();
|
||||
}
|
||||
worlds = (List<String>)(config.getList("Enable in"));
|
||||
}
|
||||
|
||||
public String getResult(String event)
|
||||
@@ -37,4 +67,8 @@ public class Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getWorlds()
|
||||
{
|
||||
return worlds;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user