T2C-CommandGUI/CommandGUI V2/src/main/java/net/t2code/commandguiv2/Spigot/config/config/SelectConfig.java

699 lines
26 KiB
Java
Raw Normal View History

2022-11-01 12:20:53 +00:00
package net.t2code.commandguiv2.Spigot.config.config;
2021-12-21 04:57:29 +00:00
2022-11-01 12:20:53 +00:00
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverter;
2022-11-01 12:20:53 +00:00
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.commandguiv2.Util;
2022-08-10 13:53:01 +00:00
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
2021-12-21 04:57:29 +00:00
import org.bukkit.Sound;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
import java.io.IOException;
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 void onSelect() {
File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
if (yamlConfiguration.getInt("ConfigVersion") < Util.getConfigVersion() && new File(Main.getPath(), "config.yml").exists()) {
2022-08-10 13:53:01 +00:00
T2Csend.console(Util.getPrefix() + " §4----------------------");
T2Csend.console(Util.getPrefix() + " ");
T2Csend.console(Util.getPrefix() + " §6New features have been added to CommandGUI. The Config is adapted!");
T2Csend.console(Util.getPrefix() + " ");
T2Csend.console(Util.getPrefix() + " §4----------------------");
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
if (yamlConfiguration.getInt("ConfigVersion") < 5) {
ConfigConverter.convert();
}
if (yamlConfiguration.getInt("ConfigVersion") < 6) {
ConfigConverter.removeBungeeOption();
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
}
}
2021-12-21 04:57:29 +00:00
Debug = yamlConfiguration.getBoolean("Plugin.Debug");
2022-11-15 14:31:26 +00:00
updateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.updateCheck.onJoin");
updateCheckSeePreReleaseUpdates = yamlConfiguration.getBoolean("Plugin.updateCheck.seePreReleaseUpdates");
updateCheckTimeInterval = yamlConfiguration.getInt("Plugin.updateCheck.timeInterval");
2021-12-21 04:57:29 +00:00
HelpAlias = yamlConfiguration.getBoolean("Plugin.HelpAlias");
adminSubCommand = yamlConfiguration.getString("Plugin.AdminSubCommand").toLowerCase();
2021-12-21 04:57:29 +00:00
language = yamlConfiguration.getString("Plugin.language");
Currency = yamlConfiguration.getString("Plugin.Currency");
DefaultGUI = yamlConfiguration.getString("Plugin.DefaultGUI");
2022-11-01 12:20:53 +00:00
storage = yamlConfiguration.getString("Storage.Type").toUpperCase();
2021-12-21 04:57:29 +00:00
mysqlIp = yamlConfiguration.getString("Storage.MySQL.IP");
mysqlPort = yamlConfiguration.getInt("Storage.MySQL.Port");
mysqlDatabase = yamlConfiguration.getString("Storage.MySQL.Database");
mysqlUser = yamlConfiguration.getString("Storage.MySQL.User");
mysqlPassword = yamlConfiguration.getString("Storage.MySQL.Password");
mysqlSSL = yamlConfiguration.getBoolean("Storage.MySQL.SSL");
2021-12-21 04:57:29 +00:00
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-08-10 13:53:01 +00:00
UseItem_Name = T2Creplace.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-04-16 12:32:22 +00:00
toggleItemOnOrYesBase64 = yamlConfiguration.getBoolean("Toggle.Items.OnOrYes.Item.Base64.Enable");
toggleItemOnOrYesBase64Value = yamlConfiguration.getString("Toggle.Items.OnOrYes.Item.Base64.Base64Value");
toggleItemOnOrYesMaterial = yamlConfiguration.getString("Toggle.Items.OnOrYes.Item.Material");
toggleItemOffOrNoBase64 = yamlConfiguration.getBoolean("Toggle.Items.OffOrNo.Item.Base64.Enable");
toggleItemOffOrNoBase64Value = yamlConfiguration.getString("Toggle.Items.OffOrNo.Item.Base64.Base64Value");
toggleItemOffOrNoMaterial = yamlConfiguration.getString("Toggle.Items.OffOrNo.Item.Material");
togglePermTrue = yamlConfiguration.getString("Toggle.Permission.Commands.True");
togglePermFalse = yamlConfiguration.getString("Toggle.Permission.Commands.False");
placeholderTrue = yamlConfiguration.getString("Placeholder.True");
placeholderFalse = yamlConfiguration.getString("Placeholder.False");
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(".", "_"));
UseItemGameModeChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Change.Enable");
UseItemGameModeChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.GameMode.Change.DelayInTicks");
UseItemGameModeProtection = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.Enable");
UseItemGameModeRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled");
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;
UseItemWorldChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.World.Change.Enable");
UseItemWorldChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.World.Change.DelayInTicks");
UseItemWorldProtection = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.Enable");
UseItemWorldRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled");
UseItemWorldMode = yamlConfiguration.getString("Advanced.UseItem.World.Protection.Mode");
UseItemWorldList = yamlConfiguration.getStringList("Advanced.UseItem.World.Protection.List");
if (yamlConfiguration.get("Advanced.UseItem.DisableInfoBySneak") != null) {
disableInfoBySneak = yamlConfiguration.getBoolean("Advanced.UseItem.DisableInfoBySneak");
}
UseItemItemBlockBlacklist = yamlConfiguration.getStringList("Advanced.UseItem.ItemBlockBlacklist");
2021-12-21 04:57:29 +00:00
}
2022-01-06 01:21:27 +00:00
2021-12-21 04:57:29 +00:00
public static void sound(String Prefix) {
String soundOpenInventory;
2022-08-10 13:53:01 +00:00
if (T2CmcVersion.isMc1_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;
2022-08-10 13:53:01 +00:00
if (T2CmcVersion.isMc1_8()) {
2022-01-06 01:21:27 +00:00
soundClick = "NOTE_STICKS";
2022-08-10 13:53:01 +00:00
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_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;
2022-08-10 13:53:01 +00:00
if (T2CmcVersion.isMc1_8()) {
2022-01-06 01:21:27 +00:00
soundNoMoney = "NOTE_PIANO";
2022-08-10 13:53:01 +00:00
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_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;
2022-08-10 13:53:01 +00:00
if (T2CmcVersion.isMc1_8()) {
2021-12-21 04:57:29 +00:00
soundNoInventorySpace = "NOTE_PIANO";
2022-08-10 13:53:01 +00:00
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
2021-12-21 04:57:29 +00:00
soundNoInventorySpace = "BLOCK_NOTE_BASS";
} else {
soundNoInventorySpace = "BLOCK_NOTE_BLOCK_GUITAR";
}
String soundGive;
2022-08-10 13:53:01 +00:00
if (T2CmcVersion.isMc1_8()) {
2021-12-21 04:57:29 +00:00
soundGive = "LEVEL_UP";
} else {
soundGive = "ENTITY_PLAYER_LEVELUP";
}
String soundPlayerNotFound;
2022-08-10 13:53:01 +00:00
if (T2CmcVersion.isMc1_8()) {
2021-12-21 04:57:29 +00:00
soundPlayerNotFound = "NOTE_PIANO";
2022-08-10 13:53:01 +00:00
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
2021-12-21 04:57:29 +00:00
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) {
2022-08-10 13:53:01 +00:00
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
2021-12-21 04:57:29 +00:00
.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) {
2022-08-10 13:53:01 +00:00
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
2021-12-21 04:57:29 +00:00
.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) {
2022-08-10 13:53:01 +00:00
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
2021-12-21 04:57:29 +00:00
.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) {
2022-08-10 13:53:01 +00:00
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
2021-12-21 04:57:29 +00:00
.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) {
2022-08-10 13:53:01 +00:00
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
2021-12-21 04:57:29 +00:00
.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) {
2022-08-10 13:53:01 +00:00
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
2021-12-21 04:57:29 +00:00
.replace("[sound]", "§8PlayerNotFound: §6" + Sound_PlayerNotFound_input) + "§4\n§4\n§4\n");
Sound_PlayerNotFound = Sound.valueOf(soundPlayerNotFound);
}
}
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
public static void setConfigVersion() {
File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
yamlConfiguration.set("ConfigVersion", Util.getConfigVersion());
try {
yamlConfiguration.save(config);
} catch (IOException e) {
e.printStackTrace();
}
}
private static Boolean Debug;
2022-11-15 14:31:26 +00:00
private static Boolean updateCheckOnJoin;
private static Boolean updateCheckSeePreReleaseUpdates;
private static Integer updateCheckTimeInterval;
private static Boolean HelpAlias;
private static String adminSubCommand;
private static String language;
private static String Currency;
private static String storage;
private static String mysqlIp;
private static Integer mysqlPort;
private static String mysqlDatabase;
private static String mysqlUser;
private static String mysqlPassword;
private static Boolean mysqlSSL;
private static String DefaultGUI;
private static Boolean UseItem_Enable;
private static Boolean UseItem_AllowToggle;
private static Boolean UseItem_AllowSetSlot;
private static Boolean UseItem_GiveOnEveryJoin;
private static Boolean UseItem_GiveOnlyOnFirstJoin;
private static Boolean UseItem_ServerChange;
private static Boolean Cursor_ToGUIItem_OnLogin;
private static Boolean Cursor_ToGUIItem_OnlyOnFirstLogin;
private static Boolean UseItem_BlockMoveAndDrop;
private static String UseItem_OpenGUI;
private static Boolean UseItem_Permission;
private static Boolean UseItem_KeepAtCommandClear;
private static Boolean UseItemGameModeChangeEnable;
private static int UseItemGameModeChangeDelayInTicks;
private static Boolean UseItemGameModeProtection;
private static Boolean UseItemGameModeRemoveItemWhenItIsDisabled;
private static String UseItemGameModeMode;
private static List<String> UseItemGameModeList;
private static Boolean UseItemWorldChangeEnable;
private static int UseItemWorldChangeDelayInTicks;
private static Boolean UseItemWorldProtection;
private static Boolean UseItemWorldRemoveItemWhenItIsDisabled;
private static String UseItemWorldMode;
private static List<String> UseItemWorldList;
private static List<String> UseItemItemBlockBlacklist;
private static Boolean disableInfoBySneak = false;
private static Boolean UseItem_InventorySlot_FreeSlot;
private static Integer UseItem_InventorySlot;
private static Boolean UseItem_InventorySlotEnforce;
private static String UseItem_Material;
private static Boolean UseItem_PlayerHead_Enable;
private static Boolean UseItem_Base64_Enable;
private static String UseItem_Base64value;
private static Boolean UseItem_PlayerWhoHasOpenedTheGUI;
private static String UseItem_PlayerName;
private static String UseItem_Name;
private static List<String> UseItem_Lore;
private static Boolean toggleItemOnOrYesBase64;
private static String toggleItemOnOrYesBase64Value;
private static String toggleItemOnOrYesMaterial;
private static Boolean toggleItemOffOrNoBase64;
private static String toggleItemOffOrNoBase64Value;
private static String toggleItemOffOrNoMaterial;
private static String togglePermTrue;
private static String togglePermFalse;
private static String placeholderTrue;
private static String placeholderFalse;
private static Boolean Sound_Enable = true;
private static Boolean Sound_OpenInventory_Enable = true;
private static Sound Sound_OpenInventory;
private static String Sound_OpenInventory_input;
private static Boolean Sound_Click_Enable = true;
private static Sound Sound_Click;
private static String Sound_Click_input;
private static Boolean Sound_NoMoney_Enable = true;
private static Sound Sound_NoMoney;
private static String Sound_NoMoney_input;
private static Boolean Sound_NoInventorySpace_Enable = true;
private static Sound Sound_NoInventorySpace;
private static String Sound_NoInventorySpace_input;
private static Boolean Sound_Give_Enable = true;
private static Sound Sound_Give;
private static String Sound_Give_input;
private static Boolean Sound_PlayerNotFound_Enable = true;
private static Sound Sound_PlayerNotFound;
private static String Sound_PlayerNotFound_input;
public static Boolean getDebug() {
return Debug;
}
2022-11-15 14:31:26 +00:00
public static Boolean getUpdateCheckOnJoin() {
return updateCheckOnJoin;
}
public static Boolean getUpdateCheckSeePreReleaseUpdates() {
return updateCheckSeePreReleaseUpdates;
}
public static Integer getUpdateCheckTimeInterval() {
return updateCheckTimeInterval;
}
public static Boolean getHelpAlias() {
return HelpAlias;
}
public static String getAdminSubCommand() {
return adminSubCommand;
}
public static String getLanguage() {
return language;
}
public static String getCurrency() {
return Currency;
}
public static String getStorage() {
return storage;
}
public static String getMysqlIp() {
return mysqlIp;
}
public static Integer getMysqlPort() {
return mysqlPort;
}
public static String getMysqlDatabase() {
return mysqlDatabase;
}
public static String getMysqlUser() {
return mysqlUser;
}
public static String getMysqlPassword() {
return mysqlPassword;
}
public static Boolean getMysqlSSL() {
return mysqlSSL;
}
public static String getDefaultGUI() {
return DefaultGUI;
}
public static Boolean getUseItem_Enable() {
return UseItem_Enable;
}
public static Boolean getUseItem_AllowToggle() {
return UseItem_AllowToggle;
}
public static Boolean getUseItem_AllowSetSlot() {
return UseItem_AllowSetSlot;
}
public static Boolean getUseItem_GiveOnEveryJoin() {
return UseItem_GiveOnEveryJoin;
}
public static Boolean getUseItem_GiveOnlyOnFirstJoin() {
return UseItem_GiveOnlyOnFirstJoin;
}
public static Boolean getUseItem_ServerChange() {
return UseItem_ServerChange;
}
public static Boolean getCursor_ToGUIItem_OnLogin() {
return Cursor_ToGUIItem_OnLogin;
}
public static Boolean getCursor_ToGUIItem_OnlyOnFirstLogin() {
return Cursor_ToGUIItem_OnlyOnFirstLogin;
}
public static Boolean getUseItem_BlockMoveAndDrop() {
return UseItem_BlockMoveAndDrop;
}
public static String getUseItem_OpenGUI() {
return UseItem_OpenGUI;
}
public static Boolean getUseItem_Permission() {
return UseItem_Permission;
}
public static Boolean getUseItem_KeepAtCommandClear() {
return UseItem_KeepAtCommandClear;
}
public static Boolean getUseItemGameModeChangeEnable() {
return UseItemGameModeChangeEnable;
}
public static int getUseItemGameModeChangeDelayInTicks() {
return UseItemGameModeChangeDelayInTicks;
}
public static Boolean getUseItemGameModeProtection() {
return UseItemGameModeProtection;
}
public static Boolean getUseItemGameModeRemoveItemWhenItIsDisabled() {
return UseItemGameModeRemoveItemWhenItIsDisabled;
}
public static String getUseItemGameModeMode() {
return UseItemGameModeMode;
}
public static List<String> getUseItemGameModeList() {
return UseItemGameModeList;
}
public static Boolean getUseItemWorldChangeEnable() {
return UseItemWorldChangeEnable;
}
public static int getUseItemWorldChangeDelayInTicks() {
return UseItemWorldChangeDelayInTicks;
}
public static Boolean getUseItemWorldProtection() {
return UseItemWorldProtection;
}
public static Boolean getUseItemWorldRemoveItemWhenItIsDisabled() {
return UseItemWorldRemoveItemWhenItIsDisabled;
}
public static String getUseItemWorldMode() {
return UseItemWorldMode;
}
public static List<String> getUseItemWorldList() {
return UseItemWorldList;
}
public static List<String> getUseItemItemBlockBlacklist() {
return UseItemItemBlockBlacklist;
}
public static Boolean getDisableInfoBySneak() {
return disableInfoBySneak;
}
public static Boolean getUseItem_InventorySlot_FreeSlot() {
return UseItem_InventorySlot_FreeSlot;
}
public static Integer getUseItem_InventorySlot() {
return UseItem_InventorySlot;
}
public static Boolean getUseItem_InventorySlotEnforce() {
return UseItem_InventorySlotEnforce;
}
public static String getUseItem_Material() {
return UseItem_Material;
}
public static Boolean getUseItem_PlayerHead_Enable() {
return UseItem_PlayerHead_Enable;
}
public static Boolean getUseItem_Base64_Enable() {
return UseItem_Base64_Enable;
}
public static String getUseItem_Base64value() {
return UseItem_Base64value;
}
public static Boolean getUseItem_PlayerWhoHasOpenedTheGUI() {
return UseItem_PlayerWhoHasOpenedTheGUI;
}
public static String getUseItem_PlayerName() {
return UseItem_PlayerName;
}
public static String getUseItem_Name() {
return UseItem_Name;
}
public static List<String> getUseItem_Lore() {
return UseItem_Lore;
}
public static Boolean getToggleItemOnOrYesBase64() {
return toggleItemOnOrYesBase64;
}
public static String getToggleItemOnOrYesBase64Value() {
return toggleItemOnOrYesBase64Value;
}
public static String getToggleItemOnOrYesMaterial() {
return toggleItemOnOrYesMaterial;
}
public static Boolean getToggleItemOffOrNoBase64() {
return toggleItemOffOrNoBase64;
}
public static String getToggleItemOffOrNoBase64Value() {
return toggleItemOffOrNoBase64Value;
}
public static String getToggleItemOffOrNoMaterial() {
return toggleItemOffOrNoMaterial;
}
public static String getTogglePermTrue() {
return togglePermTrue;
}
public static String getTogglePermFalse() {
return togglePermFalse;
}
public static String getPlaceholderTrue() {
return placeholderTrue;
}
public static String getPlaceholderFalse() {
return placeholderFalse;
}
public static Boolean getSound_Enable() {
return Sound_Enable;
}
public static Boolean getSound_OpenInventory_Enable() {
return Sound_OpenInventory_Enable;
}
public static Sound getSound_OpenInventory() {
return Sound_OpenInventory;
}
public static String getSound_OpenInventory_input() {
return Sound_OpenInventory_input;
}
public static Boolean getSound_Click_Enable() {
return Sound_Click_Enable;
}
public static Sound getSound_Click() {
return Sound_Click;
}
public static String getSound_Click_input() {
return Sound_Click_input;
}
public static Boolean getSound_NoMoney_Enable() {
return Sound_NoMoney_Enable;
}
public static Sound getSound_NoMoney() {
return Sound_NoMoney;
}
public static String getSound_NoMoney_input() {
return Sound_NoMoney_input;
}
public static Boolean getSound_NoInventorySpace_Enable() {
return Sound_NoInventorySpace_Enable;
}
public static Sound getSound_NoInventorySpace() {
return Sound_NoInventorySpace;
}
public static String getSound_NoInventorySpace_input() {
return Sound_NoInventorySpace_input;
}
public static Boolean getSound_Give_Enable() {
return Sound_Give_Enable;
}
public static Sound getSound_Give() {
return Sound_Give;
}
public static String getSound_Give_input() {
return Sound_Give_input;
}
public static Boolean getSound_PlayerNotFound_Enable() {
return Sound_PlayerNotFound_Enable;
}
public static Sound getSound_PlayerNotFound() {
return Sound_PlayerNotFound;
}
public static String getSound_PlayerNotFound_input() {
return Sound_PlayerNotFound_input;
}
2021-12-21 04:57:29 +00:00
}