T2C-OPSecurity/OpSecurity V3/src/main/java/net/t2code/opsecurity/config/config/Config.java

65 lines
2.3 KiB
Java

package net.t2code.opsecurity.config.config;
import net.t2code.opsecurity.enums.ConfigParam;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import org.bukkit.Sound;
public enum Config {
language("plugin.language", "english", ConfigParam.STRING),
onlyOPcanUseThePlugin("plugin.onlyOPcanUseThePlugin", true, ConfigParam.BOOLEAN),
checkOnJoin("check.onJoin", true, ConfigParam.BOOLEAN),
checkOnInteract("check.onInteract", true, ConfigParam.BOOLEAN),
checkOnCommand("check.onCommand", true, ConfigParam.BOOLEAN),
checkOnChat("check.onChat", true, ConfigParam.BOOLEAN),
checkTimerEnable("check.timer.enable", true, ConfigParam.BOOLEAN),
checkTimerRefreshInSec("check.timer.refreshInSec", 60, ConfigParam.INTEGER),
kickCustomCommand("kick.customCommand.Enable", false, ConfigParam.BOOLEAN),
kickCommand("kick.customCommand.command", "minecraft:kick [player] [reason]", ConfigParam.STRING),
notifyJoinWarning("notify.joinWarn.enable", true, ConfigParam.BOOLEAN),
notifyBungee("notify.allBungeePlayer.enable", false, ConfigParam.BOOLEAN),
notifySoundEnable("notify.soundEnable", true, ConfigParam.BOOLEAN),
notifySoundValue("notify.sound", sound(), ConfigParam.SOUND);
public String path;
public String valueString;
public Integer valueInt;
public Boolean valueBoolean;
public Sound sound;
public ConfigParam cEnum;
Config(String path, String value, ConfigParam cEnum) {
this.path = path;
this.valueString = value;
this.cEnum = cEnum;
}
Config(String path, Sound value, ConfigParam cEnum) {
this.path = path;
this.sound = value;
this.cEnum = cEnum;
}
Config(String path, Integer value, ConfigParam cEnum) {
this.path = path;
this.valueInt = value;
this.cEnum = cEnum;
}
Config(String path, Boolean value, ConfigParam cEnum) {
this.path = path;
this.valueBoolean = value;
this.cEnum = cEnum;
}
public static Sound sound() {
if (T2CmcVersion.isMc1_8()) {
return Sound.valueOf("NOTE_PIANO");
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
return Sound.valueOf("BLOCK_NOTE_HARP");
} else return Sound.valueOf("BLOCK_NOTE_BLOCK_HARP");
}
}