2021-12-29 02:28:50 +00:00
|
|
|
// This claas was created by JaTiTV
|
|
|
|
|
|
|
|
package de.jatitv.opsecurity.config.config;
|
|
|
|
|
2022-01-06 01:08:20 +00:00
|
|
|
import de.jatitv.opsecurity.Util;
|
2021-12-29 02:28:50 +00:00
|
|
|
import de.jatitv.opsecurity.objects.PlayerObject;
|
|
|
|
import de.jatitv.opsecurity.system.Main;
|
2022-01-06 01:08:20 +00:00
|
|
|
import de.jatitv.opsecurity.system.Permissions;
|
2022-01-21 20:03:11 +00:00
|
|
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
2022-01-06 01:08:20 +00:00
|
|
|
import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
|
2021-12-29 02:28:50 +00:00
|
|
|
import org.bukkit.Sound;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
public class SelectConfig {
|
|
|
|
|
|
|
|
// Config
|
|
|
|
|
|
|
|
public static Integer ConfigVersion;
|
|
|
|
|
|
|
|
public static Boolean UpdateCheckOnJoin;
|
|
|
|
public static String language;
|
|
|
|
|
|
|
|
public static Boolean OnlyOPcanUseThePlugin;
|
|
|
|
public static Boolean CheckOnJoin;
|
|
|
|
public static Boolean CheckOnInteract;
|
|
|
|
public static Boolean CheckOnCommand;
|
|
|
|
public static Boolean CheckOnChat;
|
|
|
|
|
|
|
|
public static String KickCommand;
|
|
|
|
|
|
|
|
public static Boolean Notify_Warn;
|
|
|
|
public static Boolean Notify_Sound_Enable;
|
|
|
|
public static Sound Notify_Sound;
|
|
|
|
public static String Notify_Sound_input;
|
|
|
|
|
|
|
|
public static Boolean Timer_Enable;
|
|
|
|
public static int RefreshTime;
|
|
|
|
|
|
|
|
public static Boolean OP_Whitelist_Enable;
|
|
|
|
public static Boolean PlayerMustBeOnlineToOp;
|
|
|
|
|
|
|
|
|
|
|
|
public static Boolean no_OP_Player_deop;
|
|
|
|
public static Boolean sendPlayerDEOPmsg;
|
|
|
|
public static Boolean no_OP_Player_kick;
|
|
|
|
public static Boolean customCommand_Enable;
|
|
|
|
public static List<String> customKickCommand;
|
|
|
|
|
|
|
|
public static Boolean Permission_Whitelist_Enable;
|
2022-01-06 01:08:20 +00:00
|
|
|
public static List<String> permissions;
|
2021-12-29 02:28:50 +00:00
|
|
|
|
|
|
|
public static Boolean PlayerWhithPermission_kick;
|
|
|
|
public static Boolean Perm_Command_enable;
|
|
|
|
public static List<String> Perm_Command;
|
|
|
|
|
|
|
|
public static Boolean LP_Enable;
|
|
|
|
public static Boolean LP_AllowFromConsole;
|
|
|
|
public static List<String> LP_Whitelist;
|
|
|
|
|
|
|
|
|
|
|
|
//help
|
|
|
|
public static void Help(CommandSender sender) {
|
2022-01-21 20:03:11 +00:00
|
|
|
if (!sender.hasPermission(Permissions.help)) {
|
|
|
|
sender.sendMessage(Util.getPrefix() + " §cYou do not have permission for OPSecurity! §7<" + Permissions.help + ">");
|
2022-01-06 01:08:20 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sender.sendMessage(Util.getPrefix() + " §8----- §2OP§4Security §chelp §8-----");
|
|
|
|
sender.sendMessage(Util.getPrefix());
|
|
|
|
sender.sendMessage(Util.getPrefix() + " §8'§b/opsecurity reload§8' §eReload the Plugin.");
|
|
|
|
sender.sendMessage(Util.getPrefix() + " §8'§b/opsecurity help§8' §eOpens this help.");
|
|
|
|
sender.sendMessage(Util.getPrefix() + " §8'§b/opsecurity info§8' §eCall the info about §2OP§4Security§e.");
|
|
|
|
sender.sendMessage(Util.getPrefix());
|
|
|
|
sender.sendMessage(Util.getPrefix() + " §8----------------------------");
|
2021-12-29 02:28:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void onSelect() {
|
|
|
|
File configYML = new File(Main.plugin.getDataFolder().getPath(), "config.yml");
|
|
|
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(configYML);
|
|
|
|
|
|
|
|
Main.opHashMap.clear();
|
|
|
|
Main.permissionHashMap.clear();
|
|
|
|
|
|
|
|
ConfigVersion = yamlConfiguration.getInt("ConfigVersion");
|
|
|
|
|
|
|
|
UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheckOnJoin");
|
|
|
|
language = yamlConfiguration.getString("Plugin.language");
|
|
|
|
OnlyOPcanUseThePlugin = yamlConfiguration.getBoolean("Plugin.OnlyOPcanUseThePlugin");
|
|
|
|
CheckOnJoin = yamlConfiguration.getBoolean("Check.OnJoin");
|
|
|
|
CheckOnInteract = yamlConfiguration.getBoolean("Check.OnInteract");
|
|
|
|
CheckOnCommand = yamlConfiguration.getBoolean("Check.OnCommand");
|
|
|
|
CheckOnChat = yamlConfiguration.getBoolean("Check.OnChat");
|
|
|
|
Timer_Enable = yamlConfiguration.getBoolean("Check.Timer.Enable");
|
|
|
|
RefreshTime = yamlConfiguration.getInt("Check.Timer.RefreshTime_inSec");
|
|
|
|
|
|
|
|
KickCommand = yamlConfiguration.getString("Kick.Command");
|
|
|
|
Notify_Warn = yamlConfiguration.getBoolean("Notify.JoinWarn.Enable");
|
|
|
|
Notify_Sound_Enable = yamlConfiguration.getBoolean("Notify.Sound.Enable");
|
|
|
|
Notify_Sound_input = yamlConfiguration.getString("Notify.Sound.Sound");
|
|
|
|
|
|
|
|
OP_Whitelist_Enable = yamlConfiguration.getBoolean("OP_Whitelist.Enable");
|
|
|
|
PlayerMustBeOnlineToOp = yamlConfiguration.getBoolean("OP_Whitelist.PlayerMustBeOnlineToOp");
|
|
|
|
|
|
|
|
ArrayList<PlayerObject> opWhitelist = new ArrayList<>();
|
|
|
|
for (String key : yamlConfiguration.getConfigurationSection("OP_Whitelist.Whitelist").getKeys(false)) {
|
|
|
|
PlayerObject player = new PlayerObject(
|
2022-01-06 01:08:20 +00:00
|
|
|
yamlConfiguration.getString("OP_Whitelist.Whitelist." + key + ".UUID").replace("-", ""));
|
2021-12-29 02:28:50 +00:00
|
|
|
opWhitelist.add(player);
|
2022-01-05 00:05:41 +00:00
|
|
|
Main.opHashMap.put(key.toLowerCase(), player);
|
2021-12-29 02:28:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
no_OP_Player_deop = yamlConfiguration.getBoolean("OP_Whitelist.noOpPlayerDeop.Enable");
|
|
|
|
sendPlayerDEOPmsg = yamlConfiguration.getBoolean("OP_Whitelist.noOpPlayerDeop.PlayerSendMessage");
|
|
|
|
no_OP_Player_kick = yamlConfiguration.getBoolean("OP_Whitelist.noOpPlayerKick.Enable");
|
|
|
|
customCommand_Enable = yamlConfiguration.getBoolean("OP_Whitelist.customCommands.Enable");
|
|
|
|
customKickCommand = yamlConfiguration.getStringList("OP_Whitelist.customCommands.Commands");
|
|
|
|
Permission_Whitelist_Enable = yamlConfiguration.getBoolean("Permission_Whitelist.Enable");
|
2022-01-06 01:08:20 +00:00
|
|
|
permissions = yamlConfiguration.getStringList("Permission_Whitelist.Permissions");
|
2021-12-29 02:28:50 +00:00
|
|
|
|
|
|
|
ArrayList<PlayerObject> permWhitelist = new ArrayList<>();
|
|
|
|
for (String key : yamlConfiguration.getConfigurationSection("Permission_Whitelist.Whitelist").getKeys(false)) {
|
|
|
|
PlayerObject player = new PlayerObject(
|
2022-01-06 01:08:20 +00:00
|
|
|
yamlConfiguration.getString("Permission_Whitelist.Whitelist." + key + ".UUID").replace("-", ""));
|
2021-12-29 02:28:50 +00:00
|
|
|
permWhitelist.add(player);
|
2022-01-05 00:05:41 +00:00
|
|
|
Main.permissionHashMap.put(key.toLowerCase(), player);
|
2021-12-29 02:28:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PlayerWhithPermission_kick = yamlConfiguration.getBoolean("Permission_Whitelist.PlayerWhithPermission_kick");
|
|
|
|
Perm_Command_enable = yamlConfiguration.getBoolean("Permission_Whitelist.customCommands.Enable");
|
|
|
|
Perm_Command = yamlConfiguration.getStringList("Permission_Whitelist.customCommands.Commands");
|
|
|
|
LP_Enable = yamlConfiguration.getBoolean("LuckPerms_Whitelist.Enable");
|
|
|
|
LP_AllowFromConsole = yamlConfiguration.getBoolean("LuckPerms_Whitelist.AllowFromConsole");
|
|
|
|
LP_Whitelist = yamlConfiguration.getStringList("LuckPerms_Whitelist.Whitelist");
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void sound() {
|
2022-01-06 01:08:20 +00:00
|
|
|
Notify_Sound = Config.checkSound(CreateConfig.Notify_Sound_1_8, CreateConfig.Notify_Sound_1_9_to_1_12, CreateConfig.Notify_Sound_from_1_13, Notify_Sound_input, Util.getPrefix());
|
2021-12-29 02:28:50 +00:00
|
|
|
}
|
|
|
|
}
|