2022-01-06 01:21:27 +00:00
|
|
|
package de.jatitv.commandguiv2.Spigot.config.config;
|
2021-12-21 04:57:29 +00:00
|
|
|
|
|
|
|
import de.jatitv.commandguiv2.Spigot.Main;
|
2022-01-06 01:21:27 +00:00
|
|
|
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
2021-12-21 04:57:29 +00:00
|
|
|
import de.jatitv.commandguiv2.Spigot.system.database.MySQL;
|
2022-01-01 02:40:54 +00:00
|
|
|
import de.jatitv.commandguiv2.Util;
|
2021-12-21 04:57:29 +00:00
|
|
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
|
|
|
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
|
|
|
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
|
|
|
import org.bukkit.Sound;
|
|
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
|
|
|
|
|
|
import java.io.File;
|
2022-01-06 02:04:56 +00:00
|
|
|
import java.util.ArrayList;
|
2021-12-21 04:57:29 +00:00
|
|
|
import java.util.List;
|
|
|
|
|
2022-01-01 02:40:54 +00:00
|
|
|
public class SelectConfig {
|
2021-12-21 04:57:29 +00:00
|
|
|
|
|
|
|
public static Boolean DisableUpdateChecker;
|
|
|
|
public static Boolean UpdateCheckOnJoin;
|
|
|
|
public static Boolean Debug;
|
|
|
|
public static Boolean HelpAlias;
|
|
|
|
public static String language;
|
|
|
|
public static String Currency;
|
|
|
|
|
|
|
|
public static String Storage;
|
|
|
|
|
|
|
|
public static Boolean Bungee;
|
|
|
|
public static String thisServer;
|
|
|
|
|
|
|
|
public static String DefaultGUI;
|
|
|
|
|
|
|
|
public static Boolean UseItem_Enable;
|
|
|
|
public static Boolean UseItem_AllowToggle;
|
|
|
|
public static Boolean UseItem_AllowSetSlot;
|
|
|
|
public static Boolean UseItem_GiveOnEveryJoin;
|
|
|
|
public static Boolean UseItem_GiveOnlyOnFirstJoin;
|
|
|
|
public static Boolean UseItem_ServerChange;
|
|
|
|
public static Boolean Cursor_ToGUIItem_OnLogin;
|
|
|
|
public static Boolean Cursor_ToGUIItem_OnlyOnFirstLogin;
|
|
|
|
public static Boolean UseItem_BlockMoveAndDrop;
|
|
|
|
public static String UseItem_OpenGUI;
|
|
|
|
public static Boolean UseItem_Permission;
|
|
|
|
public static Boolean UseItem_KeepAtCommandClear;
|
|
|
|
|
2022-01-06 01:21:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
public static Boolean UseItemGameModeChangeEnable;
|
2021-12-21 04:57:29 +00:00
|
|
|
public static int UseItemGameModeChangeDelayInTicks;
|
2022-01-06 01:21:27 +00:00
|
|
|
public static Boolean UseItemGameModeProtection;
|
|
|
|
public static String UseItemGameModeMode;
|
|
|
|
public static List<String> UseItemGameModeList;
|
|
|
|
|
2021-12-21 04:57:29 +00:00
|
|
|
|
|
|
|
public static Boolean UseItem_InventorySlot_FreeSlot;
|
|
|
|
public static Integer UseItem_InventorySlot;
|
|
|
|
public static Boolean UseItem_InventorySlotEnforce;
|
|
|
|
public static String UseItem_Material;
|
|
|
|
public static Boolean UseItem_PlayerHead_Enable;
|
|
|
|
public static Boolean UseItem_Base64_Enable;
|
|
|
|
public static String UseItem_Base64value;
|
|
|
|
public static Boolean UseItem_PlayerWhoHasOpenedTheGUI;
|
|
|
|
public static String UseItem_PlayerName;
|
|
|
|
public static String UseItem_Name;
|
2022-01-06 01:21:27 +00:00
|
|
|
public static List<String> UseItem_Lore;
|
|
|
|
|
|
|
|
|
2021-12-21 04:57:29 +00:00
|
|
|
|
|
|
|
public static Boolean Sound_Enable = true;
|
|
|
|
|
|
|
|
public static Boolean Sound_OpenInventory_Enable = true;
|
|
|
|
public static Sound Sound_OpenInventory;
|
|
|
|
public static String Sound_OpenInventory_input;
|
|
|
|
|
|
|
|
public static Boolean Sound_Click_Enable = true;
|
|
|
|
public static Sound Sound_Click;
|
|
|
|
public static String Sound_Click_input;
|
|
|
|
|
|
|
|
public static Boolean Sound_NoMoney_Enable = true;
|
|
|
|
public static Sound Sound_NoMoney;
|
|
|
|
public static String Sound_NoMoney_input;
|
|
|
|
|
|
|
|
|
|
|
|
public static Boolean Sound_NoInventorySpace_Enable = true;
|
|
|
|
public static Sound Sound_NoInventorySpace;
|
|
|
|
public static String Sound_NoInventorySpace_input;
|
|
|
|
|
|
|
|
public static Boolean Sound_Give_Enable = true;
|
|
|
|
public static Sound Sound_Give;
|
|
|
|
public static String Sound_Give_input;
|
|
|
|
|
|
|
|
public static Boolean Sound_PlayerNotFound_Enable = true;
|
|
|
|
public static Sound Sound_PlayerNotFound;
|
|
|
|
public static String Sound_PlayerNotFound_input;
|
|
|
|
|
|
|
|
|
|
|
|
public static void onSelect() {
|
|
|
|
File config = new File(Main.getPath(), "config.yml");
|
|
|
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
|
|
|
|
|
|
|
if (yamlConfiguration.get("Plugin.DisableUpdateChecker") == null) {
|
|
|
|
DisableUpdateChecker = false;
|
|
|
|
} else DisableUpdateChecker = yamlConfiguration.getBoolean("Plugin.DisableUpdateChecker");
|
|
|
|
UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheckOnJoin");
|
|
|
|
Debug = yamlConfiguration.getBoolean("Plugin.Debug");
|
|
|
|
HelpAlias = yamlConfiguration.getBoolean("Plugin.HelpAlias");
|
|
|
|
language = yamlConfiguration.getString("Plugin.language");
|
|
|
|
Currency = yamlConfiguration.getString("Plugin.Currency");
|
|
|
|
DefaultGUI = yamlConfiguration.getString("Plugin.DefaultGUI");
|
|
|
|
|
|
|
|
Storage = yamlConfiguration.getString("Storage.Type").toUpperCase();
|
|
|
|
|
|
|
|
MySQL.ip = yamlConfiguration.getString("Storage.MySQL.IP");
|
|
|
|
MySQL.port = yamlConfiguration.getInt("Storage.MySQL.Port");
|
|
|
|
MySQL.database = yamlConfiguration.getString("Storage.MySQL.Database");
|
|
|
|
MySQL.user = yamlConfiguration.getString("Storage.MySQL.User");
|
|
|
|
MySQL.password = yamlConfiguration.getString("Storage.MySQL.Password");
|
|
|
|
MySQL.SSL = yamlConfiguration.getBoolean("Storage.MySQL.SSL");
|
|
|
|
|
|
|
|
Bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
|
|
|
|
thisServer = yamlConfiguration.getString("BungeeCord.ThisServer");
|
|
|
|
|
|
|
|
|
|
|
|
UseItem_Enable = yamlConfiguration.getBoolean("UseItem.Enable");
|
|
|
|
UseItem_AllowToggle = yamlConfiguration.getBoolean("UseItem.AllowToggle");
|
|
|
|
UseItem_AllowSetSlot = yamlConfiguration.getBoolean("UseItem.AllowSetSlot");
|
|
|
|
UseItem_BlockMoveAndDrop = yamlConfiguration.getBoolean("UseItem.BlockMoveAndDrop");
|
|
|
|
UseItem_OpenGUI = yamlConfiguration.getString("UseItem.OpenGUI");
|
|
|
|
UseItem_Permission = yamlConfiguration.getBoolean("UseItem.Permission.NeededToUse");
|
|
|
|
UseItem_KeepAtCommandClear = yamlConfiguration.getBoolean("UseItem.KeepAtCommandClear");
|
|
|
|
|
|
|
|
UseItem_InventorySlot_FreeSlot = yamlConfiguration.getBoolean("UseItem.InventorySlot.FreeSlot");
|
|
|
|
UseItem_InventorySlot = yamlConfiguration.getInt("UseItem.InventorySlot.Slot");
|
|
|
|
UseItem_InventorySlotEnforce = yamlConfiguration.getBoolean("UseItem.InventorySlot.SlotEnforce");
|
|
|
|
UseItem_Material = yamlConfiguration.getString("UseItem.Item.Material").toUpperCase();
|
|
|
|
UseItem_PlayerHead_Enable = yamlConfiguration.getBoolean("UseItem.Item.PlayerHead.Enable");
|
|
|
|
UseItem_Base64_Enable = yamlConfiguration.getBoolean("UseItem.Item.PlayerHead.Base64.Enable");
|
|
|
|
UseItem_Base64value = yamlConfiguration.getString("UseItem.Item.PlayerHead.Base64.Base64Value");
|
|
|
|
UseItem_PlayerWhoHasOpenedTheGUI = yamlConfiguration.getBoolean("UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI");
|
|
|
|
UseItem_PlayerName = yamlConfiguration.getString("UseItem.Item.PlayerHead.PlayerName");
|
2022-01-01 02:40:54 +00:00
|
|
|
UseItem_Name = Replace.replace(Util.getPrefix(),yamlConfiguration.getString("UseItem.Item.Name"));
|
2022-01-06 01:21:27 +00:00
|
|
|
UseItem_Lore = yamlConfiguration.getStringList("UseItem.Item.Lore");
|
2021-12-21 04:57:29 +00:00
|
|
|
UseItem_GiveOnEveryJoin = yamlConfiguration.getBoolean("UseItem.Join.GiveOnEveryJoin");
|
|
|
|
UseItem_GiveOnlyOnFirstJoin = yamlConfiguration.getBoolean("UseItem.Join.GiveOnlyOnFirstJoin");
|
|
|
|
Cursor_ToGUIItem_OnLogin = yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable");
|
|
|
|
Cursor_ToGUIItem_OnlyOnFirstLogin = yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.Spigot.OnlyOnFirstLogin");
|
|
|
|
UseItem_ServerChange = yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange");
|
|
|
|
|
2022-01-06 02:04:56 +00:00
|
|
|
UseItemGameModeChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Change.Enable");
|
|
|
|
UseItemGameModeChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.GameMode.Change.DelayInTicks");
|
|
|
|
UseItemGameModeProtection = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.Enable");
|
|
|
|
UseItemGameModeMode = yamlConfiguration.getString("Advanced.UseItem.GameMode.Protection.Mode");
|
|
|
|
List<String> gml = new ArrayList<>();
|
|
|
|
for (String gm : yamlConfiguration.getStringList("Advanced.UseItem.GameMode.Protection.List")){
|
|
|
|
gml.add(gm.toUpperCase());
|
|
|
|
}
|
|
|
|
UseItemGameModeList = gml;
|
|
|
|
|
2022-01-06 01:21:27 +00:00
|
|
|
|
2021-12-21 04:57:29 +00:00
|
|
|
|
|
|
|
Sound_Enable = yamlConfiguration.getBoolean("Sound.Enable");
|
|
|
|
Sound_OpenInventory_Enable = yamlConfiguration.getBoolean("Sound.OpenInventory.Enable");
|
|
|
|
Sound_OpenInventory_input = (yamlConfiguration.getString("Sound.OpenInventory.Sound").toUpperCase().replace(".", "_"));
|
|
|
|
Sound_Click_Enable = yamlConfiguration.getBoolean("Sound.Click.Enable");
|
|
|
|
Sound_Click_input = (yamlConfiguration.getString("Sound.Click.Sound").toUpperCase().replace(".", "_"));
|
|
|
|
Sound_NoMoney_Enable = yamlConfiguration.getBoolean("Sound.NoMoney.Enable");
|
|
|
|
Sound_NoMoney_input = (yamlConfiguration.getString("Sound.NoMoney.Sound").toUpperCase().replace(".", "_"));
|
|
|
|
|
|
|
|
Sound_NoInventorySpace_Enable = yamlConfiguration.getBoolean("Sound.NoInventorySpace.Enable");
|
|
|
|
Sound_NoInventorySpace_input = (yamlConfiguration.getString("Sound.NoInventorySpace.Sound").toUpperCase().replace(".", "_"));
|
|
|
|
Sound_Give_Enable = yamlConfiguration.getBoolean("Sound.Give.Enable");
|
|
|
|
Sound_Give_input = (yamlConfiguration.getString("Sound.Give.Sound").toUpperCase().replace(".", "_"));
|
|
|
|
Sound_PlayerNotFound_Enable = yamlConfiguration.getBoolean("Sound.PlayerNotFound.Enable");
|
|
|
|
Sound_PlayerNotFound_input = (yamlConfiguration.getString("Sound.PlayerNotFound.Sound").toUpperCase().replace(".", "_"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-01-06 01:21:27 +00:00
|
|
|
|
2021-12-21 04:57:29 +00:00
|
|
|
public static void sound(String Prefix) {
|
|
|
|
String soundOpenInventory;
|
|
|
|
if (MCVersion.minecraft1_8) {
|
2022-01-06 01:21:27 +00:00
|
|
|
soundOpenInventory = "CHEST_OPEN";
|
2021-12-21 04:57:29 +00:00
|
|
|
} else {
|
2022-01-06 01:21:27 +00:00
|
|
|
soundOpenInventory = "BLOCK_CHEST_OPEN";
|
2021-12-21 04:57:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
String soundClick;
|
|
|
|
if (MCVersion.minecraft1_8) {
|
2022-01-06 01:21:27 +00:00
|
|
|
soundClick = "NOTE_STICKS";
|
2021-12-21 04:57:29 +00:00
|
|
|
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
2022-01-06 01:21:27 +00:00
|
|
|
soundClick = "BLOCK_NOTE_HAT";
|
2021-12-21 04:57:29 +00:00
|
|
|
} else {
|
2022-01-06 01:21:27 +00:00
|
|
|
soundClick = "BLOCK_NOTE_BLOCK_HAT";
|
2021-12-21 04:57:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
String soundNoMoney;
|
|
|
|
if (MCVersion.minecraft1_8) {
|
2022-01-06 01:21:27 +00:00
|
|
|
soundNoMoney = "NOTE_PIANO";
|
2021-12-21 04:57:29 +00:00
|
|
|
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
2022-01-06 01:21:27 +00:00
|
|
|
soundNoMoney = "BLOCK_NOTE_HARP";
|
2021-12-21 04:57:29 +00:00
|
|
|
} else {
|
2022-01-06 01:21:27 +00:00
|
|
|
soundNoMoney = "BLOCK_NOTE_BLOCK_HARP";
|
2021-12-21 04:57:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
String soundNoInventorySpace;
|
|
|
|
if (MCVersion.minecraft1_8) {
|
|
|
|
soundNoInventorySpace = "NOTE_PIANO";
|
|
|
|
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
|
|
|
soundNoInventorySpace = "BLOCK_NOTE_BASS";
|
|
|
|
} else {
|
|
|
|
soundNoInventorySpace = "BLOCK_NOTE_BLOCK_GUITAR";
|
|
|
|
}
|
|
|
|
|
|
|
|
String soundGive;
|
|
|
|
if (MCVersion.minecraft1_8) {
|
|
|
|
soundGive = "LEVEL_UP";
|
|
|
|
} else {
|
|
|
|
soundGive = "ENTITY_PLAYER_LEVELUP";
|
|
|
|
}
|
|
|
|
|
|
|
|
String soundPlayerNotFound;
|
|
|
|
if (MCVersion.minecraft1_8) {
|
|
|
|
soundPlayerNotFound = "NOTE_PIANO";
|
|
|
|
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
|
|
|
soundPlayerNotFound = "BLOCK_NOTE_HARP";
|
|
|
|
} else {
|
|
|
|
soundPlayerNotFound = "BLOCK_NOTE_BLOCK_HARP";
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
Sound sound_OpenInventory = Sound.valueOf(Sound_OpenInventory_input);
|
|
|
|
if (sound_OpenInventory != null) {
|
|
|
|
Sound_OpenInventory = sound_OpenInventory;
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
|
|
|
.replace("[sound]", "§8OpenInventory: §6" + Sound_OpenInventory_input) + "§4\n§4\n§4\n");
|
|
|
|
Sound_OpenInventory = Sound.valueOf(soundOpenInventory);
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
Sound sound_Click = Sound.valueOf(Sound_Click_input);
|
|
|
|
if (sound_Click != null) {
|
|
|
|
Sound_Click = sound_Click;
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
|
|
|
.replace("[sound]", "§8Click: §6" + Sound_Click_input) + "§4\n§4\n§4\n");
|
|
|
|
Sound_Click = Sound.valueOf(soundClick);
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
Sound sound_NoMoney = Sound.valueOf(Sound_NoMoney_input);
|
|
|
|
if (sound_NoMoney != null) {
|
|
|
|
Sound_Click = sound_NoMoney;
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
|
|
|
.replace("[sound]", "§8NoMoney: §6" + Sound_NoMoney_input) + "§4\n§4\n§4\n");
|
|
|
|
Sound_NoMoney = Sound.valueOf(soundNoMoney);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
Sound sound_NoInventorySpace = Sound.valueOf(Sound_NoInventorySpace_input);
|
|
|
|
if (sound_NoInventorySpace != null) {
|
|
|
|
Sound_NoInventorySpace = sound_NoInventorySpace;
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
|
|
|
.replace("[sound]", "§8NoInventorySpace: §6" + Sound_NoInventorySpace_input) + "§4\n§4\n§4\n");
|
|
|
|
Sound_NoInventorySpace = Sound.valueOf(soundNoInventorySpace);
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
Sound sound_Give = Sound.valueOf(Sound_Give_input);
|
|
|
|
if (sound_Give != null) {
|
|
|
|
Sound_Give = sound_Give;
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
|
|
|
.replace("[sound]", "§8Give: §6" + Sound_Give_input) + "§4\n§4\n§4\n");
|
|
|
|
Sound_Give = Sound.valueOf(soundGive);
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
Sound sound_PlayerNotFound = Sound.valueOf(Sound_PlayerNotFound_input);
|
|
|
|
if (sound_PlayerNotFound != null) {
|
|
|
|
Sound_PlayerNotFound = sound_PlayerNotFound;
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
|
|
|
.replace("[sound]", "§8PlayerNotFound: §6" + Sound_PlayerNotFound_input) + "§4\n§4\n§4\n");
|
|
|
|
Sound_PlayerNotFound = Sound.valueOf(soundPlayerNotFound);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|