63 lines
1.6 KiB
Java
63 lines
1.6 KiB
Java
|
|
package com.playerblocklife;
|
||
|
|
|
||
|
|
import org.bukkit.configuration.file.FileConfiguration;
|
||
|
|
|
||
|
|
public class ConfigManager {
|
||
|
|
private final PlayerBlockLife plugin;
|
||
|
|
private FileConfiguration config;
|
||
|
|
|
||
|
|
public ConfigManager(PlayerBlockLife plugin) {
|
||
|
|
this.plugin = plugin;
|
||
|
|
loadConfig();
|
||
|
|
}
|
||
|
|
|
||
|
|
public void loadConfig() {
|
||
|
|
plugin.saveDefaultConfig();
|
||
|
|
config = plugin.getConfig();
|
||
|
|
}
|
||
|
|
|
||
|
|
public void reloadConfig() {
|
||
|
|
plugin.reloadConfig();
|
||
|
|
config = plugin.getConfig();
|
||
|
|
}
|
||
|
|
|
||
|
|
public int getBlocksPerPlayer() {
|
||
|
|
return config.getInt("blocks.amount", 5);
|
||
|
|
}
|
||
|
|
|
||
|
|
public int getSpreadRange() {
|
||
|
|
return config.getInt("blocks.spread", 5);
|
||
|
|
}
|
||
|
|
|
||
|
|
public int getDepth() {
|
||
|
|
return config.getInt("blocks.depth", -1);
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean isDieWhenBlocksGone() {
|
||
|
|
return config.getBoolean("game.die_when_blocks_gone", true);
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean isBecomeSpectator() {
|
||
|
|
return config.getBoolean("game.become_spectator", true);
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean isHealthSystemEnabled() {
|
||
|
|
return config.getBoolean("game.health_system", true);
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean isSkinSystemEnabled() {
|
||
|
|
return config.getBoolean("skin.enabled", true);
|
||
|
|
}
|
||
|
|
|
||
|
|
public String getSkinSource() {
|
||
|
|
return config.getString("skin.source", "player_profile");
|
||
|
|
}
|
||
|
|
|
||
|
|
public String getMessage(String path, String defaultValue) {
|
||
|
|
String message = config.getString("messages." + path, defaultValue);
|
||
|
|
if (message != null) {
|
||
|
|
message = message.replace("&", "§");
|
||
|
|
}
|
||
|
|
return message;
|
||
|
|
}
|
||
|
|
}
|