config convert

This commit is contained in:
JaTiTV 2022-12-31 01:22:40 +01:00
parent f68916ef54
commit c34c6ab09f
37 changed files with 543 additions and 401 deletions

View File

@ -1,8 +1,8 @@
package net.t2code.commandguiv2.Spigot;
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
import net.t2code.commandguiv2.Spigot.system.Load;
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
import net.t2code.commandguiv2.Spigot.database.MySQL;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
@ -39,10 +39,10 @@ public final class Main extends JavaPlugin {
public static Boolean LuckyBox = false;
public static Boolean PlugManGUI = false;
public static HashMap<String, Gui> guiHashMap = new HashMap<>();
public static HashMap<String, GuiObject> guiHashMap = new HashMap<>();
public static ArrayList<String> allAliases = new ArrayList<>();
public static HashMap<String, Function> functionHashMap = new HashMap<>();
public static HashMap<String, FunctionObject> functionHashMap = new HashMap<>();
@Override
public void onEnable() {

View File

@ -2,7 +2,6 @@ package net.t2code.commandguiv2.Spigot.cmdManagement;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
import net.t2code.commandguiv2.Spigot.config.gui.CreateGUI;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.commandguiv2.Util;

View File

@ -1,7 +1,6 @@
package net.t2code.commandguiv2.Spigot.cmdManagement;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;

View File

@ -2,19 +2,19 @@ package net.t2code.commandguiv2.Spigot.cmdManagement;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Spigot.config.config.ConfigSelect;
import net.t2code.commandguiv2.Spigot.useItem.Events;
import net.t2code.commandguiv2.Spigot.config.functions.SelectFunctions;
import net.t2code.commandguiv2.Spigot.config.gui.SelectGui;
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.objects.Obj_Select;
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
import net.t2code.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
import net.t2code.commandguiv2.Spigot.gui.OpenGUI;
import net.t2code.commandguiv2.Spigot.useItem.UseItem;
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
import net.t2code.commandguiv2.Spigot.function.gui.OpenGUI;
import net.t2code.commandguiv2.Spigot.function.useItem.UseItem;
import net.t2code.commandguiv2.Spigot.config.languages.LanguagesCreate;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.commandguiv2.Spigot.system.Permissions;
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
import net.t2code.commandguiv2.Spigot.sound.Sound;
import net.t2code.commandguiv2.Spigot.sound.PlaySound;
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
@ -24,6 +24,7 @@ import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.io.IOException;
import java.util.Objects;
public class Commands {
@ -39,7 +40,11 @@ public class Commands {
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
T2Csend.console(Util.getPrefix() + " §6Plugin reload...");
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
try {
ConfigSelect.selectConfig();
} catch (IOException e) {
throw new RuntimeException(e);
}
Main.getPlugin().reloadConfig();
CmdExecuter_GUI.arg1.clear();
@ -52,7 +57,16 @@ public class Commands {
LanguagesCreate.langCreate();
Obj_Select.onSelect();
try {
SelectFunctions.onSelectFunction();
} catch (Exception e) {
e.printStackTrace();
}
try {
SelectGui.onSelectGui();
} catch (Exception e) {
e.printStackTrace();
}
SelectMessages.onSelect(Util.getPrefix());
Config.sound();
@ -84,11 +98,11 @@ public class Commands {
if (Bukkit.getPlayer(target.getName()) != null) {
UseItem.giveUseItem(target);
T2Csend.sender(sender, SelectMessages.Give_Sender.replace("[player]", target.getName()).replace("[item]", String.valueOf(Config.useItemName.value)));
T2Csend.player(target, SelectMessages.Give_Receiver.replace("[sender]", sender.getName()).replace("[item]",String.valueOf(Config.useItemName.value)));
Sound.play(target, SoundEnum.Give);
T2Csend.player(target, SelectMessages.Give_Receiver.replace("[sender]", sender.getName()).replace("[item]", String.valueOf(Config.useItemName.value)));
PlaySound.play(target, SoundEnum.Give);
} else {
sender.sendMessage(SelectMessages.PlayerNotFond.replace("[player]", target.getName()));
if (sender instanceof Player) Sound.play((Player) sender, SoundEnum.PlayerNotFound);
if (sender instanceof Player) PlaySound.play((Player) sender, SoundEnum.PlayerNotFound);
}
}
@ -118,7 +132,7 @@ public class Commands {
T2Csend.player(player, SelectMessages.ItemON);
} else {
T2Csend.player(player, SelectMessages.NoInventorySpace);
Sound.play(player, SoundEnum.NoInventorySpace);
PlaySound.play(player, SoundEnum.NoInventorySpace);
}
}
}
@ -169,7 +183,7 @@ public class Commands {
public static void gui(Player player) {
if (Main.guiHashMap.containsKey(String.valueOf(Config.defaultGUI.value))) {
Gui gui = Main.guiHashMap.get(String.valueOf(Config.defaultGUI.value));
GuiObject gui = Main.guiHashMap.get(String.valueOf(Config.defaultGUI.value));
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) {
OpenGUI.openGUI(player, String.valueOf(Config.defaultGUI.value), true);
@ -181,7 +195,7 @@ public class Commands {
public static void gui(Player player, String arg) {
if (Main.guiHashMap.containsKey(arg)) {
Gui gui = Main.guiHashMap.get(arg);
GuiObject gui = Main.guiHashMap.get(arg);
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + gui.key) || player.hasPermission("commandgui.bypass")) {
OpenGUI.openGUI(player, arg, true);

View File

@ -3,8 +3,7 @@ package net.t2code.commandguiv2.Spigot.cmdManagement;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
@ -15,7 +14,7 @@ public class Help {
private static String prefix = Util.getPrefix();
public static void sendHelp(CommandSender sender, String Prefix) {
Gui gui = Main.guiHashMap.get(String.valueOf(Config.defaultGUI.value));
GuiObject gui = Main.guiHashMap.get(String.valueOf(Config.defaultGUI.value));
T2Csend.sender(sender, Prefix + " §8----- §4Command§9GUI §chelp §8-----");
cgui(sender, gui);
@ -30,7 +29,7 @@ public class Help {
}
private static void cgui(CommandSender sender, Gui gui) {
private static void cgui(CommandSender sender, GuiObject gui) {
if (!sender.hasPermission("commandgui.command")) return;
if (sender instanceof Player) {

View File

@ -2,8 +2,8 @@ package net.t2code.commandguiv2.Spigot.cmdManagement.register;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
import net.t2code.commandguiv2.Spigot.gui.OpenGUI;
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
import net.t2code.commandguiv2.Spigot.function.gui.OpenGUI;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.command.Command;
@ -23,7 +23,7 @@ public class RegisterCommand extends Command {
if (sender instanceof Player) {
Player player = (Player) sender;
Gui gui = Main.guiHashMap.get(alias);
GuiObject gui = Main.guiHashMap.get(alias);
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) {
OpenGUI.openGUI(player, alias, true);

View File

@ -17,111 +17,107 @@ import java.util.List;
public enum Config {
configVersion("ConfigVersion", 6, true),
debug("Plugins.Debug", false, false),
updateCheckOnJoin("Plugin.updateCheck.onJoin", true, false),
updateCheckSeePreReleaseUpdates("Plugin.updateCheck.seePreReleaseUpdates", true, false),
updateCheckTimeInterval("Plugin.updateCheck.timeInterval", 60, false),
helpAlias("Plugin.HelpAlias", true, false),
adminSubCommand("Plugin.AdminSubCommand", "admin", false),
language("Plugin.language", "english", false),
currency("Plugin.Currency", "$", false),
defaultGUI("Plugin.DefaultGUI", "default", false),
configVersion("configVersion", 6),
debug("plugins.debug", false),
updateCheckOnJoin("plugin.updateCheck.onJoin", true),
updateCheckSeePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true),
updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60),
helpAlias("plugin.helpAlias", true),
adminSubCommand("plugin.adminSubCommand", "admin"),
language("plugin.language", "english"),
currency("plugin.currency", "$"),
defaultGUI("plugin.defaultGUI", "default"),
storage("Storage.Type", StorageEnum.SQLITE.name(), false),
mysqlIp("Storage.MySQL.IP", "localhost", false),
mysqlPort("Storage.MySQL.Port", 3306, false),
mysqlDatabase("Storage.MySQL.Database", "database", false),
mysqlUser("Storage.MySQL.User", "root", false),
mysqlPassword("Storage.MySQL.Password", "password", false),
mysqlSSL("Storage.MySQL.SSL", false, false),
storage("storage.type", StorageEnum.SQLITE.name()),
mysqlIp("storage.mySQL.ip", "localhost"),
mysqlPort("storage.mySQL.port", 3306),
mysqlDatabase("storage.mySQL.database", "database"),
mysqlUser("storage.mySQL.user", "root"),
mysqlPassword("storage.mySQL.password", "password"),
mysqlSSL("storage.mySQL.ssl", false),
useItemEnable("UseItem.Enable", true, false),
useItemAllowToggle("UseItem.AllowToggle", true, false),
useItemAllowSetSlot("UseItem.AllowSetSlot", true, false),
useItemBlockMoveAndDrop("UseItem.BlockMoveAndDrop", true, false),
useItemOpenGUI("UseItem.OpenGUI", "default", false),
useItemPermission("UseItem.Permission.NeededToUse", true, false),
useItemKeepAtCommandClear("UseItem.KeepAtCommandClear", true, false),
useItemInventorySlotFreeSlot("UseItem.InventorySlot.FreeSlot", 1, false),
useItemInventorySlot("UseItem.InventorySlot.Slot", false, false),
useItemInventorySlotEnforce("UseItem.InventorySlot.SlotEnforce", false, false),
useItemMaterial("UseItem.Item.Material", "paper", false),
useItemEnable("useItem.enable", true),
useItemAllowToggle("useItem.allowToggle", true),
useItemAllowSetSlot("useItem.allowSetSlot", true),
useItemBlockMoveAndDrop("useItem.blockMoveAndDrop", true),
useItemOpenGUI("useItem.openGUI", "default"),
useItemPermission("useItem.permission.neededToUse", true),
useItemKeepAtCommandClear("useItem.keepAtCommandClear", true),
useItemInventorySlotFreeSlot("useItem.inventorySlot.freeSlot", 1),
useItemInventorySlot("useItem.inventorySlot.slot", 1),
useItemInventorySlotEnforce("useItem.inventorySlot.slotEnforce", false),
useItemMaterial("useItem.item.material", "paper"),
useItemPlayerHeadEnable("useItem.item.playerHead.enable", false),
useItemBase64Enable("useItem.item.playerHead.base64.enable", false),
useItemBase64value("useItem.item.playerHead.base64.base64Value", ""),
useItemPlayerWhoHasOpenedTheGUI("useItem.item.playerHead.playerWhoHasOpenedTheGUI", false),
useItemPlayerName("useItem.item.playerHead.playerName", ""),
useItemName("useItem.item.name", "&bDefault &6GUI"),
useItemLore("useItem.item.lore", Collections.singletonList("&eThis is an example GUI")),
useItemGiveOnEveryJoin("useItem.join.giveOnEveryJoin", true),
useItemGiveOnlyOnFirstJoin("useItem.join.giveOnlyOnFirstJoin", false),
cursorToGUIItemOnLogin("useItem.join.cursor.toGUIItem.onLogin.enable", true),
cursorToGUIItemOnlyOnFirstLogin("useItem.join.cursor.toGUIItem.spigot.onlyOnFirstLogin", true),
useItemServerChange("useItem.join.cursor.toGUIItem.bungee.onServerChange", false),
useItemPlayerHeadEnable("UseItem.Item.PlayerHead.Enable", false, false),
useItemBase64Enable("UseItem.Item.PlayerHead.Base64.Enable", false, false),
useItemBase64value("UseItem.Item.PlayerHead.Base64.Base64Value", "", false),
useItemPlayerWhoHasOpenedTheGUI("UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI", false, false),
useItemPlayerName("UseItem.Item.PlayerHead.PlayerName", "", false),
useItemName("UseItem.Item.Name", "&bDefault &6GUI", false),
useItemLore("UseItem.Item.Lore", Collections.singletonList("&eThis is an example GUI"), false),
useItemGiveOnEveryJoin("UseItem.Join.GiveOnEveryJoin", true, false),
useItemGiveOnlyOnFirstJoin("UseItem.Join.GiveOnlyOnFirstJoin", false, false),
cursorToGUIItemOnLogin("UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable", true, false),
cursorToGUIItemOnlyOnFirstLogin("UseItem.Join.Cursor.ToGUIItem.Spigot.OnlyOnFirstLogin", true, false),
useItemServerChange("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange", false, false),
toggleItemOnOrYesBase64("toggle.items.onOrYes.item.base64.enable", false),
toggleItemOnOrYesBase64Value("toggle.items.onOrYes.item.base64.base64Value", ""),
toggleItemOnOrYesMaterial("toggle.items.onOrYes.item.material", Main.legacy ? "WOOL,5" : T2CitemVersion.getGreenWool().getType().toString()),
toggleItemOffOrNoBase64("toggle.items.offOrNo.item.base64.enable", false),
toggleItemOffOrNoBase64Value("toggle.items.offOrNo.item.base64.base64Value", T2CitemVersion.getGreenWool().getType().toString()),
toggleItemOffOrNoMaterial("toggle.items.offOrNo.item.material", Main.legacy ? "WOOL,14" : T2CitemVersion.getRedWool().getType().toString()),
toggleItemOnOrYesBase64("Toggle.Items.OnOrYes.Item.Base64.Enable", false, false),
toggleItemOnOrYesBase64Value("Toggle.Items.OnOrYes.Item.Base64.Base64Value", "", false),
toggleItemOnOrYesMaterial("Toggle.Items.OnOrYes.Item.Material", Main.legacy ? "WOOL,5" : T2CitemVersion.getGreenWool().getType().toString(), false),
toggleItemOffOrNoBase64("Toggle.Items.OffOrNo.Item.Base64.Enable", false, false),
toggleItemOffOrNoBase64Value("Toggle.Items.OffOrNo.Item.Base64.Base64Value", T2CitemVersion.getGreenWool().getType().toString(), false),
toggleItemOffOrNoMaterial("Toggle.Items.OffOrNo.Item.Material", Main.legacy ? "WOOL,14" : T2CitemVersion.getRedWool().getType().toString(), false),
togglePermTrue("toggle.permission.commands.true", "luckperms user [player] permission set [perm] true"),
togglePermFalse("toggle.permission.commands.false", "luckperms user [player] permission set [perm] false"),
placeholderTrue("placeholder.True", "&2true"),
placeholderFalse("placeholder.False", "&4false"),
togglePermTrue("Toggle.Permission.Commands.True", "luckperms user [player] permission set [perm] true", false),
togglePermFalse("Toggle.Permission.Commands.False", "luckperms user [player] permission set [perm] false", false),
placeholderTrue("Placeholder.True", "&2true", false),
placeholderFalse("Placeholder.False", "&4false", false),
soundEnable("sound.enable", true),
soundOpenInventoryEnable("sound.openInventory.enable", true),
soundOpenInventoryInput("sound.openInventory.sound", getOpenInventory().toString()),
soundClickEnable("sound.click.enable", true),
soundClickInput("sound.click.sound", getClick().toString()),
soundNoMoneyEnable("sound.noMoney.enable", true),
soundNoMoneyInput("sound.noMoney.sound", getNoMoney().toString()),
soundNoInventorySpaceEnable("sound.noInventorySpace.enable", true),
soundNoInventorySpaceInput("sound.noInventorySpace.sound", getNoInventorySpace().toString()),
soundGiveEnable("sound.give.enable", true),
soundGiveInput("sound.give.sound", getGive().toString()),
soundPlayerNotFoundEnable("sound.playerNotFound.enable", true),
soundPlayerNotFoundInput("sound.playerNotFound.sound", getPlayerNotFound().toString()),
soundEnable("Sound.Enable", true, false),
soundOpenInventoryEnable("Sound.OpenInventory.Enable", true, false),
soundOpenInventoryInput("Sound.OpenInventory.Sound", getOpenInventory().toString(), false),
soundClickEnable("Sound.Click.Enable", true, false),
soundClickInput("Sound.Click.Sound", getClick().toString(), false),
soundNoMoneyEnable("Sound.NoMoney.Enable", true, false),
soundNoMoneyInput("Sound.NoMoney.Sound", getNoMoney().toString(), false),
soundNoInventorySpaceEnable("Sound.NoInventorySpace.Enable", true, false),
soundNoInventorySpaceInput("Sound.NoInventorySpace.Sound", getNoInventorySpace().toString(), false),
soundGiveEnable("Sound.Give.Enable", true, false),
soundGiveInput("Sound.Give.Sound", getGive().toString(), false),
soundPlayerNotFoundEnable("Sound.PlayerNotFound.Enable", true, false),
soundPlayerNotFoundInput("Sound.PlayerNotFound.Sound", getPlayerNotFound().toString(), false),
useItemGameModeChangeEnable("advanced.useItem.gameMode.change.enable", true),
useItemGameModeChangeDelayInTicks("advanced.useItem.gameMode.change.delayInTicks", 1),
useItemGameModeProtection("advanced.useItem.gameMode.protection.enable", false),
useItemGameModeRemoveItemWhenItIsDisabled("advanced.useItem.gameMode.protection.removeItemWhenItIsDisabled", false),
useItemGameModeMode("advanced.useItem.gameMode.protection.mode", "blacklist"),
useItemGameModeList("advanced.useItem.gameMode.protection.list", Arrays.asList("CREATIVE", "Spectator")),
useItemWorldChangeEnable("advanced.useItem.world.change.enable", true),
useItemWorldChangeDelayInTicks("advanced.useItem.world.change.delayInTicks", 1),
useItemWorldProtection("advanced.useItem.world.protection.enable", false),
useItemWorldRemoveItemWhenItIsDisabled("advanced.useItem.world.protection.removeItemWhenItIsDisabled", false),
useItemWorldMode("advanced.useItem.world.protection.mode", "blacklist"),
useItemWorldList("advanced.useItem.world.protection.list", Arrays.asList("World1", "World2")),
useItemGameModeChangeEnable("Advanced.UseItem.GameMode.Change.Enable", true, false),
useItemGameModeChangeDelayInTicks("Advanced.UseItem.GameMode.Change.DelayInTicks", 1, false),
useItemGameModeProtection("Advanced.UseItem.GameMode.Protection.Enable", false, false),
useItemGameModeRemoveItemWhenItIsDisabled("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled", false, false),
useItemGameModeMode("Advanced.UseItem.GameMode.Protection.Mode", "blacklist", false),
useItemGameModeList("Advanced.UseItem.GameMode.Protection.List", Arrays.asList("CREATIVE", "Spectator"), false),
useItemWorldChangeEnable("Advanced.UseItem.World.Change.Enable", true, false),
useItemWorldChangeDelayInTicks("Advanced.UseItem.World.Change.DelayInTicks", 1, false),
useItemWorldProtection("Advanced.UseItem.World.Protection.Enable", false, false),
useItemWorldRemoveItemWhenItIsDisabled("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled", false, false),
useItemWorldMode("Advanced.UseItem.World.Protection.Mode", "blacklist", false),
useItemWorldList("Advanced.UseItem.World.Protection.List", Arrays.asList("World1", "World2"), false),
disableInfoBySneak("Advanced.UseItem.DisableInfoBySneak", false, false),
useItemItemBlockBlacklist("Advanced.UseItem.ItemBlockBlacklist", getItemBlockBlacklist(), false);
disableInfoBySneak("advanced.useItem.disableInfoBySneak", false),
useItemItemBlockBlacklist("advanced.useItem.itemBlockBlacklist", getItemBlockBlacklist());
public final String path;
public Object value;
public final boolean forceSet;
Config(String path, Object defaultValue, boolean forceSet) {
Config(String path, Object defaultValue) {
this.path = path;
this.value = defaultValue;
this.forceSet = forceSet;
}
public static void sound() {

View File

@ -1,6 +1,8 @@
package net.t2code.commandguiv2.Spigot.config.config;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterV5;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterV6;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
@ -11,14 +13,33 @@ import java.io.IOException;
public class ConfigSelect {
public static void selectConfig() {
public static void selectConfig() throws IOException {
File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
if (yamlConfiguration.contains("ConfigVersion")) {
if (yamlConfiguration.getInt("ConfigVersion") < Util.getConfigVersion() && new File(Main.getPath(), "config.yml").exists()) {
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----------------------");
if (yamlConfiguration.getInt("ConfigVersion") < 5) {
ConfigConverterV5.convert();
selectConfig();
return;
}
if (yamlConfiguration.getInt("ConfigVersion") < 6) {
ConfigConverterV6.convert();
selectConfig();
return;
}
}
}
yamlConfiguration.set(Config.configVersion.path, Config.configVersion.value);
for (Config value : Config.values()) {
if (value.forceSet) {
yamlConfiguration.set(value.path, value.value);
} else T2Cconfig.set(value.path, value.value, yamlConfiguration);
T2Cconfig.set(value.path, value.value, yamlConfiguration);
value.value = T2Cconfig.selectObject(Util.getPrefix(), value.path, yamlConfiguration);
}

View File

@ -1,7 +1,7 @@
package net.t2code.commandguiv2.Spigot.config.config.old;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterV5;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
@ -12,7 +12,6 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class SelectConfig {
@ -27,7 +26,7 @@ public class SelectConfig {
T2Csend.console(Util.getPrefix() + " ");
T2Csend.console(Util.getPrefix() + " §4----------------------");
if (yamlConfiguration.getInt("ConfigVersion") < 5) {
ConfigConverterUnderV5.convert();
ConfigConverterV5.convert();
}
}

View File

@ -1,10 +0,0 @@
package net.t2code.commandguiv2.Spigot.config.configConverter;
public class ConfigConverterUnderV6 {
}

View File

@ -1,6 +1,7 @@
package net.t2code.commandguiv2.Spigot.config.configConverter;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Spigot.config.functions.CreateFunctions;
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
@ -15,7 +16,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.List;
public class ConfigConverterUnderV5 {
public class ConfigConverterV5 {
public static void renameMainFolder() {
if (new File("plugins/CommandGUI").exists() && !Main.getPath().exists()) {
File oldF = new File("plugins/CommandGUI");
@ -77,6 +78,8 @@ public class ConfigConverterUnderV5 {
File config = new File(Main.getPath(), "GUIs/" + configOld.getName().replace(".yml", "") + ".yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
yamlConfiguration.set(Config.configVersion.path, 5);
Boolean enable = yamlConfigurationOld.getBoolean("GUI.Enable");
Integer lines = yamlConfigurationOld.getInt("GUI.Lines");

View File

@ -0,0 +1,119 @@
package net.t2code.commandguiv2.Spigot.config.configConverter;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
public class ConfigConverterV6 {
private static final File configOld = new File(Main.getPath(), "config.yml");
private static final YamlConfiguration yamlConfigurationOld = YamlConfiguration.loadConfiguration(configOld);
public static void convert() throws IOException {
set(Config.debug, "Plugin.Debug");
set(Config.updateCheckOnJoin, "Plugin.updateCheck.onJoin");
set(Config.updateCheckSeePreReleaseUpdates , "Plugin.updateCheck.seePreReleaseUpdates");
set(Config.updateCheckTimeInterval , "Plugin.updateCheck.timeInterval");
set(Config.helpAlias , "Plugin.HelpAlias");
set(Config.adminSubCommand , "Plugin.AdminSubCommand");
set(Config. language, "Plugin.language");
set(Config. currency, "Plugin.Currency");
set(Config.defaultGUI , "Plugin.DefaultGUI");
set(Config.storage , "Storage.Type");
set(Config. mysqlIp, "Storage.MySQL.IP");
set(Config. mysqlPort, "Storage.MySQL.Port");
set(Config.mysqlDatabase , "Storage.MySQL.Database");
set(Config. mysqlUser, "Storage.MySQL.User");
set(Config. mysqlPassword, "Storage.MySQL.Password");
set(Config. mysqlSSL, "Storage.MySQL.SSL");
set(Config. useItemEnable, "UseItem.Enable");
set(Config.useItemAllowToggle , "UseItem.AllowToggle");
set(Config.useItemAllowSetSlot , "UseItem.AllowSetSlot");
set(Config. useItemBlockMoveAndDrop, "UseItem.BlockMoveAndDrop");
set(Config. useItemOpenGUI, "UseItem.OpenGUI");
set(Config. useItemPermission, "UseItem.Permission.NeededToUse");
set(Config. useItemKeepAtCommandClear, "UseItem.KeepAtCommandClear");
set(Config. useItemInventorySlotFreeSlot, "UseItem.InventorySlot.FreeSlot");
set(Config. useItemInventorySlot, "UseItem.InventorySlot.Slot");
set(Config.useItemInventorySlotEnforce , "UseItem.InventorySlot.SlotEnforce");
set(Config.useItemMaterial , "UseItem.Item.Material");
set(Config.useItemPlayerHeadEnable , "UseItem.Item.PlayerHead.Enable");
set(Config. useItemBase64Enable, "UseItem.Item.PlayerHead.Base64.Enable");
set(Config.useItemBase64value , "UseItem.Item.PlayerHead.Base64.Base64Value");
set(Config.useItemPlayerWhoHasOpenedTheGUI , "UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI");
set(Config. useItemPlayerName, "UseItem.Item.PlayerHead.PlayerName");
set(Config. useItemName, "UseItem.Item.Name");
set(Config.useItemLore , "UseItem.Item.Lore");
set(Config. useItemGiveOnEveryJoin, "UseItem.Join.GiveOnEveryJoin");
set(Config. useItemGiveOnlyOnFirstJoin, "UseItem.Join.GiveOnlyOnFirstJoin");
set(Config. cursorToGUIItemOnLogin, "UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable");
set(Config. cursorToGUIItemOnlyOnFirstLogin, "UseItem.Join.Cursor.ToGUIItem.Spigot.OnlyOnFirstLogin");
set(Config. useItemServerChange, "UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange");
set(Config. toggleItemOnOrYesBase64, "Toggle.Items.OnOrYes.Item.Base64.Enable");
set(Config.toggleItemOnOrYesBase64Value , "Toggle.Items.OnOrYes.Item.Base64.Base64Value");
set(Config.toggleItemOnOrYesMaterial , "Toggle.Items.OnOrYes.Item.Material");
set(Config.toggleItemOffOrNoBase64 , "Toggle.Items.OffOrNo.Item.Base64.Enable");
set(Config. toggleItemOffOrNoBase64Value, "Toggle.Items.OffOrNo.Item.Base64.Base64Value");
set(Config.toggleItemOffOrNoMaterial , "Toggle.Items.OffOrNo.Item.Material");
set(Config.togglePermTrue , "Toggle.Permission.Commands.True");
set(Config.togglePermFalse , "Toggle.Permission.Commands.False");
set(Config. placeholderTrue, "Placeholder.True");
set(Config. placeholderFalse, "Placeholder.False");
set(Config. soundEnable, "Sound.Enable");
set(Config. soundOpenInventoryEnable, "Sound.OpenInventory.Enable");
set(Config. soundOpenInventoryInput, "Sound.OpenInventory.Sound");
set(Config. soundClickEnable, "Sound.Click.Enable");
set(Config. soundClickInput, "Sound.Click.Sound");
set(Config.soundNoMoneyEnable , "Sound.NoMoney.Enable");
set(Config.soundNoMoneyInput , "Sound.NoMoney.Sound");
set(Config. soundNoInventorySpaceEnable, "Sound.NoInventorySpace.Enable");
set(Config.soundNoInventorySpaceInput , "Sound.NoInventorySpace.Sound");
set(Config.soundGiveEnable , "Sound.Give.Enable");
set(Config.soundGiveInput , "Sound.Give.Sound");
set(Config. soundPlayerNotFoundEnable, "Sound.PlayerNotFound.Enable");
set(Config. soundPlayerNotFoundInput, "Sound.PlayerNotFound.Sound");
set(Config. useItemGameModeChangeEnable, "Advanced.UseItem.GameMode.Change.Enable");
set(Config. useItemGameModeChangeDelayInTicks, "Advanced.UseItem.GameMode.Change.DelayInTicks");
set(Config. useItemGameModeProtection, "Advanced.UseItem.GameMode.Protection.Enable");
set(Config.useItemGameModeRemoveItemWhenItIsDisabled , "Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled");
set(Config. useItemGameModeMode, "Advanced.UseItem.GameMode.Protection.Mode");
set(Config.useItemGameModeList , "Advanced.UseItem.GameMode.Protection.List");
set(Config.useItemWorldChangeEnable , "Advanced.UseItem.World.Change.Enable");
set(Config.useItemWorldChangeDelayInTicks , "Advanced.UseItem.World.Change.DelayInTicks");
set(Config.useItemWorldProtection , "Advanced.UseItem.World.Protection.Enable");
set(Config.useItemWorldRemoveItemWhenItIsDisabled , "Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled");
set(Config. useItemWorldMode, "Advanced.UseItem.World.Protection.Mode");
set(Config. useItemWorldList, "Advanced.UseItem.World.Protection.List");
set(Config.disableInfoBySneak , "Advanced.UseItem.DisableInfoBySneak");
set(Config.useItemItemBlockBlacklist , "Advanced.UseItem.ItemBlockBlacklist");
configOld.renameTo(new File(Main.getPath(), "configV5.yml"));
}
private static void set(Config obj, String path) {
if (!yamlConfigurationOld.contains(path)) return;
obj.value = yamlConfigurationOld.get(path);
}
}

View File

@ -1,100 +1,19 @@
package net.t2code.commandguiv2.Spigot.objects;
package net.t2code.commandguiv2.Spigot.config.functions;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterV5;
import net.t2code.commandguiv2.Spigot.enums.EcoEnum;
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class Obj_Select {
public static void onSelect() {
onSelectFunction();
onSelectGui();
}
public static void onSelectGui() {
Main.guiHashMap.clear();
Main.allAliases.clear();
File f = new File(Main.getPath() + "/GUIs/");
File[] fileArray = f.listFiles();
for (File config : fileArray) {
try {
if (config.getName().equals("guiDeclaration.yml")) continue;
String sub = config.getName().substring(config.getName().length() - 4);
if (sub.equals(".yml")) {
String key = config.getName().replace(".yml", "");
Main.allAliases.add(key);
YamlConfiguration yamlConfiguration_gui = YamlConfiguration.loadConfiguration(config);
Boolean guiEnable = yamlConfiguration_gui.getBoolean("GUI.Enable");
Integer guiLines = yamlConfiguration_gui.getInt("GUI.Lines");
if (yamlConfiguration_gui.getInt("GUI.Lines") > 6) {
yamlConfiguration_gui.set("GUI.Lines", 6);
}
if (yamlConfiguration_gui.getInt("GUI.Lines") < 1) {
yamlConfiguration_gui.set("GUI.Lines", 1);
}
String guiName = yamlConfiguration_gui.getString("GUI.Name");
Boolean guiFillItemEnable = yamlConfiguration_gui.getBoolean("GUI.FillItem.Enable");
String guiFillItemItem;
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.GlassPaneColor");
} else guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.Item");
Boolean commandAliasEnable = yamlConfiguration_gui.getBoolean("Command.Alias");
Boolean commandPermission = yamlConfiguration_gui.getBoolean("Command.Permission.Required");
ArrayList<Slot> slots = new ArrayList<>();
for (String slotKey : yamlConfiguration_gui.getConfigurationSection("Slots").getKeys(false)) {
Integer slotNumber = yamlConfiguration_gui.getInt("Slots." + slotKey + ".Slot") - 1;
Boolean enable = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Enable");
String function = yamlConfiguration_gui.getString("Slots." + slotKey + ".Function");
Function functionCheck = Main.functionHashMap.get(function);
if (functionCheck == null) {
T2Csend.error(Main.getPlugin(), "The Function " + function + " in the GUI " + key + " does not exist!");
}
Boolean permRequired = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Permission.Required");
String permSee = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.See");
String permUse = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.Use");
Slot slot = new Slot(slotNumber, enable, function, permRequired,
permSee.replace("[function]", key).replace("[slot]", String.valueOf(slotNumber + 1))
.replace("[slotname]", slotKey.toLowerCase()),
permUse.replace("[function]", key).replace("[slot]", String.valueOf(slotNumber + 1))
.replace("[slotname]", slotKey.toLowerCase()));
slots.add(slot);
}
Gui gui = new Gui(guiEnable, guiLines, guiName, guiFillItemEnable, guiFillItemItem,
key, commandAliasEnable, commandPermission, slots);
Main.guiHashMap.put(key, gui);
CmdExecuter_GUI.arg1.put(config.getName()
.replace(".yml", ""), "commandgui.gui." + key);
yamlConfiguration_gui.save(config);
}
} catch (Exception e) {
Main.sendTryCatch(Obj_Select.class, e.getStackTrace()[0]);
e.printStackTrace();
}
}
}
public class SelectFunctions {
public static void onSelectFunction() {
Main.functionHashMap.clear();
File f = new File(Main.getPath() + "/Functions/");
@ -118,7 +37,7 @@ public class Obj_Select {
String name = yamlConfiguration.getString("Slots.Function.Item.Name");
List<String> lore = yamlConfiguration.getStringList("Slots.Function.Item.Lore");
if (yamlConfiguration.get("Slots.Function.NoPermission") == null) {
ConfigConverterUnderV5.noPermLore(yamlConfiguration, config);
ConfigConverterV5.noPermLore(yamlConfiguration, config);
}
Boolean noPermMessageEnable = yamlConfiguration.getBoolean("Slots.Function.NoPermission.Message.Enable");
String customNoPermMessage = yamlConfiguration.getString("Slots.Function.NoPermission.Message.CustomNoPermMessage");
@ -200,7 +119,7 @@ public class Obj_Select {
}
String functionItemItem = yamlConfiguration.getString("Slots.Function.FunctionItem.Item");
Function function = new Function(key, empty, itemAmount, playerHead_Enable, base64_Enable, base64Value, playerWhoHasOpenedTheGUI, playerName, item, name, lore,
FunctionObject function = new FunctionObject(key, empty, itemAmount, playerHead_Enable, base64_Enable, base64Value, playerWhoHasOpenedTheGUI, playerName, item, name, lore,
noPermMessageEnable, customNoPermMessage, noPermLoreEnable, noPermLore,
customSound_Enable, customSound_NoSound, customSound_Sound, cost_Enable, ecoModule, ecoItem, votePoints, price, command_Enable, command_BungeeCommand,
commandAsConsole, command, serverChange, serverChangeServer, openGUI_Enable, openGUI, togglePermission, togglePermissionPerm, toggleUseItem, message_Enable,
@ -218,4 +137,5 @@ public class Obj_Select {
}
}
}
}

View File

@ -0,0 +1,88 @@
package net.t2code.commandguiv2.Spigot.config.gui;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.util.ArrayList;
public class SelectGui {
public static void onSelectGui() {
Main.guiHashMap.clear();
Main.allAliases.clear();
File f = new File(Main.getPath() + "/GUIs/");
File[] fileArray = f.listFiles();
for (File config : fileArray) {
try {
if (config.getName().equals("guiDeclaration.yml")) continue;
String sub = config.getName().substring(config.getName().length() - 4);
if (sub.equals(".yml")) {
String key = config.getName().replace(".yml", "");
Main.allAliases.add(key);
YamlConfiguration yamlConfiguration_gui = YamlConfiguration.loadConfiguration(config);
Boolean guiEnable = yamlConfiguration_gui.getBoolean("GUI.Enable");
Integer guiLines = yamlConfiguration_gui.getInt("GUI.Lines");
if (yamlConfiguration_gui.getInt("GUI.Lines") > 6) {
yamlConfiguration_gui.set("GUI.Lines", 6);
}
if (yamlConfiguration_gui.getInt("GUI.Lines") < 1) {
yamlConfiguration_gui.set("GUI.Lines", 1);
}
String guiName = yamlConfiguration_gui.getString("GUI.Name");
Boolean guiFillItemEnable = yamlConfiguration_gui.getBoolean("GUI.FillItem.Enable");
String guiFillItemItem;
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.GlassPaneColor");
} else guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.Item");
Boolean commandAliasEnable = yamlConfiguration_gui.getBoolean("Command.Alias");
Boolean commandPermission = yamlConfiguration_gui.getBoolean("Command.Permission.Required");
ArrayList<SlotObject> slots = new ArrayList<>();
for (String slotKey : yamlConfiguration_gui.getConfigurationSection("Slots").getKeys(false)) {
Integer slotNumber = yamlConfiguration_gui.getInt("Slots." + slotKey + ".Slot") - 1;
Boolean enable = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Enable");
String function = yamlConfiguration_gui.getString("Slots." + slotKey + ".Function");
FunctionObject functionCheck = Main.functionHashMap.get(function);
if (functionCheck == null) {
T2Csend.error(Main.getPlugin(), "The Function " + function + " in the GUI " + key + " does not exist!");
}
Boolean permRequired = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Permission.Required");
String permSee = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.See");
String permUse = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.Use");
SlotObject slot = new SlotObject(slotNumber, enable, function, permRequired,
permSee.replace("[function]", key).replace("[slot]", String.valueOf(slotNumber + 1))
.replace("[slotname]", slotKey.toLowerCase()),
permUse.replace("[function]", key).replace("[slot]", String.valueOf(slotNumber + 1))
.replace("[slotname]", slotKey.toLowerCase()));
slots.add(slot);
}
GuiObject gui = new GuiObject(guiEnable, guiLines, guiName, guiFillItemEnable, guiFillItemItem,
key, commandAliasEnable, commandPermission, slots);
Main.guiHashMap.put(key, gui);
CmdExecuter_GUI.arg1.put(config.getName()
.replace(".yml", ""), "commandgui.gui." + key);
yamlConfiguration_gui.save(config);
}
} catch (Exception e) {
Main.sendTryCatch(SelectGui.class, e.getStackTrace()[0]);
e.printStackTrace();
}
}
}
}

View File

@ -2,7 +2,6 @@ package net.t2code.commandguiv2.Spigot.config.languages;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;

View File

@ -4,7 +4,6 @@ import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;

View File

@ -1,6 +1,6 @@
package net.t2code.commandguiv2.Spigot.database;
import net.t2code.commandguiv2.Spigot.useItem.Events;
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.enums.StorageEnum;
import org.bukkit.entity.Player;

View File

@ -1,7 +1,6 @@
package net.t2code.commandguiv2.Spigot.database;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.objects.Obj_Select;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
@ -35,12 +34,12 @@ public class YML {
try {
yamlConfigurationStorage.save(storage);
} catch (IOException e) {
Main.sendTryCatch(Obj_Select.class, e.getStackTrace()[0]);
Main.sendTryCatch(YML.class, e.getStackTrace()[0]);
e.printStackTrace();
}
}
public static Boolean selectGuiitemOn(Player player){
public static Boolean selectGuiitemOn(Player player) {
if (!yamlConfigurationStorage.contains(String.valueOf(player.getUniqueId()))) return true;
return yamlConfigurationStorage.getBoolean(player.getUniqueId() + ".Status");
}

View File

@ -1,18 +1,17 @@
package net.t2code.commandguiv2.Spigot.gui;
package net.t2code.commandguiv2.Spigot.function.gui;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Spigot.listener.ServerChange;
import net.t2code.commandguiv2.Spigot.useItem.Events;
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
import net.t2code.commandguiv2.Spigot.function.listener.ServerChange;
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
import net.t2code.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
import net.t2code.commandguiv2.Spigot.function.listener.Bungee_Sender_Reciver;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.system.Placeholder;
import net.t2code.commandguiv2.Spigot.sound.Sound;
import net.t2code.commandguiv2.Spigot.sound.PlaySound;
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.eco.T2Ceco;
@ -31,7 +30,6 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.checkerframework.checker.units.qual.C;
import java.io.File;
import java.io.IOException;
@ -47,23 +45,23 @@ public class GUIListener implements Listener {
Player player = (Player) e.getWhoClicked();
if (e.getInventory() == null) return;
if (e.getCurrentItem() == null) return;
for (Gui gui : Main.guiHashMap.values()) {
for (GuiObject gui : Main.guiHashMap.values()) {
if (player.getOpenInventory().getTitle().equals(T2Creplace.replace(prefix, GUICode + gui.guiName))
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(T2Creplace.replace(prefix, player, GUICode + gui.guiName)))) {
e.setCancelled(true);
if (player.getOpenInventory().getTopInventory() != e.getClickedInventory()) {
continue;
}
for (Slot slot : gui.slots) {
for (SlotObject slot : gui.slots) {
execute(e, slot, player, gui);
}
}
}
}
private static void execute(InventoryClickEvent e, Slot slot, Player player, Gui gui) {
private static void execute(InventoryClickEvent e, SlotObject slot, Player player, GuiObject gui) {
if (e.getSlot() != slot.slot) return;
Function function = Main.functionHashMap.get(slot.function);
FunctionObject function = Main.functionHashMap.get(slot.function);
if (slot.permission && !player.hasPermission(slot.permissionToSee)) return;
if (slot.permission && !player.hasPermission(slot.permissionToUse)) {
if (function.noPermMessageEnable) {
@ -90,7 +88,7 @@ public class GUIListener implements Listener {
}
}
private static boolean functions(Function function) {
private static boolean functions(FunctionObject function) {
if (function.togglePermission) return true;
if (function.toggleUseItem) return true;
if (function.command_Enable) return true;
@ -102,7 +100,7 @@ public class GUIListener implements Listener {
return function.functionItem;
}
private static void execute(Function function, Slot slot, Player player, InventoryClickEvent e, Gui gui) {
private static void execute(FunctionObject function, SlotObject slot, Player player, InventoryClickEvent e, GuiObject gui) {
if (function.togglePermission) togglePerm(function, gui, player);
if (function.toggleUseItem) toggleUseItem(player, gui);
if (function.command_Enable) command(function, player);
@ -112,10 +110,10 @@ public class GUIListener implements Listener {
if (function.setConfigEnable) setConfig(function, player, e);
if (function.functionVotePoints) votePoints(e, function, player);
if (function.functionItem) item(function, player);
Sound.play(player, SoundEnum.Click, function, slot, gui);
PlaySound.play(player, SoundEnum.Click, function, slot, gui);
}
private static void command(Function slot, Player player) {
private static void command(FunctionObject slot, Player player) {
player.closeInventory();
new BukkitRunnable() {
@Override
@ -140,7 +138,7 @@ public class GUIListener implements Listener {
}.runTaskLater(plugin, 2L);
}
private static void openGUI(Function slot, Player player) {
private static void openGUI(FunctionObject slot, Player player) {
player.closeInventory();
new BukkitRunnable() {
@Override
@ -150,7 +148,7 @@ public class GUIListener implements Listener {
}.runTaskLater(plugin, 1L);
}
private static void message(Function slot, Player player) {
private static void message(FunctionObject slot, Player player) {
player.closeInventory();
for (String msg : slot.message) {
if (Main.PaPi) {
@ -165,7 +163,7 @@ public class GUIListener implements Listener {
}
}
private static void serverChange(Function slot, Player player) {
private static void serverChange(FunctionObject slot, Player player) {
new BukkitRunnable() {
@Override
public void run() {
@ -181,7 +179,7 @@ public class GUIListener implements Listener {
}.runTaskLater(Main.getPlugin(), 20L);
}
private static void setConfig(Function slot, Player player, InventoryClickEvent e) {
private static void setConfig(FunctionObject slot, Player player, InventoryClickEvent e) {
File config = new File(slot.configFilePath);
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
@ -247,7 +245,7 @@ public class GUIListener implements Listener {
}.runTaskLater(plugin, 1L);
}
private static void togglePerm(Function function, Gui gui, Player player) {
private static void togglePerm(FunctionObject function, GuiObject gui, Player player) {
if (player.hasPermission(function.togglePermissionPerm)) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), String.valueOf(Config.togglePermFalse.value).replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
new BukkitRunnable() {
@ -268,7 +266,7 @@ public class GUIListener implements Listener {
}.runTaskLater(plugin, 4L);
}
private static void toggleUseItem(Player player, Gui gui) {
private static void toggleUseItem(Player player, GuiObject gui) {
if (Events.useItemHashMap.get(player.getName())) {
Commands.itemOff(player);
} else {
@ -283,7 +281,7 @@ public class GUIListener implements Listener {
}.runTaskLater(plugin, 2L);
}
private static void votePoints(InventoryClickEvent e, Function function, Player player) {
private static void votePoints(InventoryClickEvent e, FunctionObject function, Player player) {
player.closeInventory();
switch (function.functionVotePointsMode) {
case ADD:
@ -298,7 +296,7 @@ public class GUIListener implements Listener {
}
}
private static void item(Function function, Player player) {
private static void item(FunctionObject function, Player player) {
String[] item = function.functionItemItem.split(";");
player.closeInventory();
switch (function.functionItemMode) {
@ -315,7 +313,7 @@ public class GUIListener implements Listener {
}
}
private static void eco(InventoryClickEvent e, Slot slot, Player player, Gui gui, Function function) {
private static void eco(InventoryClickEvent e, SlotObject slot, Player player, GuiObject gui, FunctionObject function) {
switch (function.ecoModule) {
case ITEM:
String[] item = function.ecoItem.split(";");
@ -327,7 +325,7 @@ public class GUIListener implements Listener {
}
}.runTaskLater(plugin, 1L);
T2Csend.player(player, SelectMessages.noMoneyItem.replace("[item]", item[0]).replace("[amount]", item[1]));
Sound.play(player, SoundEnum.NoMoney);
PlaySound.play(player, SoundEnum.NoMoney);
} else {
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
.replace("[price]", item[1] + " " + item[0]));
@ -343,7 +341,7 @@ public class GUIListener implements Listener {
}
}.runTaskLater(plugin, 1L);
T2Csend.player(player, SelectMessages.noMoneyVote.replace("[amount]", function.votePoints.toString()));
Sound.play(player, SoundEnum.NoMoney);
PlaySound.play(player, SoundEnum.NoMoney);
} else {
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
.replace("[price]", function.votePoints + " VotePoints"));
@ -360,7 +358,7 @@ public class GUIListener implements Listener {
}
}.runTaskLater(plugin, 1L);
T2Csend.player(player, T2Creplace.replacePrice(prefix, SelectMessages.noMoney, String.valueOf(function.price)));
Sound.play(player, SoundEnum.NoMoney);
PlaySound.play(player, SoundEnum.NoMoney);
} else {
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
.replace("[price]", function.price + " " + Config.currency.value));

View File

@ -1,13 +1,12 @@
package net.t2code.commandguiv2.Spigot.gui;
package net.t2code.commandguiv2.Spigot.function.gui;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
import net.t2code.commandguiv2.Spigot.system.Placeholder;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
@ -27,8 +26,8 @@ public class GuiBuilder {
private static String prefix = Util.getPrefix();
protected static void item(Slot slot, Player player, Inventory inventory) {
Function function = Main.functionHashMap.get(slot.function);
protected static void item(SlotObject slot, Player player, Inventory inventory) {
FunctionObject function = Main.functionHashMap.get(slot.function);
ItemStack item;
if (Main.legacy && function.item.toUpperCase().contains(",")) {
String[] split = function.item.toUpperCase().split(",");
@ -45,8 +44,8 @@ public class GuiBuilder {
inventory.setItem(slot.slot, item);
}
protected static void item(String material, Slot slot, Player player, Inventory inventory) {
Function function = Main.functionHashMap.get(slot.function);
protected static void item(String material, SlotObject slot, Player player, Inventory inventory) {
FunctionObject function = Main.functionHashMap.get(slot.function);
ItemStack item;
if (Main.legacy && material.contains(",")) {
String[] split = material.split(",");
@ -64,8 +63,8 @@ public class GuiBuilder {
}
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, Slot slot) {
Function function = Main.functionHashMap.get(slot.function);
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, SlotObject slot) {
FunctionObject function = Main.functionHashMap.get(slot.function);
if (Main.PaPi) {
itemMeta.setDisplayName(T2Creplace.replace(prefix, player, Placeholder.replace(function.name, player)));
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
@ -79,8 +78,8 @@ public class GuiBuilder {
}
}
protected static void base64(String base64Value, Slot slot, Player player, Inventory inventory) {
Function function = Main.functionHashMap.get(slot.function);
protected static void base64(String base64Value, SlotObject slot, Player player, Inventory inventory) {
FunctionObject function = Main.functionHashMap.get(slot.function);
ItemStack item = T2CitemVersion.getHeadIS();
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
setBase64(itemMeta, base64Value);
@ -107,13 +106,13 @@ public class GuiBuilder {
}
}
protected static void base64(Slot slot, Player player, Inventory inventory) {
Function function = Main.functionHashMap.get(slot.function);
protected static void base64(SlotObject slot, Player player, Inventory inventory) {
FunctionObject function = Main.functionHashMap.get(slot.function);
base64(function.base64Value, slot, player, inventory);
}
protected static void playerHead(Slot slot, Player player, Inventory inventory, String skullName) {
Function function = Main.functionHashMap.get(slot.function);
protected static void playerHead(SlotObject slot, Player player, Inventory inventory, String skullName) {
FunctionObject function = Main.functionHashMap.get(slot.function);
ItemStack item = T2CitemVersion.getHeadIS();
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
setDisplayNameAndLore(itemMeta, player, slot);
@ -127,7 +126,7 @@ public class GuiBuilder {
inventory.setItem(slot.slot, item);
}
public static void fillItem(Inventory inventory, Gui gui) {
public static void fillItem(Inventory inventory, GuiObject gui) {
ItemStack glass;
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
glass = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, Short.parseShort(gui.guiFillItemItem));

View File

@ -1,15 +1,14 @@
package net.t2code.commandguiv2.Spigot.gui;
package net.t2code.commandguiv2.Spigot.function.gui;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Spigot.system.Permissions;
import net.t2code.commandguiv2.Spigot.useItem.Events;
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
import net.t2code.commandguiv2.Spigot.sound.Sound;
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
import net.t2code.commandguiv2.Spigot.sound.PlaySound;
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
import net.t2code.commandguiv2.Util;
import io.github.solyze.plugmangui.inventories.PluginListGUI;
@ -30,7 +29,7 @@ public class OpenGUI {
private static String prefix = Util.getPrefix();
public static void openGUI(Player player, String guiString, Boolean sound) {
Gui gui = Main.guiHashMap.get(guiString);
GuiObject gui = Main.guiHashMap.get(guiString);
Long long_ = Long.valueOf(System.currentTimeMillis());
switch (guiString) {
//case "plugin.PlotSquaredGUI":
@ -77,9 +76,9 @@ public class OpenGUI {
if (gui.guiFillItemEnable) {
GuiBuilder.fillItem(inventory, gui);
}
for (Slot slot : gui.slots) {
for (SlotObject slot : gui.slots) {
try {
Function function = Main.functionHashMap.get(slot.function);
FunctionObject function = Main.functionHashMap.get(slot.function);
if (function == null) {
T2Csend.error(Main.getPlugin(), "The Function " + slot.function + " in the GUI " + gui.key + " does not exist!");
continue;
@ -129,20 +128,20 @@ public class OpenGUI {
}
if (sound) {
Sound.play(player, SoundEnum.OpenInventory);
PlaySound.play(player, SoundEnum.OpenInventory);
}
player.openInventory(inventory);
T2Csend.debug(plugin, "§6" + player.getName() + " §5Open §6" + T2Creplace.replace(prefix, gui.guiName) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
} else T2Csend.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", T2Creplace.replace(prefix, gui.guiName)));
}
private static void toggleOn(Function function, Slot slot, Player player, Inventory inventory) {
private static void toggleOn(FunctionObject function, SlotObject slot, Player player, Inventory inventory) {
if ((Boolean) Config.toggleItemOnOrYesBase64.value) {
GuiBuilder.base64(String.valueOf( Config.toggleItemOnOrYesBase64Value.value), slot, player, inventory);
} else GuiBuilder.item(String.valueOf(Config.toggleItemOnOrYesMaterial.value), slot, player, inventory);
}
private static void toggleOff(Function function, Slot slot, Player player, Inventory inventory) {
private static void toggleOff(FunctionObject function, SlotObject slot, Player player, Inventory inventory) {
if ((Boolean) Config.toggleItemOffOrNoBase64.value) {
GuiBuilder.base64(String.valueOf( Config.toggleItemOffOrNoBase64Value.value), slot, player, inventory);
} else GuiBuilder.item(String.valueOf(Config.toggleItemOffOrNoMaterial.value), slot, player, inventory);

View File

@ -1,4 +1,4 @@
package net.t2code.commandguiv2.Spigot.listener;
package net.t2code.commandguiv2.Spigot.function.listener;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;

View File

@ -1,6 +1,6 @@
// This claas was created by JaTiTV
package net.t2code.commandguiv2.Spigot.listener;
package net.t2code.commandguiv2.Spigot.function.listener;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;

View File

@ -1,4 +1,4 @@
package net.t2code.commandguiv2.Spigot.listener;
package net.t2code.commandguiv2.Spigot.function.listener;
import net.t2code.commandguiv2.Spigot.Main;
import org.bukkit.entity.Player;

View File

@ -1,10 +1,10 @@
package net.t2code.commandguiv2.Spigot.useItem;
package net.t2code.commandguiv2.Spigot.function.useItem;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.commandguiv2.Spigot.gui.OpenGUI;
import net.t2code.commandguiv2.Spigot.function.gui.OpenGUI;
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
import net.t2code.commandguiv2.api.CGuiAPI;
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;

View File

@ -1,4 +1,4 @@
package net.t2code.commandguiv2.Spigot.useItem;
package net.t2code.commandguiv2.Spigot.function.useItem;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import org.bukkit.entity.Player;

View File

@ -1,4 +1,4 @@
package net.t2code.commandguiv2.Spigot.useItem;
package net.t2code.commandguiv2.Spigot.function.useItem;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.config.Config;

View File

@ -1,4 +1,4 @@
package net.t2code.commandguiv2.Spigot.useItem;
package net.t2code.commandguiv2.Spigot.function.useItem;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;

View File

@ -1,4 +1,4 @@
package net.t2code.commandguiv2.Spigot.objects.functions;
package net.t2code.commandguiv2.Spigot.objects;
import net.t2code.commandguiv2.Spigot.enums.EcoEnum;
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
@ -6,7 +6,7 @@ import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
import java.util.List;
public class Function {
public class FunctionObject {
public String key;
public Boolean empty;
@ -71,7 +71,7 @@ public class Function {
public FunctionItemEnum functionItemMode;
public String functionItemItem;
public Function(String key,
public FunctionObject(String key,
Boolean empty,
Integer itemAmount,
Boolean playerHead_Enable,

View File

@ -1,10 +1,8 @@
package net.t2code.commandguiv2.Spigot.objects.guis;
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
package net.t2code.commandguiv2.Spigot.objects;
import java.util.ArrayList;
public class Gui {
public class GuiObject {
public Boolean guiEnable;
public Integer guiLines;
public String guiName;
@ -14,10 +12,10 @@ public class Gui {
public String key;
public Boolean commandAliasEnable;
public Boolean commandPermissionEnable;
public ArrayList<Slot> slots;
public ArrayList<SlotObject> slots;
public Gui(Boolean guiEnable, Integer guiLines, String guiName, Boolean guiFillitemEnable, String guiFillitemItem,
String commandCommand, Boolean commandAliasEnable, Boolean commandPermissionEnable, ArrayList<Slot> slots){
public GuiObject(Boolean guiEnable, Integer guiLines, String guiName, Boolean guiFillitemEnable, String guiFillitemItem,
String commandCommand, Boolean commandAliasEnable, Boolean commandPermissionEnable, ArrayList<SlotObject> slots){
this.guiEnable = guiEnable;
this.guiLines = guiLines;
this.guiName = guiName;

View File

@ -1,6 +1,6 @@
package net.t2code.commandguiv2.Spigot.objects.slots;
package net.t2code.commandguiv2.Spigot.objects;
public class Slot {
public class SlotObject {
public Integer slot;
public Boolean enable;
@ -10,7 +10,7 @@ public class Slot {
public String permissionToUse;
public Slot(Integer slot,
public SlotObject(Integer slot,
Boolean enable,
String function,
Boolean permission,

View File

@ -0,0 +1,4 @@
package net.t2code.commandguiv2.Spigot.objects;
public class UseItemObject {
}

View File

@ -2,32 +2,32 @@ package net.t2code.commandguiv2.Spigot.sound;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.entity.Player;
public class Sound {
public class PlaySound {
private static String prefix = Util.getPrefix();
public static void play(Player player, SoundEnum soundEnum) {
play(player, soundEnum, null, null, null);
}
public static void play(Player player, SoundEnum soundEnum, Function function, Slot slot, Gui gui) {
public static void play(Player player, SoundEnum soundEnum, FunctionObject function, SlotObject slot, GuiObject gui) {
if (!(Boolean) Config.soundEnable.value) return;
switch (soundEnum) {
case OpenInventory:
if (!(Boolean) Config.soundOpenInventoryEnable.value) return;
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundOpenInventoryInput.value)), 3, 1);
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundOpenInventoryInput.value).toUpperCase().replace(".", "_")), 3, 1);
break;
case Click:
if (!(Boolean) Config.soundClickEnable.value) return;
if (!function.customSound_Enable) {
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundClickInput.value)), 3, 1);
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundClickInput.value).toUpperCase().replace(".", "_")), 3, 1);
return;
}
@ -37,24 +37,24 @@ public class Sound {
} catch (Exception e1) {
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
.replace("[sound]", "§6GUI: §e" + gui.key + " §6Function: §e" + function.key + "§r §6Slot: §e" + (slot.slot + 1) + " §6CustomSound: §9" + function.customSound_Sound));
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundClickInput.value)), 3, 1);
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundClickInput.value).toUpperCase().replace(".", "_")), 3, 1);
}
break;
case NoMoney:
if (!(Boolean) Config.soundNoMoneyEnable.value) return;
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundNoMoneyInput.value)), 3, 1);
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundNoMoneyInput.value).toUpperCase().replace(".", "_")), 3, 1);
break;
case NoInventorySpace:
if (!(Boolean) Config.soundNoInventorySpaceEnable.value) return;
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundNoInventorySpaceInput.value)), 3, 1);
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundNoInventorySpaceInput.value).toUpperCase().replace(".", "_")), 3, 1);
break;
case Give:
if (!(Boolean) Config.soundGiveEnable.value) return;
player.playSound(player.getLocation(),org.bukkit.Sound.valueOf(String.valueOf( Config.soundGiveInput.value)), 3, 1);
player.playSound(player.getLocation(),org.bukkit.Sound.valueOf(String.valueOf( Config.soundGiveInput.value).toUpperCase().replace(".", "_")), 3, 1);
break;
case PlayerNotFound:
if (!(Boolean) Config.soundPlayerNotFoundEnable.value) return;
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundPlayerNotFoundInput.value)), 3, 1);
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundPlayerNotFoundInput.value).toUpperCase().replace(".", "_")), 3, 1);
break;
}
}

View File

@ -2,10 +2,12 @@ package net.t2code.commandguiv2.Spigot.system;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Spigot.config.config.ConfigSelect;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
import net.t2code.commandguiv2.Spigot.gui.GUIListener;
import net.t2code.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
import net.t2code.commandguiv2.Spigot.useItem.EventsFrom110;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterV5;
import net.t2code.commandguiv2.Spigot.config.functions.SelectFunctions;
import net.t2code.commandguiv2.Spigot.config.gui.SelectGui;
import net.t2code.commandguiv2.Spigot.function.gui.GUIListener;
import net.t2code.commandguiv2.Spigot.function.listener.Bungee_Sender_Reciver;
import net.t2code.commandguiv2.Spigot.function.useItem.EventsFrom110;
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUIItem;
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_Help;
@ -15,12 +17,9 @@ import net.t2code.commandguiv2.Spigot.config.gui.CreateGUI;
import net.t2code.commandguiv2.Spigot.config.languages.LanguagesCreate;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.commandguiv2.Spigot.database.MySQL;
import net.t2code.commandguiv2.Spigot.listener.PluginEvent;
import net.t2code.commandguiv2.Spigot.useItem.Events;
import net.t2code.commandguiv2.Spigot.function.listener.PluginEvent;
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.objects.Obj_Select;
import net.t2code.commandguiv2.Spigot.config.config.old.ConfigCreate;
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
import net.t2code.commandguiv2.Spigot.database.SQLITE;
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
import net.t2code.commandguiv2.Spigot.enums.StorageEnum;
@ -52,7 +51,7 @@ public class Load {
T2Csend.console(prefix + " §8-------------------------------");
try {
ConfigConverterUnderV5.renameMainFolder();
ConfigConverterV5.renameMainFolder();
} catch (Exception e) {
e.printStackTrace();
}
@ -92,8 +91,6 @@ public class Load {
e.printStackTrace();
}
SelectConfig.setConfigVersion();
if (T2CLibConfig.getBungee()) {
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin, "t2c:bcmd")) {
T2Csend.debug(plugin, "registerOutgoingPluginChannel §et2c:bcmd");
@ -115,7 +112,12 @@ public class Load {
e.printStackTrace();
}
try {
Obj_Select.onSelect();
SelectFunctions.onSelectFunction();
} catch (Exception e) {
e.printStackTrace();
}
try {
SelectGui.onSelectGui();
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -1,8 +1,8 @@
package net.t2code.commandguiv2.Spigot.system;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.Plugin;
@ -66,10 +66,10 @@ public class Permissions {
T2Cregister.permissionDescription(admin, "All permissions from T2C-CommandGUI", plugin);
for (Gui gui : Main.guiHashMap.values()) {
for (GuiObject gui : Main.guiHashMap.values()) {
T2Cregister.permission(command + "." + gui.key, op, plugin);
T2Cregister.permission(admin, op, command + "." + gui.key, true, plugin);
for (Slot slot : gui.slots) {
for (SlotObject slot : gui.slots) {
T2Cregister.permission(slot.permissionToUse, op, plugin);
T2Cregister.permission(admin, op, slot.permissionToUse, true, plugin);
T2Cregister.permission(slot.permissionToSee, op, plugin);

View File

@ -1,8 +1,7 @@
package net.t2code.commandguiv2.Spigot.system;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Spigot.useItem.Events;
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
import org.bukkit.entity.Player;
import java.util.ArrayList;

View File

@ -1,13 +1,12 @@
package net.t2code.commandguiv2.api;
import net.t2code.commandguiv2.Spigot.config.config.Config;
import net.t2code.commandguiv2.Spigot.useItem.ItemChange;
import net.t2code.commandguiv2.Spigot.useItem.Events;
import net.t2code.commandguiv2.Spigot.function.useItem.ItemChange;
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
import net.t2code.commandguiv2.Spigot.cmdManagement.Help;
import net.t2code.commandguiv2.Spigot.config.gui.CreateGUI;
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.commandguiv2.Spigot.system.Permissions;
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;