config convert
This commit is contained in:
parent
f68916ef54
commit
c34c6ab09f
@ -1,8 +1,8 @@
|
|||||||
package net.t2code.commandguiv2.Spigot;
|
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.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.Spigot.database.MySQL;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
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 LuckyBox = false;
|
||||||
public static Boolean PlugManGUI = 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 ArrayList<String> allAliases = new ArrayList<>();
|
||||||
|
|
||||||
public static HashMap<String, Function> functionHashMap = new HashMap<>();
|
public static HashMap<String, FunctionObject> functionHashMap = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
@ -2,7 +2,6 @@ package net.t2code.commandguiv2.Spigot.cmdManagement;
|
|||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
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.gui.CreateGUI;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
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.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
@ -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.Config;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.ConfigSelect;
|
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.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Obj_Select;
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
|
import net.t2code.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
|
||||||
import net.t2code.commandguiv2.Spigot.gui.OpenGUI;
|
import net.t2code.commandguiv2.Spigot.function.gui.OpenGUI;
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.UseItem;
|
import net.t2code.commandguiv2.Spigot.function.useItem.UseItem;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.LanguagesCreate;
|
import net.t2code.commandguiv2.Spigot.config.languages.LanguagesCreate;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
||||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
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.Spigot.enums.SoundEnum;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
@ -24,6 +24,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class Commands {
|
public class Commands {
|
||||||
@ -39,7 +40,11 @@ public class Commands {
|
|||||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||||
T2Csend.console(Util.getPrefix() + " §6Plugin reload...");
|
T2Csend.console(Util.getPrefix() + " §6Plugin reload...");
|
||||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||||
ConfigSelect.selectConfig();
|
try {
|
||||||
|
ConfigSelect.selectConfig();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
Main.getPlugin().reloadConfig();
|
Main.getPlugin().reloadConfig();
|
||||||
|
|
||||||
CmdExecuter_GUI.arg1.clear();
|
CmdExecuter_GUI.arg1.clear();
|
||||||
@ -52,7 +57,16 @@ public class Commands {
|
|||||||
|
|
||||||
LanguagesCreate.langCreate();
|
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());
|
SelectMessages.onSelect(Util.getPrefix());
|
||||||
Config.sound();
|
Config.sound();
|
||||||
|
|
||||||
@ -84,11 +98,11 @@ public class Commands {
|
|||||||
if (Bukkit.getPlayer(target.getName()) != null) {
|
if (Bukkit.getPlayer(target.getName()) != null) {
|
||||||
UseItem.giveUseItem(target);
|
UseItem.giveUseItem(target);
|
||||||
T2Csend.sender(sender, SelectMessages.Give_Sender.replace("[player]", target.getName()).replace("[item]", String.valueOf(Config.useItemName.value)));
|
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)));
|
T2Csend.player(target, SelectMessages.Give_Receiver.replace("[sender]", sender.getName()).replace("[item]", String.valueOf(Config.useItemName.value)));
|
||||||
Sound.play(target, SoundEnum.Give);
|
PlaySound.play(target, SoundEnum.Give);
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(SelectMessages.PlayerNotFond.replace("[player]", target.getName()));
|
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);
|
T2Csend.player(player, SelectMessages.ItemON);
|
||||||
} else {
|
} else {
|
||||||
T2Csend.player(player, SelectMessages.NoInventorySpace);
|
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) {
|
public static void gui(Player player) {
|
||||||
if (Main.guiHashMap.containsKey(String.valueOf(Config.defaultGUI.value))) {
|
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.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||||
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) {
|
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) {
|
||||||
OpenGUI.openGUI(player, String.valueOf(Config.defaultGUI.value), true);
|
OpenGUI.openGUI(player, String.valueOf(Config.defaultGUI.value), true);
|
||||||
@ -181,7 +195,7 @@ public class Commands {
|
|||||||
|
|
||||||
public static void gui(Player player, String arg) {
|
public static void gui(Player player, String arg) {
|
||||||
if (Main.guiHashMap.containsKey(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.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||||
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + gui.key) || player.hasPermission("commandgui.bypass")) {
|
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + gui.key) || player.hasPermission("commandgui.bypass")) {
|
||||||
OpenGUI.openGUI(player, arg, true);
|
OpenGUI.openGUI(player, arg, true);
|
||||||
|
@ -3,8 +3,7 @@ package net.t2code.commandguiv2.Spigot.cmdManagement;
|
|||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
@ -15,7 +14,7 @@ public class Help {
|
|||||||
private static String prefix = Util.getPrefix();
|
private static String prefix = Util.getPrefix();
|
||||||
|
|
||||||
public static void sendHelp(CommandSender sender, String Prefix) {
|
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-----");
|
T2Csend.sender(sender, Prefix + " §8----- §4Command§9GUI §chelp §8-----");
|
||||||
cgui(sender, gui);
|
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.hasPermission("commandgui.command")) return;
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
|
@ -2,8 +2,8 @@ package net.t2code.commandguiv2.Spigot.cmdManagement.register;
|
|||||||
|
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
||||||
import net.t2code.commandguiv2.Spigot.gui.OpenGUI;
|
import net.t2code.commandguiv2.Spigot.function.gui.OpenGUI;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -23,7 +23,7 @@ public class RegisterCommand extends Command {
|
|||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
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.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||||
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) {
|
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) {
|
||||||
OpenGUI.openGUI(player, alias, true);
|
OpenGUI.openGUI(player, alias, true);
|
||||||
|
@ -17,111 +17,107 @@ import java.util.List;
|
|||||||
|
|
||||||
public enum Config {
|
public enum Config {
|
||||||
|
|
||||||
configVersion("ConfigVersion", 6, true),
|
configVersion("configVersion", 6),
|
||||||
debug("Plugins.Debug", false, false),
|
debug("plugins.debug", false),
|
||||||
updateCheckOnJoin("Plugin.updateCheck.onJoin", true, false),
|
updateCheckOnJoin("plugin.updateCheck.onJoin", true),
|
||||||
updateCheckSeePreReleaseUpdates("Plugin.updateCheck.seePreReleaseUpdates", true, false),
|
updateCheckSeePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true),
|
||||||
updateCheckTimeInterval("Plugin.updateCheck.timeInterval", 60, false),
|
updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60),
|
||||||
helpAlias("Plugin.HelpAlias", true, false),
|
helpAlias("plugin.helpAlias", true),
|
||||||
adminSubCommand("Plugin.AdminSubCommand", "admin", false),
|
adminSubCommand("plugin.adminSubCommand", "admin"),
|
||||||
language("Plugin.language", "english", false),
|
language("plugin.language", "english"),
|
||||||
currency("Plugin.Currency", "$", false),
|
currency("plugin.currency", "$"),
|
||||||
defaultGUI("Plugin.DefaultGUI", "default", false),
|
defaultGUI("plugin.defaultGUI", "default"),
|
||||||
|
|
||||||
|
|
||||||
storage("Storage.Type", StorageEnum.SQLITE.name(), false),
|
storage("storage.type", StorageEnum.SQLITE.name()),
|
||||||
mysqlIp("Storage.MySQL.IP", "localhost", false),
|
mysqlIp("storage.mySQL.ip", "localhost"),
|
||||||
mysqlPort("Storage.MySQL.Port", 3306, false),
|
mysqlPort("storage.mySQL.port", 3306),
|
||||||
mysqlDatabase("Storage.MySQL.Database", "database", false),
|
mysqlDatabase("storage.mySQL.database", "database"),
|
||||||
mysqlUser("Storage.MySQL.User", "root", false),
|
mysqlUser("storage.mySQL.user", "root"),
|
||||||
mysqlPassword("Storage.MySQL.Password", "password", false),
|
mysqlPassword("storage.mySQL.password", "password"),
|
||||||
mysqlSSL("Storage.MySQL.SSL", false, false),
|
mysqlSSL("storage.mySQL.ssl", false),
|
||||||
|
|
||||||
|
|
||||||
useItemEnable("UseItem.Enable", true, false),
|
useItemEnable("useItem.enable", true),
|
||||||
useItemAllowToggle("UseItem.AllowToggle", true, false),
|
useItemAllowToggle("useItem.allowToggle", true),
|
||||||
useItemAllowSetSlot("UseItem.AllowSetSlot", true, false),
|
useItemAllowSetSlot("useItem.allowSetSlot", true),
|
||||||
useItemBlockMoveAndDrop("UseItem.BlockMoveAndDrop", true, false),
|
useItemBlockMoveAndDrop("useItem.blockMoveAndDrop", true),
|
||||||
useItemOpenGUI("UseItem.OpenGUI", "default", false),
|
useItemOpenGUI("useItem.openGUI", "default"),
|
||||||
useItemPermission("UseItem.Permission.NeededToUse", true, false),
|
useItemPermission("useItem.permission.neededToUse", true),
|
||||||
useItemKeepAtCommandClear("UseItem.KeepAtCommandClear", true, false),
|
useItemKeepAtCommandClear("useItem.keepAtCommandClear", true),
|
||||||
useItemInventorySlotFreeSlot("UseItem.InventorySlot.FreeSlot", 1, false),
|
useItemInventorySlotFreeSlot("useItem.inventorySlot.freeSlot", 1),
|
||||||
useItemInventorySlot("UseItem.InventorySlot.Slot", false, false),
|
useItemInventorySlot("useItem.inventorySlot.slot", 1),
|
||||||
useItemInventorySlotEnforce("UseItem.InventorySlot.SlotEnforce", false, false),
|
useItemInventorySlotEnforce("useItem.inventorySlot.slotEnforce", false),
|
||||||
useItemMaterial("UseItem.Item.Material", "paper", 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),
|
||||||
|
|
||||||
|
|
||||||
|
toggleItemOnOrYesBase64("toggle.items.onOrYes.item.base64.enable", false),
|
||||||
useItemPlayerHeadEnable("UseItem.Item.PlayerHead.Enable", false, false),
|
toggleItemOnOrYesBase64Value("toggle.items.onOrYes.item.base64.base64Value", ""),
|
||||||
useItemBase64Enable("UseItem.Item.PlayerHead.Base64.Enable", false, false),
|
toggleItemOnOrYesMaterial("toggle.items.onOrYes.item.material", Main.legacy ? "WOOL,5" : T2CitemVersion.getGreenWool().getType().toString()),
|
||||||
useItemBase64value("UseItem.Item.PlayerHead.Base64.Base64Value", "", false),
|
toggleItemOffOrNoBase64("toggle.items.offOrNo.item.base64.enable", false),
|
||||||
useItemPlayerWhoHasOpenedTheGUI("UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI", false, false),
|
toggleItemOffOrNoBase64Value("toggle.items.offOrNo.item.base64.base64Value", T2CitemVersion.getGreenWool().getType().toString()),
|
||||||
useItemPlayerName("UseItem.Item.PlayerHead.PlayerName", "", false),
|
toggleItemOffOrNoMaterial("toggle.items.offOrNo.item.material", Main.legacy ? "WOOL,14" : T2CitemVersion.getRedWool().getType().toString()),
|
||||||
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, false),
|
togglePermTrue("toggle.permission.commands.true", "luckperms user [player] permission set [perm] true"),
|
||||||
toggleItemOnOrYesBase64Value("Toggle.Items.OnOrYes.Item.Base64.Base64Value", "", false),
|
togglePermFalse("toggle.permission.commands.false", "luckperms user [player] permission set [perm] false"),
|
||||||
toggleItemOnOrYesMaterial("Toggle.Items.OnOrYes.Item.Material", Main.legacy ? "WOOL,5" : T2CitemVersion.getGreenWool().getType().toString(), false),
|
placeholderTrue("placeholder.True", "&2true"),
|
||||||
toggleItemOffOrNoBase64("Toggle.Items.OffOrNo.Item.Base64.Enable", false, false),
|
placeholderFalse("placeholder.False", "&4false"),
|
||||||
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", false),
|
soundEnable("sound.enable", true),
|
||||||
togglePermFalse("Toggle.Permission.Commands.False", "luckperms user [player] permission set [perm] false", false),
|
soundOpenInventoryEnable("sound.openInventory.enable", true),
|
||||||
placeholderTrue("Placeholder.True", "&2true", false),
|
soundOpenInventoryInput("sound.openInventory.sound", getOpenInventory().toString()),
|
||||||
placeholderFalse("Placeholder.False", "&4false", false),
|
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),
|
useItemGameModeChangeEnable("advanced.useItem.gameMode.change.enable", true),
|
||||||
soundOpenInventoryEnable("Sound.OpenInventory.Enable", true, false),
|
useItemGameModeChangeDelayInTicks("advanced.useItem.gameMode.change.delayInTicks", 1),
|
||||||
soundOpenInventoryInput("Sound.OpenInventory.Sound", getOpenInventory().toString(), false),
|
useItemGameModeProtection("advanced.useItem.gameMode.protection.enable", false),
|
||||||
soundClickEnable("Sound.Click.Enable", true, false),
|
useItemGameModeRemoveItemWhenItIsDisabled("advanced.useItem.gameMode.protection.removeItemWhenItIsDisabled", false),
|
||||||
soundClickInput("Sound.Click.Sound", getClick().toString(), false),
|
useItemGameModeMode("advanced.useItem.gameMode.protection.mode", "blacklist"),
|
||||||
soundNoMoneyEnable("Sound.NoMoney.Enable", true, false),
|
useItemGameModeList("advanced.useItem.gameMode.protection.list", Arrays.asList("CREATIVE", "Spectator")),
|
||||||
soundNoMoneyInput("Sound.NoMoney.Sound", getNoMoney().toString(), false),
|
|
||||||
soundNoInventorySpaceEnable("Sound.NoInventorySpace.Enable", true, false),
|
useItemWorldChangeEnable("advanced.useItem.world.change.enable", true),
|
||||||
soundNoInventorySpaceInput("Sound.NoInventorySpace.Sound", getNoInventorySpace().toString(), false),
|
useItemWorldChangeDelayInTicks("advanced.useItem.world.change.delayInTicks", 1),
|
||||||
soundGiveEnable("Sound.Give.Enable", true, false),
|
useItemWorldProtection("advanced.useItem.world.protection.enable", false),
|
||||||
soundGiveInput("Sound.Give.Sound", getGive().toString(), false),
|
useItemWorldRemoveItemWhenItIsDisabled("advanced.useItem.world.protection.removeItemWhenItIsDisabled", false),
|
||||||
soundPlayerNotFoundEnable("Sound.PlayerNotFound.Enable", true, false),
|
useItemWorldMode("advanced.useItem.world.protection.mode", "blacklist"),
|
||||||
soundPlayerNotFoundInput("Sound.PlayerNotFound.Sound", getPlayerNotFound().toString(), false),
|
useItemWorldList("advanced.useItem.world.protection.list", Arrays.asList("World1", "World2")),
|
||||||
|
|
||||||
|
|
||||||
useItemGameModeChangeEnable("Advanced.UseItem.GameMode.Change.Enable", true, false),
|
disableInfoBySneak("advanced.useItem.disableInfoBySneak", false),
|
||||||
useItemGameModeChangeDelayInTicks("Advanced.UseItem.GameMode.Change.DelayInTicks", 1, false),
|
useItemItemBlockBlacklist("advanced.useItem.itemBlockBlacklist", getItemBlockBlacklist());
|
||||||
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);
|
|
||||||
|
|
||||||
|
|
||||||
public final String path;
|
public final String path;
|
||||||
public Object value;
|
public Object value;
|
||||||
public final boolean forceSet;
|
|
||||||
|
|
||||||
Config(String path, Object defaultValue, boolean forceSet) {
|
Config(String path, Object defaultValue) {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.value = defaultValue;
|
this.value = defaultValue;
|
||||||
this.forceSet = forceSet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sound() {
|
public static void sound() {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.config.config;
|
package net.t2code.commandguiv2.Spigot.config.config;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
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.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
|
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
|
||||||
@ -11,14 +13,33 @@ import java.io.IOException;
|
|||||||
|
|
||||||
public class ConfigSelect {
|
public class ConfigSelect {
|
||||||
|
|
||||||
public static void selectConfig() {
|
public static void selectConfig() throws IOException {
|
||||||
File config = new File(Main.getPath(), "config.yml");
|
File config = new File(Main.getPath(), "config.yml");
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
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()) {
|
for (Config value : Config.values()) {
|
||||||
if (value.forceSet) {
|
T2Cconfig.set(value.path, value.value, yamlConfiguration);
|
||||||
yamlConfiguration.set(value.path, value.value);
|
|
||||||
} else T2Cconfig.set(value.path, value.value, yamlConfiguration);
|
|
||||||
value.value = T2Cconfig.selectObject(Util.getPrefix(), value.path, yamlConfiguration);
|
value.value = T2Cconfig.selectObject(Util.getPrefix(), value.path, yamlConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.config.config.old;
|
package net.t2code.commandguiv2.Spigot.config.config.old;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
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.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
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.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SelectConfig {
|
public class SelectConfig {
|
||||||
@ -27,7 +26,7 @@ public class SelectConfig {
|
|||||||
T2Csend.console(Util.getPrefix() + " ");
|
T2Csend.console(Util.getPrefix() + " ");
|
||||||
T2Csend.console(Util.getPrefix() + " §4----------------------");
|
T2Csend.console(Util.getPrefix() + " §4----------------------");
|
||||||
if (yamlConfiguration.getInt("ConfigVersion") < 5) {
|
if (yamlConfiguration.getInt("ConfigVersion") < 5) {
|
||||||
ConfigConverterUnderV5.convert();
|
ConfigConverterV5.convert();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.config.configConverter;
|
|
||||||
|
|
||||||
public class ConfigConverterUnderV6 {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,6 +1,7 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.config.configConverter;
|
package net.t2code.commandguiv2.Spigot.config.configConverter;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
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.config.functions.CreateFunctions;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
||||||
@ -15,7 +16,7 @@ import java.io.IOException;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ConfigConverterUnderV5 {
|
public class ConfigConverterV5 {
|
||||||
public static void renameMainFolder() {
|
public static void renameMainFolder() {
|
||||||
if (new File("plugins/CommandGUI").exists() && !Main.getPath().exists()) {
|
if (new File("plugins/CommandGUI").exists() && !Main.getPath().exists()) {
|
||||||
File oldF = new File("plugins/CommandGUI");
|
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");
|
File config = new File(Main.getPath(), "GUIs/" + configOld.getName().replace(".yml", "") + ".yml");
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
|
yamlConfiguration.set(Config.configVersion.path, 5);
|
||||||
|
|
||||||
Boolean enable = yamlConfigurationOld.getBoolean("GUI.Enable");
|
Boolean enable = yamlConfigurationOld.getBoolean("GUI.Enable");
|
||||||
Integer lines = yamlConfigurationOld.getInt("GUI.Lines");
|
Integer lines = yamlConfigurationOld.getInt("GUI.Lines");
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
|
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterV5;
|
||||||
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.enums.EcoEnum;
|
import net.t2code.commandguiv2.Spigot.enums.EcoEnum;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
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.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Obj_Select {
|
public class SelectFunctions {
|
||||||
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 static void onSelectFunction() {
|
public static void onSelectFunction() {
|
||||||
Main.functionHashMap.clear();
|
Main.functionHashMap.clear();
|
||||||
File f = new File(Main.getPath() + "/Functions/");
|
File f = new File(Main.getPath() + "/Functions/");
|
||||||
@ -118,7 +37,7 @@ public class Obj_Select {
|
|||||||
String name = yamlConfiguration.getString("Slots.Function.Item.Name");
|
String name = yamlConfiguration.getString("Slots.Function.Item.Name");
|
||||||
List<String> lore = yamlConfiguration.getStringList("Slots.Function.Item.Lore");
|
List<String> lore = yamlConfiguration.getStringList("Slots.Function.Item.Lore");
|
||||||
if (yamlConfiguration.get("Slots.Function.NoPermission") == null) {
|
if (yamlConfiguration.get("Slots.Function.NoPermission") == null) {
|
||||||
ConfigConverterUnderV5.noPermLore(yamlConfiguration, config);
|
ConfigConverterV5.noPermLore(yamlConfiguration, config);
|
||||||
}
|
}
|
||||||
Boolean noPermMessageEnable = yamlConfiguration.getBoolean("Slots.Function.NoPermission.Message.Enable");
|
Boolean noPermMessageEnable = yamlConfiguration.getBoolean("Slots.Function.NoPermission.Message.Enable");
|
||||||
String customNoPermMessage = yamlConfiguration.getString("Slots.Function.NoPermission.Message.CustomNoPermMessage");
|
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");
|
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,
|
noPermMessageEnable, customNoPermMessage, noPermLoreEnable, noPermLore,
|
||||||
customSound_Enable, customSound_NoSound, customSound_Sound, cost_Enable, ecoModule, ecoItem, votePoints, price, command_Enable, command_BungeeCommand,
|
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,
|
commandAsConsole, command, serverChange, serverChangeServer, openGUI_Enable, openGUI, togglePermission, togglePermissionPerm, toggleUseItem, message_Enable,
|
||||||
@ -218,4 +137,5 @@ public class Obj_Select {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,7 +2,6 @@ package net.t2code.commandguiv2.Spigot.config.languages;
|
|||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
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.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
@ -4,7 +4,6 @@ import com.zaxxer.hikari.HikariConfig;
|
|||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
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.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.database;
|
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.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.StorageEnum;
|
import net.t2code.commandguiv2.Spigot.enums.StorageEnum;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.database;
|
package net.t2code.commandguiv2.Spigot.database;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Obj_Select;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -35,12 +34,12 @@ public class YML {
|
|||||||
try {
|
try {
|
||||||
yamlConfigurationStorage.save(storage);
|
yamlConfigurationStorage.save(storage);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Main.sendTryCatch(Obj_Select.class, e.getStackTrace()[0]);
|
Main.sendTryCatch(YML.class, e.getStackTrace()[0]);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean selectGuiitemOn(Player player){
|
public static Boolean selectGuiitemOn(Player player) {
|
||||||
if (!yamlConfigurationStorage.contains(String.valueOf(player.getUniqueId()))) return true;
|
if (!yamlConfigurationStorage.contains(String.valueOf(player.getUniqueId()))) return true;
|
||||||
return yamlConfigurationStorage.getBoolean(player.getUniqueId() + ".Status");
|
return yamlConfigurationStorage.getBoolean(player.getUniqueId() + ".Status");
|
||||||
}
|
}
|
||||||
|
@ -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.config.config.Config;
|
||||||
import net.t2code.commandguiv2.Spigot.listener.ServerChange;
|
import net.t2code.commandguiv2.Spigot.function.listener.ServerChange;
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
|
||||||
import net.t2code.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
|
import net.t2code.commandguiv2.Spigot.function.listener.Bungee_Sender_Reciver;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.system.Placeholder;
|
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.Spigot.enums.SoundEnum;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.eco.T2Ceco;
|
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.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.checkerframework.checker.units.qual.C;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -47,23 +45,23 @@ public class GUIListener implements Listener {
|
|||||||
Player player = (Player) e.getWhoClicked();
|
Player player = (Player) e.getWhoClicked();
|
||||||
if (e.getInventory() == null) return;
|
if (e.getInventory() == null) return;
|
||||||
if (e.getCurrentItem() == 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))
|
if (player.getOpenInventory().getTitle().equals(T2Creplace.replace(prefix, GUICode + gui.guiName))
|
||||||
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(T2Creplace.replace(prefix, player, GUICode + gui.guiName)))) {
|
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(T2Creplace.replace(prefix, player, GUICode + gui.guiName)))) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
if (player.getOpenInventory().getTopInventory() != e.getClickedInventory()) {
|
if (player.getOpenInventory().getTopInventory() != e.getClickedInventory()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (Slot slot : gui.slots) {
|
for (SlotObject slot : gui.slots) {
|
||||||
execute(e, slot, player, gui);
|
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;
|
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.permissionToSee)) return;
|
||||||
if (slot.permission && !player.hasPermission(slot.permissionToUse)) {
|
if (slot.permission && !player.hasPermission(slot.permissionToUse)) {
|
||||||
if (function.noPermMessageEnable) {
|
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.togglePermission) return true;
|
||||||
if (function.toggleUseItem) return true;
|
if (function.toggleUseItem) return true;
|
||||||
if (function.command_Enable) return true;
|
if (function.command_Enable) return true;
|
||||||
@ -102,7 +100,7 @@ public class GUIListener implements Listener {
|
|||||||
return function.functionItem;
|
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.togglePermission) togglePerm(function, gui, player);
|
||||||
if (function.toggleUseItem) toggleUseItem(player, gui);
|
if (function.toggleUseItem) toggleUseItem(player, gui);
|
||||||
if (function.command_Enable) command(function, player);
|
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.setConfigEnable) setConfig(function, player, e);
|
||||||
if (function.functionVotePoints) votePoints(e, function, player);
|
if (function.functionVotePoints) votePoints(e, function, player);
|
||||||
if (function.functionItem) item(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();
|
player.closeInventory();
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -140,7 +138,7 @@ public class GUIListener implements Listener {
|
|||||||
}.runTaskLater(plugin, 2L);
|
}.runTaskLater(plugin, 2L);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void openGUI(Function slot, Player player) {
|
private static void openGUI(FunctionObject slot, Player player) {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -150,7 +148,7 @@ public class GUIListener implements Listener {
|
|||||||
}.runTaskLater(plugin, 1L);
|
}.runTaskLater(plugin, 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void message(Function slot, Player player) {
|
private static void message(FunctionObject slot, Player player) {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
for (String msg : slot.message) {
|
for (String msg : slot.message) {
|
||||||
if (Main.PaPi) {
|
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() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -181,7 +179,7 @@ public class GUIListener implements Listener {
|
|||||||
}.runTaskLater(Main.getPlugin(), 20L);
|
}.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);
|
File config = new File(slot.configFilePath);
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
@ -247,7 +245,7 @@ public class GUIListener implements Listener {
|
|||||||
}.runTaskLater(plugin, 1L);
|
}.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)) {
|
if (player.hasPermission(function.togglePermissionPerm)) {
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), String.valueOf(Config.togglePermFalse.value).replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), String.valueOf(Config.togglePermFalse.value).replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@ -268,7 +266,7 @@ public class GUIListener implements Listener {
|
|||||||
}.runTaskLater(plugin, 4L);
|
}.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())) {
|
if (Events.useItemHashMap.get(player.getName())) {
|
||||||
Commands.itemOff(player);
|
Commands.itemOff(player);
|
||||||
} else {
|
} else {
|
||||||
@ -283,7 +281,7 @@ public class GUIListener implements Listener {
|
|||||||
}.runTaskLater(plugin, 2L);
|
}.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();
|
player.closeInventory();
|
||||||
switch (function.functionVotePointsMode) {
|
switch (function.functionVotePointsMode) {
|
||||||
case ADD:
|
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(";");
|
String[] item = function.functionItemItem.split(";");
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
switch (function.functionItemMode) {
|
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) {
|
switch (function.ecoModule) {
|
||||||
case ITEM:
|
case ITEM:
|
||||||
String[] item = function.ecoItem.split(";");
|
String[] item = function.ecoItem.split(";");
|
||||||
@ -327,7 +325,7 @@ public class GUIListener implements Listener {
|
|||||||
}
|
}
|
||||||
}.runTaskLater(plugin, 1L);
|
}.runTaskLater(plugin, 1L);
|
||||||
T2Csend.player(player, SelectMessages.noMoneyItem.replace("[item]", item[0]).replace("[amount]", item[1]));
|
T2Csend.player(player, SelectMessages.noMoneyItem.replace("[item]", item[0]).replace("[amount]", item[1]));
|
||||||
Sound.play(player, SoundEnum.NoMoney);
|
PlaySound.play(player, SoundEnum.NoMoney);
|
||||||
} else {
|
} else {
|
||||||
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
|
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
|
||||||
.replace("[price]", item[1] + " " + item[0]));
|
.replace("[price]", item[1] + " " + item[0]));
|
||||||
@ -343,7 +341,7 @@ public class GUIListener implements Listener {
|
|||||||
}
|
}
|
||||||
}.runTaskLater(plugin, 1L);
|
}.runTaskLater(plugin, 1L);
|
||||||
T2Csend.player(player, SelectMessages.noMoneyVote.replace("[amount]", function.votePoints.toString()));
|
T2Csend.player(player, SelectMessages.noMoneyVote.replace("[amount]", function.votePoints.toString()));
|
||||||
Sound.play(player, SoundEnum.NoMoney);
|
PlaySound.play(player, SoundEnum.NoMoney);
|
||||||
} else {
|
} else {
|
||||||
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
|
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
|
||||||
.replace("[price]", function.votePoints + " VotePoints"));
|
.replace("[price]", function.votePoints + " VotePoints"));
|
||||||
@ -360,7 +358,7 @@ public class GUIListener implements Listener {
|
|||||||
}
|
}
|
||||||
}.runTaskLater(plugin, 1L);
|
}.runTaskLater(plugin, 1L);
|
||||||
T2Csend.player(player, T2Creplace.replacePrice(prefix, SelectMessages.noMoney, String.valueOf(function.price)));
|
T2Csend.player(player, T2Creplace.replacePrice(prefix, SelectMessages.noMoney, String.valueOf(function.price)));
|
||||||
Sound.play(player, SoundEnum.NoMoney);
|
PlaySound.play(player, SoundEnum.NoMoney);
|
||||||
} else {
|
} else {
|
||||||
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
|
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
|
||||||
.replace("[price]", function.price + " " + Config.currency.value));
|
.replace("[price]", function.price + " " + Config.currency.value));
|
@ -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.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
|
||||||
import net.t2code.commandguiv2.Spigot.system.Placeholder;
|
import net.t2code.commandguiv2.Spigot.system.Placeholder;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||||
@ -27,8 +26,8 @@ public class GuiBuilder {
|
|||||||
|
|
||||||
private static String prefix = Util.getPrefix();
|
private static String prefix = Util.getPrefix();
|
||||||
|
|
||||||
protected static void item(Slot slot, Player player, Inventory inventory) {
|
protected static void item(SlotObject slot, Player player, Inventory inventory) {
|
||||||
Function function = Main.functionHashMap.get(slot.function);
|
FunctionObject function = Main.functionHashMap.get(slot.function);
|
||||||
ItemStack item;
|
ItemStack item;
|
||||||
if (Main.legacy && function.item.toUpperCase().contains(",")) {
|
if (Main.legacy && function.item.toUpperCase().contains(",")) {
|
||||||
String[] split = function.item.toUpperCase().split(",");
|
String[] split = function.item.toUpperCase().split(",");
|
||||||
@ -45,8 +44,8 @@ public class GuiBuilder {
|
|||||||
inventory.setItem(slot.slot, item);
|
inventory.setItem(slot.slot, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void item(String material, Slot slot, Player player, Inventory inventory) {
|
protected static void item(String material, SlotObject slot, Player player, Inventory inventory) {
|
||||||
Function function = Main.functionHashMap.get(slot.function);
|
FunctionObject function = Main.functionHashMap.get(slot.function);
|
||||||
ItemStack item;
|
ItemStack item;
|
||||||
if (Main.legacy && material.contains(",")) {
|
if (Main.legacy && material.contains(",")) {
|
||||||
String[] split = material.split(",");
|
String[] split = material.split(",");
|
||||||
@ -64,8 +63,8 @@ public class GuiBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, Slot slot) {
|
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, SlotObject slot) {
|
||||||
Function function = Main.functionHashMap.get(slot.function);
|
FunctionObject function = Main.functionHashMap.get(slot.function);
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
itemMeta.setDisplayName(T2Creplace.replace(prefix, player, Placeholder.replace(function.name, player)));
|
itemMeta.setDisplayName(T2Creplace.replace(prefix, player, Placeholder.replace(function.name, player)));
|
||||||
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
|
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) {
|
protected static void base64(String base64Value, SlotObject slot, Player player, Inventory inventory) {
|
||||||
Function function = Main.functionHashMap.get(slot.function);
|
FunctionObject function = Main.functionHashMap.get(slot.function);
|
||||||
ItemStack item = T2CitemVersion.getHeadIS();
|
ItemStack item = T2CitemVersion.getHeadIS();
|
||||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||||
setBase64(itemMeta, base64Value);
|
setBase64(itemMeta, base64Value);
|
||||||
@ -107,13 +106,13 @@ public class GuiBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void base64(Slot slot, Player player, Inventory inventory) {
|
protected static void base64(SlotObject slot, Player player, Inventory inventory) {
|
||||||
Function function = Main.functionHashMap.get(slot.function);
|
FunctionObject function = Main.functionHashMap.get(slot.function);
|
||||||
base64(function.base64Value, slot, player, inventory);
|
base64(function.base64Value, slot, player, inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void playerHead(Slot slot, Player player, Inventory inventory, String skullName) {
|
protected static void playerHead(SlotObject slot, Player player, Inventory inventory, String skullName) {
|
||||||
Function function = Main.functionHashMap.get(slot.function);
|
FunctionObject function = Main.functionHashMap.get(slot.function);
|
||||||
ItemStack item = T2CitemVersion.getHeadIS();
|
ItemStack item = T2CitemVersion.getHeadIS();
|
||||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||||
setDisplayNameAndLore(itemMeta, player, slot);
|
setDisplayNameAndLore(itemMeta, player, slot);
|
||||||
@ -127,7 +126,7 @@ public class GuiBuilder {
|
|||||||
inventory.setItem(slot.slot, item);
|
inventory.setItem(slot.slot, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void fillItem(Inventory inventory, Gui gui) {
|
public static void fillItem(Inventory inventory, GuiObject gui) {
|
||||||
ItemStack glass;
|
ItemStack glass;
|
||||||
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
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));
|
glass = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, Short.parseShort(gui.guiFillItemItem));
|
@ -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.config.config.Config;
|
||||||
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
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.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.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
import net.t2code.commandguiv2.Spigot.sound.PlaySound;
|
||||||
import net.t2code.commandguiv2.Spigot.sound.Sound;
|
|
||||||
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import io.github.solyze.plugmangui.inventories.PluginListGUI;
|
import io.github.solyze.plugmangui.inventories.PluginListGUI;
|
||||||
@ -30,7 +29,7 @@ public class OpenGUI {
|
|||||||
private static String prefix = Util.getPrefix();
|
private static String prefix = Util.getPrefix();
|
||||||
|
|
||||||
public static void openGUI(Player player, String guiString, Boolean sound) {
|
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());
|
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||||
switch (guiString) {
|
switch (guiString) {
|
||||||
//case "plugin.PlotSquaredGUI":
|
//case "plugin.PlotSquaredGUI":
|
||||||
@ -77,9 +76,9 @@ public class OpenGUI {
|
|||||||
if (gui.guiFillItemEnable) {
|
if (gui.guiFillItemEnable) {
|
||||||
GuiBuilder.fillItem(inventory, gui);
|
GuiBuilder.fillItem(inventory, gui);
|
||||||
}
|
}
|
||||||
for (Slot slot : gui.slots) {
|
for (SlotObject slot : gui.slots) {
|
||||||
try {
|
try {
|
||||||
Function function = Main.functionHashMap.get(slot.function);
|
FunctionObject function = Main.functionHashMap.get(slot.function);
|
||||||
if (function == null) {
|
if (function == null) {
|
||||||
T2Csend.error(Main.getPlugin(), "The Function " + slot.function + " in the GUI " + gui.key + " does not exist!");
|
T2Csend.error(Main.getPlugin(), "The Function " + slot.function + " in the GUI " + gui.key + " does not exist!");
|
||||||
continue;
|
continue;
|
||||||
@ -129,20 +128,20 @@ public class OpenGUI {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if (sound) {
|
if (sound) {
|
||||||
Sound.play(player, SoundEnum.OpenInventory);
|
PlaySound.play(player, SoundEnum.OpenInventory);
|
||||||
}
|
}
|
||||||
player.openInventory(inventory);
|
player.openInventory(inventory);
|
||||||
T2Csend.debug(plugin, "§6" + player.getName() + " §5Open §6" + T2Creplace.replace(prefix, gui.guiName) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
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)));
|
} 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) {
|
if ((Boolean) Config.toggleItemOnOrYesBase64.value) {
|
||||||
GuiBuilder.base64(String.valueOf( Config.toggleItemOnOrYesBase64Value.value), slot, player, inventory);
|
GuiBuilder.base64(String.valueOf( Config.toggleItemOnOrYesBase64Value.value), slot, player, inventory);
|
||||||
} else GuiBuilder.item(String.valueOf(Config.toggleItemOnOrYesMaterial.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) {
|
if ((Boolean) Config.toggleItemOffOrNoBase64.value) {
|
||||||
GuiBuilder.base64(String.valueOf( Config.toggleItemOffOrNoBase64Value.value), slot, player, inventory);
|
GuiBuilder.base64(String.valueOf( Config.toggleItemOffOrNoBase64Value.value), slot, player, inventory);
|
||||||
} else GuiBuilder.item(String.valueOf(Config.toggleItemOffOrNoMaterial.value), slot, player, inventory);
|
} else GuiBuilder.item(String.valueOf(Config.toggleItemOffOrNoMaterial.value), slot, player, inventory);
|
@ -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.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
@ -1,6 +1,6 @@
|
|||||||
// This claas was created by JaTiTV
|
// 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.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
@ -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.commandguiv2.Spigot.Main;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
@ -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.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
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.Spigot.database.SelectDatabase;
|
||||||
import net.t2code.commandguiv2.api.CGuiAPI;
|
import net.t2code.commandguiv2.api.CGuiAPI;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
@ -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 net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
@ -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.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
@ -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.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
@ -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.EcoEnum;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
||||||
@ -6,7 +6,7 @@ import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Function {
|
public class FunctionObject {
|
||||||
|
|
||||||
public String key;
|
public String key;
|
||||||
public Boolean empty;
|
public Boolean empty;
|
||||||
@ -71,67 +71,67 @@ public class Function {
|
|||||||
public FunctionItemEnum functionItemMode;
|
public FunctionItemEnum functionItemMode;
|
||||||
public String functionItemItem;
|
public String functionItemItem;
|
||||||
|
|
||||||
public Function(String key,
|
public FunctionObject(String key,
|
||||||
Boolean empty,
|
Boolean empty,
|
||||||
Integer itemAmount,
|
Integer itemAmount,
|
||||||
Boolean playerHead_Enable,
|
Boolean playerHead_Enable,
|
||||||
Boolean base64Value_Enable,
|
Boolean base64Value_Enable,
|
||||||
String base64Value,
|
String base64Value,
|
||||||
Boolean playerWhoHasOpenedTheGUI,
|
Boolean playerWhoHasOpenedTheGUI,
|
||||||
String playerName,
|
String playerName,
|
||||||
String item,
|
String item,
|
||||||
String name,
|
String name,
|
||||||
List<String> lore,
|
List<String> lore,
|
||||||
Boolean noPermMessageEnable,
|
Boolean noPermMessageEnable,
|
||||||
String customNoPermMessage,
|
String customNoPermMessage,
|
||||||
Boolean noPermLoreEnable,
|
Boolean noPermLoreEnable,
|
||||||
List<String> noPermLore,
|
List<String> noPermLore,
|
||||||
Boolean customSound_Enable,
|
Boolean customSound_Enable,
|
||||||
Boolean customSound_NoSound,
|
Boolean customSound_NoSound,
|
||||||
String customSound_Sound,
|
String customSound_Sound,
|
||||||
Boolean cost_Enable,
|
Boolean cost_Enable,
|
||||||
EcoEnum ecoModule,
|
EcoEnum ecoModule,
|
||||||
String ecoItem,
|
String ecoItem,
|
||||||
Integer votePoints,
|
Integer votePoints,
|
||||||
Double price,
|
Double price,
|
||||||
Boolean command_Enable,
|
Boolean command_Enable,
|
||||||
Boolean command_BungeeCommand,
|
Boolean command_BungeeCommand,
|
||||||
Boolean commandAsConsole,
|
Boolean commandAsConsole,
|
||||||
List<String> command,
|
List<String> command,
|
||||||
Boolean serverChange,
|
Boolean serverChange,
|
||||||
String serverChangeServer,
|
String serverChangeServer,
|
||||||
Boolean openGUI_Enable,
|
Boolean openGUI_Enable,
|
||||||
String openGUI,
|
String openGUI,
|
||||||
Boolean togglePermission,
|
Boolean togglePermission,
|
||||||
String togglePermissionPerm,
|
String togglePermissionPerm,
|
||||||
Boolean toggleUseItem,
|
Boolean toggleUseItem,
|
||||||
Boolean message_Enable,
|
Boolean message_Enable,
|
||||||
List<String> message,
|
List<String> message,
|
||||||
Boolean setConfigEnable,
|
Boolean setConfigEnable,
|
||||||
String configFilePath,
|
String configFilePath,
|
||||||
String configOptionPath,
|
String configOptionPath,
|
||||||
String configOptionPremat,
|
String configOptionPremat,
|
||||||
|
|
||||||
String configStringValueLeft,
|
String configStringValueLeft,
|
||||||
Boolean configBooleanValueLeft,
|
Boolean configBooleanValueLeft,
|
||||||
Integer configIntegerValueLeft,
|
Integer configIntegerValueLeft,
|
||||||
Double configDoubleValueLeft,
|
Double configDoubleValueLeft,
|
||||||
List<String> configListValueLeft,
|
List<String> configListValueLeft,
|
||||||
|
|
||||||
String configStringValueRight,
|
String configStringValueRight,
|
||||||
Boolean configBooleanValueRight,
|
Boolean configBooleanValueRight,
|
||||||
Integer configIntegerValueRight,
|
Integer configIntegerValueRight,
|
||||||
Double configDoubleValueRight,
|
Double configDoubleValueRight,
|
||||||
List<String> configListValueRight,
|
List<String> configListValueRight,
|
||||||
|
|
||||||
Boolean pluginReloadEnable,
|
Boolean pluginReloadEnable,
|
||||||
String pluginReloadCommand,
|
String pluginReloadCommand,
|
||||||
Boolean functionVotePoints,
|
Boolean functionVotePoints,
|
||||||
FunctionVoteEnum functionVotePointsMode,
|
FunctionVoteEnum functionVotePointsMode,
|
||||||
Integer functionVotePointsAmount,
|
Integer functionVotePointsAmount,
|
||||||
Boolean functionItem,
|
Boolean functionItem,
|
||||||
FunctionItemEnum functionItemMode,
|
FunctionItemEnum functionItemMode,
|
||||||
String functionItemItem) {
|
String functionItemItem) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.empty = empty;
|
this.empty = empty;
|
||||||
this.itemAmount = itemAmount;
|
this.itemAmount = itemAmount;
|
@ -1,10 +1,8 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.objects.guis;
|
package net.t2code.commandguiv2.Spigot.objects;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class Gui {
|
public class GuiObject {
|
||||||
public Boolean guiEnable;
|
public Boolean guiEnable;
|
||||||
public Integer guiLines;
|
public Integer guiLines;
|
||||||
public String guiName;
|
public String guiName;
|
||||||
@ -14,10 +12,10 @@ public class Gui {
|
|||||||
public String key;
|
public String key;
|
||||||
public Boolean commandAliasEnable;
|
public Boolean commandAliasEnable;
|
||||||
public Boolean commandPermissionEnable;
|
public Boolean commandPermissionEnable;
|
||||||
public ArrayList<Slot> slots;
|
public ArrayList<SlotObject> slots;
|
||||||
|
|
||||||
public Gui(Boolean guiEnable, Integer guiLines, String guiName, Boolean guiFillitemEnable, String guiFillitemItem,
|
public GuiObject(Boolean guiEnable, Integer guiLines, String guiName, Boolean guiFillitemEnable, String guiFillitemItem,
|
||||||
String commandCommand, Boolean commandAliasEnable, Boolean commandPermissionEnable, ArrayList<Slot> slots){
|
String commandCommand, Boolean commandAliasEnable, Boolean commandPermissionEnable, ArrayList<SlotObject> slots){
|
||||||
this.guiEnable = guiEnable;
|
this.guiEnable = guiEnable;
|
||||||
this.guiLines = guiLines;
|
this.guiLines = guiLines;
|
||||||
this.guiName = guiName;
|
this.guiName = guiName;
|
@ -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 Integer slot;
|
||||||
public Boolean enable;
|
public Boolean enable;
|
||||||
@ -10,12 +10,12 @@ public class Slot {
|
|||||||
public String permissionToUse;
|
public String permissionToUse;
|
||||||
|
|
||||||
|
|
||||||
public Slot(Integer slot,
|
public SlotObject(Integer slot,
|
||||||
Boolean enable,
|
Boolean enable,
|
||||||
String function,
|
String function,
|
||||||
Boolean permission,
|
Boolean permission,
|
||||||
String permissionToSee,
|
String permissionToSee,
|
||||||
String permissionToUse
|
String permissionToUse
|
||||||
) {
|
) {
|
||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
this.enable = enable;
|
this.enable = enable;
|
@ -0,0 +1,4 @@
|
|||||||
|
package net.t2code.commandguiv2.Spigot.objects;
|
||||||
|
|
||||||
|
public class UseItemObject {
|
||||||
|
}
|
@ -2,32 +2,32 @@ package net.t2code.commandguiv2.Spigot.sound;
|
|||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class Sound {
|
public class PlaySound {
|
||||||
private static String prefix = Util.getPrefix();
|
private static String prefix = Util.getPrefix();
|
||||||
|
|
||||||
public static void play(Player player, SoundEnum soundEnum) {
|
public static void play(Player player, SoundEnum soundEnum) {
|
||||||
play(player, soundEnum, null, null, null);
|
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;
|
if (!(Boolean) Config.soundEnable.value) return;
|
||||||
switch (soundEnum) {
|
switch (soundEnum) {
|
||||||
case OpenInventory:
|
case OpenInventory:
|
||||||
if (!(Boolean) Config.soundOpenInventoryEnable.value) return;
|
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;
|
break;
|
||||||
case Click:
|
case Click:
|
||||||
if (!(Boolean) Config.soundClickEnable.value) return;
|
if (!(Boolean) Config.soundClickEnable.value) return;
|
||||||
if (!function.customSound_Enable) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,24 +37,24 @@ public class Sound {
|
|||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
|
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));
|
.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;
|
break;
|
||||||
case NoMoney:
|
case NoMoney:
|
||||||
if (!(Boolean) Config.soundNoMoneyEnable.value) return;
|
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;
|
break;
|
||||||
case NoInventorySpace:
|
case NoInventorySpace:
|
||||||
if (!(Boolean) Config.soundNoInventorySpaceEnable.value) return;
|
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;
|
break;
|
||||||
case Give:
|
case Give:
|
||||||
if (!(Boolean) Config.soundGiveEnable.value) return;
|
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;
|
break;
|
||||||
case PlayerNotFound:
|
case PlayerNotFound:
|
||||||
if (!(Boolean) Config.soundPlayerNotFoundEnable.value) return;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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.Config;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.ConfigSelect;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigSelect;
|
||||||
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
|
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterV5;
|
||||||
import net.t2code.commandguiv2.Spigot.gui.GUIListener;
|
import net.t2code.commandguiv2.Spigot.config.functions.SelectFunctions;
|
||||||
import net.t2code.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
|
import net.t2code.commandguiv2.Spigot.config.gui.SelectGui;
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.EventsFrom110;
|
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_GUI;
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUIItem;
|
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUIItem;
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_Help;
|
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.LanguagesCreate;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.database.MySQL;
|
import net.t2code.commandguiv2.Spigot.database.MySQL;
|
||||||
import net.t2code.commandguiv2.Spigot.listener.PluginEvent;
|
import net.t2code.commandguiv2.Spigot.function.listener.PluginEvent;
|
||||||
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.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.SQLITE;
|
||||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.StorageEnum;
|
import net.t2code.commandguiv2.Spigot.enums.StorageEnum;
|
||||||
@ -52,7 +51,7 @@ public class Load {
|
|||||||
|
|
||||||
T2Csend.console(prefix + " §8-------------------------------");
|
T2Csend.console(prefix + " §8-------------------------------");
|
||||||
try {
|
try {
|
||||||
ConfigConverterUnderV5.renameMainFolder();
|
ConfigConverterV5.renameMainFolder();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -92,8 +91,6 @@ public class Load {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectConfig.setConfigVersion();
|
|
||||||
|
|
||||||
if (T2CLibConfig.getBungee()) {
|
if (T2CLibConfig.getBungee()) {
|
||||||
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin, "t2c:bcmd")) {
|
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin, "t2c:bcmd")) {
|
||||||
T2Csend.debug(plugin, "registerOutgoingPluginChannel §et2c:bcmd");
|
T2Csend.debug(plugin, "registerOutgoingPluginChannel §et2c:bcmd");
|
||||||
@ -115,7 +112,12 @@ public class Load {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Obj_Select.onSelect();
|
SelectFunctions.onSelectFunction();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
SelectGui.onSelectGui();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.system;
|
package net.t2code.commandguiv2.Spigot.system;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
|
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
|
||||||
import org.bukkit.permissions.PermissionDefault;
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -66,10 +66,10 @@ public class Permissions {
|
|||||||
T2Cregister.permissionDescription(admin, "All permissions from T2C-CommandGUI", plugin);
|
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(command + "." + gui.key, op, plugin);
|
||||||
T2Cregister.permission(admin, op, command + "." + gui.key, true, 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(slot.permissionToUse, op, plugin);
|
||||||
T2Cregister.permission(admin, op, slot.permissionToUse, true, plugin);
|
T2Cregister.permission(admin, op, slot.permissionToUse, true, plugin);
|
||||||
T2Cregister.permission(slot.permissionToSee, op, plugin);
|
T2Cregister.permission(slot.permissionToSee, op, plugin);
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.system;
|
package net.t2code.commandguiv2.Spigot.system;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package net.t2code.commandguiv2.api;
|
package net.t2code.commandguiv2.api;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.ItemChange;
|
import net.t2code.commandguiv2.Spigot.function.useItem.ItemChange;
|
||||||
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.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Help;
|
import net.t2code.commandguiv2.Spigot.cmdManagement.Help;
|
||||||
import net.t2code.commandguiv2.Spigot.config.gui.CreateGUI;
|
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.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
||||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
||||||
|
Loading…
Reference in New Issue
Block a user