config recode in enum
This commit is contained in:
parent
cc9648315f
commit
f68916ef54
@ -75,7 +75,8 @@
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>14.1</version>
|
||||
<version>DEV-14.2</version>
|
||||
<classifier>1</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.config.gui.CreateGUI;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
@ -30,7 +31,7 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
||||
Player player = (Player) sender;
|
||||
Commands.gui(player);
|
||||
} else {
|
||||
if (args[0].equals(SelectConfig.getAdminSubCommand())) {
|
||||
if (args[0].equals(String.valueOf(Config.adminSubCommand.value))) {
|
||||
if (args.length == 1) {
|
||||
Help.sendHelp(sender, prefix);
|
||||
return false;
|
||||
@ -105,7 +106,7 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
T2Ctab.tab(list, sender, 0, args, arg1);
|
||||
T2Ctab.tab(list, sender, 0, SelectConfig.getAdminSubCommand(), 1, args, arg2);
|
||||
T2Ctab.tab(list, sender, 0, String.valueOf(Config.adminSubCommand.value), 1, args, arg2);
|
||||
T2Ctab.tab(list, sender, 1, "give", 2, args, "commandgui.giveitem.other", true);
|
||||
return list;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
@ -22,13 +23,13 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
||||
Player player = (Player) sender;
|
||||
if (sender.hasPermission("commandgui.useitem.toggle")) {
|
||||
if (args.length == 0) {
|
||||
if (SelectConfig.getUseItem_AllowToggle()) {
|
||||
if ((Boolean) Config.useItemAllowToggle.value) {
|
||||
Help.sendGUIItemHelp(sender);
|
||||
} else T2Csend.sender(sender, "§4UseItem toggle is disabled!");// todo
|
||||
} else {
|
||||
if (args.length == 1 || args.length == 2) {
|
||||
if (sender instanceof Player) {
|
||||
if (SelectConfig.getUseItem_AllowToggle()) {
|
||||
if ((Boolean) Config.useItemAllowToggle.value) {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "on":
|
||||
Commands.itemOn(player);
|
||||
@ -65,7 +66,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
||||
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
||||
put("on", "commandgui.useitem.toggle");
|
||||
put("off", "commandgui.useitem.toggle");
|
||||
if (SelectConfig.getUseItem_AllowSetSlot()) {
|
||||
if ((Boolean) Config.useItemAllowToggle.value) {
|
||||
put("slot", "commandgui.useitem.toggle");
|
||||
}
|
||||
}};
|
||||
@ -74,7 +75,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
|
||||
List<String> list = new ArrayList<>();
|
||||
if (sender instanceof Player) {
|
||||
if (SelectConfig.getUseItem_AllowToggle()) {
|
||||
if ((Boolean) Config.useItemAllowToggle.value) {
|
||||
Player p = (Player) sender;
|
||||
if (args.length == 1) {
|
||||
for (String command : arg1.keySet()) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.ConfigSelect;
|
||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.objects.Obj_Select;
|
||||
@ -37,13 +39,13 @@ public class Commands {
|
||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||
T2Csend.console(Util.getPrefix() + " §6Plugin reload...");
|
||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||
SelectConfig.onSelect();
|
||||
ConfigSelect.selectConfig();
|
||||
Main.getPlugin().reloadConfig();
|
||||
|
||||
CmdExecuter_GUI.arg1.clear();
|
||||
CmdExecuter_GUI.arg1.put(SelectConfig.getAdminSubCommand(), "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
|
||||
CmdExecuter_GUI.arg1.put(String.valueOf(Config.adminSubCommand.value), "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
|
||||
|
||||
if (!Objects.equals(SelectDatabase.getStorage().toString(), SelectConfig.getStorage())) {
|
||||
if (!Objects.equals(SelectDatabase.getStorage().toString(), Config.storage.value)) {
|
||||
if (sender instanceof Player) T2Csend.sender(sender, "You have changed the storage medium! To apply this change, you must restart the server!");
|
||||
T2Csend.warning(Main.getPlugin(), "You have changed the storage medium! To apply this change, you must restart the server!");
|
||||
}
|
||||
@ -52,7 +54,7 @@ public class Commands {
|
||||
|
||||
Obj_Select.onSelect();
|
||||
SelectMessages.onSelect(Util.getPrefix());
|
||||
SelectConfig.sound(Util.getPrefix());
|
||||
Config.sound();
|
||||
|
||||
try {
|
||||
AliasRegister.onRegister();
|
||||
@ -81,8 +83,8 @@ public class Commands {
|
||||
public static void give(CommandSender sender, Player target) {
|
||||
if (Bukkit.getPlayer(target.getName()) != null) {
|
||||
UseItem.giveUseItem(target);
|
||||
T2Csend.sender(sender, SelectMessages.Give_Sender.replace("[player]", target.getName()).replace("[item]", SelectConfig.getUseItem_Name()));
|
||||
T2Csend.player(target, SelectMessages.Give_Receiver.replace("[sender]", sender.getName()).replace("[item]", SelectConfig.getUseItem_Name()));
|
||||
T2Csend.sender(sender, SelectMessages.Give_Sender.replace("[player]", target.getName()).replace("[item]", String.valueOf(Config.useItemName.value)));
|
||||
T2Csend.player(target, SelectMessages.Give_Receiver.replace("[sender]", sender.getName()).replace("[item]",String.valueOf(Config.useItemName.value)));
|
||||
Sound.play(target, SoundEnum.Give);
|
||||
} else {
|
||||
sender.sendMessage(SelectMessages.PlayerNotFond.replace("[player]", target.getName()));
|
||||
@ -93,8 +95,8 @@ public class Commands {
|
||||
public static void itemOn(Player player) {
|
||||
UseItem.removeItem(player);
|
||||
Integer slot = null;
|
||||
if (SelectConfig.getUseItem_InventorySlotEnforce()) {
|
||||
slot = SelectConfig.getUseItem_InventorySlot();
|
||||
if ((Boolean) Config.useItemInventorySlotEnforce.value) {
|
||||
slot = (Integer) Config.useItemInventorySlot.value;
|
||||
} else {
|
||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||
}
|
||||
@ -128,7 +130,7 @@ public class Commands {
|
||||
}
|
||||
|
||||
public static void onSetSlot(Player player, Integer setSlot) {
|
||||
if (!SelectConfig.getUseItem_AllowSetSlot()) {
|
||||
if (!(Boolean) Config.useItemAllowSetSlot.value) {
|
||||
T2Csend.player(player, Util.getPrefix() + " §4Function disabled");
|
||||
return;
|
||||
}
|
||||
@ -149,7 +151,7 @@ public class Commands {
|
||||
}
|
||||
}
|
||||
|
||||
if (SelectConfig.getUseItem_InventorySlotEnforce() || player.getInventory().getItem(setSlot - 1) != null) {
|
||||
if ((Boolean) Config.useItemInventorySlotEnforce.value || player.getInventory().getItem(setSlot - 1) != null) {
|
||||
T2Csend.player(player, SelectMessages.ItemSlotNotEmpty.replace("[slot]", setSlot.toString()));
|
||||
return;
|
||||
}
|
||||
@ -166,11 +168,11 @@ public class Commands {
|
||||
}
|
||||
|
||||
public static void gui(Player player) {
|
||||
if (Main.guiHashMap.containsKey(SelectConfig.getDefaultGUI())) {
|
||||
Gui gui = Main.guiHashMap.get(SelectConfig.getDefaultGUI());
|
||||
if (Main.guiHashMap.containsKey(String.valueOf(Config.defaultGUI.value))) {
|
||||
Gui gui = Main.guiHashMap.get(String.valueOf(Config.defaultGUI.value));
|
||||
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) {
|
||||
OpenGUI.openGUI(player, SelectConfig.getDefaultGUI(), true);
|
||||
OpenGUI.openGUI(player, String.valueOf(Config.defaultGUI.value), true);
|
||||
} else T2Csend.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui")
|
||||
.replace("[perm]", "commandgui.command"));
|
||||
} else T2Csend.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", gui.guiName));
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||
@ -14,7 +15,7 @@ public class Help {
|
||||
private static String prefix = Util.getPrefix();
|
||||
|
||||
public static void sendHelp(CommandSender sender, String Prefix) {
|
||||
Gui gui = Main.guiHashMap.get(SelectConfig.getDefaultGUI());
|
||||
Gui gui = Main.guiHashMap.get(String.valueOf(Config.defaultGUI.value));
|
||||
|
||||
T2Csend.sender(sender, Prefix + " §8----- §4Command§9GUI §chelp §8-----");
|
||||
cgui(sender, gui);
|
||||
|
@ -1,115 +1,204 @@
|
||||
package net.t2code.commandguiv2.Spigot.config.config;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Spigot.enums.StorageEnum;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public enum Config {
|
||||
|
||||
debug("Plugins.Debug", false),
|
||||
updateCheckOnJoin("Plugin.updateCheck.onJoin", true),
|
||||
updateCheckSeePreReleaseUpdates("Plugin.updateCheck.seePreReleaseUpdates", true),
|
||||
updateCheckTimeInterval("Plugin.updateCheck.timeInterval", 60),
|
||||
helpAlias("Plugin.HelpAlias", true),
|
||||
adminSubCommand("Plugin.AdminSubCommand", "admin"),
|
||||
language("Plugin.language", "english"),
|
||||
currency("Plugin.Currency", "$"),
|
||||
defaultGUI("Plugin.DefaultGUI", "default"),
|
||||
configVersion("ConfigVersion", 6, true),
|
||||
debug("Plugins.Debug", false, false),
|
||||
updateCheckOnJoin("Plugin.updateCheck.onJoin", true, false),
|
||||
updateCheckSeePreReleaseUpdates("Plugin.updateCheck.seePreReleaseUpdates", true, false),
|
||||
updateCheckTimeInterval("Plugin.updateCheck.timeInterval", 60, false),
|
||||
helpAlias("Plugin.HelpAlias", true, false),
|
||||
adminSubCommand("Plugin.AdminSubCommand", "admin", false),
|
||||
language("Plugin.language", "english", false),
|
||||
currency("Plugin.Currency", "$", false),
|
||||
defaultGUI("Plugin.DefaultGUI", "default", false),
|
||||
|
||||
|
||||
storage("Storage.Type", "YML"),
|
||||
mysqlIp("Storage.MySQL.IP", "localhost"),
|
||||
mysqlPort("Storage.MySQL.Port", 3306),
|
||||
mysqlDatabase("Storage.MySQL.Database", "database"),
|
||||
mysqlUser("Storage.MySQL.User", "root"),
|
||||
mysqlPassword("Storage.MySQL.Password", "password"),
|
||||
mysqlSSL("Storage.MySQL.SSL", false),
|
||||
storage("Storage.Type", StorageEnum.SQLITE.name(), false),
|
||||
mysqlIp("Storage.MySQL.IP", "localhost", false),
|
||||
mysqlPort("Storage.MySQL.Port", 3306, false),
|
||||
mysqlDatabase("Storage.MySQL.Database", "database", false),
|
||||
mysqlUser("Storage.MySQL.User", "root", false),
|
||||
mysqlPassword("Storage.MySQL.Password", "password", false),
|
||||
mysqlSSL("Storage.MySQL.SSL", false, false),
|
||||
|
||||
|
||||
useItem_Enable("UseItem.Enable", true),
|
||||
UseItem_AllowToggle("UseItem.AllowToggle", true),
|
||||
UseItem_AllowSetSlot("UseItem.AllowSetSlot", true),
|
||||
UseItem_BlockMoveAndDrop("UseItem.BlockMoveAndDrop", true),
|
||||
UseItem_OpenGUI("UseItem.OpenGUI", "default"),
|
||||
UseItem_Permission("UseItem.Permission.NeededToUse", true),
|
||||
UseItem_KeepAtCommandClear("UseItem.KeepAtCommandClear", true),
|
||||
UseItem_InventorySlot_FreeSlot("UseItem.InventorySlot.FreeSlot", 1),
|
||||
UseItem_InventorySlot("UseItem.InventorySlot.Slot", false),
|
||||
UseItem_InventorySlotEnforce("UseItem.InventorySlot.SlotEnforce", false),
|
||||
UseItem_Material("UseItem.Item.Material", "paper"),
|
||||
useItemEnable("UseItem.Enable", true, false),
|
||||
useItemAllowToggle("UseItem.AllowToggle", true, false),
|
||||
useItemAllowSetSlot("UseItem.AllowSetSlot", true, false),
|
||||
useItemBlockMoveAndDrop("UseItem.BlockMoveAndDrop", true, false),
|
||||
useItemOpenGUI("UseItem.OpenGUI", "default", false),
|
||||
useItemPermission("UseItem.Permission.NeededToUse", true, false),
|
||||
useItemKeepAtCommandClear("UseItem.KeepAtCommandClear", true, false),
|
||||
useItemInventorySlotFreeSlot("UseItem.InventorySlot.FreeSlot", 1, false),
|
||||
useItemInventorySlot("UseItem.InventorySlot.Slot", false, false),
|
||||
useItemInventorySlotEnforce("UseItem.InventorySlot.SlotEnforce", false, false),
|
||||
useItemMaterial("UseItem.Item.Material", "paper", false),
|
||||
|
||||
|
||||
UseItem_PlayerHead_Enable("UseItem.Item.PlayerHead.Enable", false),
|
||||
UseItem_Base64_Enable("UseItem.Item.PlayerHead.Base64.Enable", false),
|
||||
UseItem_Base64value("UseItem.Item.PlayerHead.Base64.Base64Value", ""),
|
||||
UseItem_PlayerWhoHasOpenedTheGUI("UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI", false),
|
||||
UseItem_PlayerName("UseItem.Item.PlayerHead.PlayerName", ""),
|
||||
UseItem_Name("UseItem.Item.Name", "&bDefault &6GUI"),
|
||||
UseItem_Lore("UseItem.Item.Lore", Collections.singletonList("&eThis is an example GUI")),
|
||||
UseItem_GiveOnEveryJoin("UseItem.Join.GiveOnEveryJoin", true),
|
||||
UseItem_GiveOnlyOnFirstJoin("UseItem.Join.GiveOnlyOnFirstJoin", false),
|
||||
Cursor_ToGUIItem_OnLogin("UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable", true),
|
||||
Cursor_ToGUIItem_OnlyOnFirstLogin("UseItem.Join.Cursor.ToGUIItem.Spigot.OnlyOnFirstLogin", true),
|
||||
UseItem_ServerChange("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange", false),
|
||||
|
||||
useItemPlayerHeadEnable("UseItem.Item.PlayerHead.Enable", false, false),
|
||||
useItemBase64Enable("UseItem.Item.PlayerHead.Base64.Enable", false, false),
|
||||
useItemBase64value("UseItem.Item.PlayerHead.Base64.Base64Value", "", false),
|
||||
useItemPlayerWhoHasOpenedTheGUI("UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI", false, false),
|
||||
useItemPlayerName("UseItem.Item.PlayerHead.PlayerName", "", false),
|
||||
useItemName("UseItem.Item.Name", "&bDefault &6GUI", false),
|
||||
useItemLore("UseItem.Item.Lore", Collections.singletonList("&eThis is an example GUI"), false),
|
||||
useItemGiveOnEveryJoin("UseItem.Join.GiveOnEveryJoin", true, false),
|
||||
useItemGiveOnlyOnFirstJoin("UseItem.Join.GiveOnlyOnFirstJoin", false, false),
|
||||
cursorToGUIItemOnLogin("UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable", true, false),
|
||||
cursorToGUIItemOnlyOnFirstLogin("UseItem.Join.Cursor.ToGUIItem.Spigot.OnlyOnFirstLogin", true, false),
|
||||
useItemServerChange("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange", false, false),
|
||||
|
||||
|
||||
toggleItemOnOrYesBase64("Toggle.Items.OnOrYes.Item.Base64.Enable", false),
|
||||
toggleItemOnOrYesBase64Value("Toggle.Items.OnOrYes.Item.Base64.Base64Value", ""),
|
||||
toggleItemOnOrYesMaterial("Toggle.Items.OnOrYes.Item.Material", Main.legacy ? "WOOL,5" : T2CitemVersion.getGreenWool().getType().toString()),
|
||||
toggleItemOffOrNoBase64("Toggle.Items.OffOrNo.Item.Base64.Enable", false),
|
||||
toggleItemOffOrNoBase64Value("Toggle.Items.OffOrNo.Item.Base64.Base64Value", T2CitemVersion.getGreenWool().getType().toString()),
|
||||
toggleItemOffOrNoMaterial("Toggle.Items.OffOrNo.Item.Material", Main.legacy ? "WOOL,14" : T2CitemVersion.getRedWool().getType().toString()),
|
||||
toggleItemOnOrYesBase64("Toggle.Items.OnOrYes.Item.Base64.Enable", false, false),
|
||||
toggleItemOnOrYesBase64Value("Toggle.Items.OnOrYes.Item.Base64.Base64Value", "", false),
|
||||
toggleItemOnOrYesMaterial("Toggle.Items.OnOrYes.Item.Material", Main.legacy ? "WOOL,5" : T2CitemVersion.getGreenWool().getType().toString(), false),
|
||||
toggleItemOffOrNoBase64("Toggle.Items.OffOrNo.Item.Base64.Enable", false, false),
|
||||
toggleItemOffOrNoBase64Value("Toggle.Items.OffOrNo.Item.Base64.Base64Value", T2CitemVersion.getGreenWool().getType().toString(), false),
|
||||
toggleItemOffOrNoMaterial("Toggle.Items.OffOrNo.Item.Material", Main.legacy ? "WOOL,14" : T2CitemVersion.getRedWool().getType().toString(), false),
|
||||
|
||||
|
||||
togglePermTrue("Toggle.Permission.Commands.True", "luckperms user [player] permission set [perm] true"),
|
||||
togglePermFalse("Toggle.Permission.Commands.False", "luckperms user [player] permission set [perm] false"),
|
||||
placeholderTrue("Placeholder.True", "&2true"),
|
||||
placeholderFalse("Placeholder.False", "&4false"),
|
||||
togglePermTrue("Toggle.Permission.Commands.True", "luckperms user [player] permission set [perm] true", false),
|
||||
togglePermFalse("Toggle.Permission.Commands.False", "luckperms user [player] permission set [perm] false", false),
|
||||
placeholderTrue("Placeholder.True", "&2true", false),
|
||||
placeholderFalse("Placeholder.False", "&4false", false),
|
||||
|
||||
|
||||
Sound_Enable("Sound.Enable", true),
|
||||
Sound_OpenInventory_Enable("Sound.OpenInventory.Sound", true),
|
||||
Sound_OpenInventory_input("Sound.OpenInventory.Sound", null), //todo sound create class
|
||||
Sound_Click_Enable("Sound.Click.Enable", null),
|
||||
Sound_Click_input("Sound.Click.Sound", null),
|
||||
Sound_NoMoney_Enable("Sound.NoMoney.Enable", null),
|
||||
Sound_NoMoney_input("Sound.NoMoney.Sound", null),
|
||||
soundEnable("Sound.Enable", true, false),
|
||||
soundOpenInventoryEnable("Sound.OpenInventory.Enable", true, false),
|
||||
soundOpenInventoryInput("Sound.OpenInventory.Sound", getOpenInventory().toString(), false),
|
||||
soundClickEnable("Sound.Click.Enable", true, false),
|
||||
soundClickInput("Sound.Click.Sound", getClick().toString(), false),
|
||||
soundNoMoneyEnable("Sound.NoMoney.Enable", true, false),
|
||||
soundNoMoneyInput("Sound.NoMoney.Sound", getNoMoney().toString(), false),
|
||||
soundNoInventorySpaceEnable("Sound.NoInventorySpace.Enable", true, false),
|
||||
soundNoInventorySpaceInput("Sound.NoInventorySpace.Sound", getNoInventorySpace().toString(), false),
|
||||
soundGiveEnable("Sound.Give.Enable", true, false),
|
||||
soundGiveInput("Sound.Give.Sound", getGive().toString(), false),
|
||||
soundPlayerNotFoundEnable("Sound.PlayerNotFound.Enable", true, false),
|
||||
soundPlayerNotFoundInput("Sound.PlayerNotFound.Sound", getPlayerNotFound().toString(), false),
|
||||
|
||||
|
||||
Sound_NoInventorySpace_Enable("Sound.NoInventorySpace.Enable", null),
|
||||
Sound_NoInventorySpace_input("Sound.NoInventorySpace.Sound", null),
|
||||
Sound_Give_Enable("Sound.Give.Enable", null),
|
||||
Sound_Give_input("Sound.Give.Sound", null),
|
||||
Sound_PlayerNotFound_Enable("Sound.PlayerNotFound.Enable", null),
|
||||
Sound_PlayerNotFound_input("Sound.PlayerNotFound.Sound", null),
|
||||
useItemGameModeChangeEnable("Advanced.UseItem.GameMode.Change.Enable", true, false),
|
||||
useItemGameModeChangeDelayInTicks("Advanced.UseItem.GameMode.Change.DelayInTicks", 1, false),
|
||||
useItemGameModeProtection("Advanced.UseItem.GameMode.Protection.Enable", false, false),
|
||||
useItemGameModeRemoveItemWhenItIsDisabled("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled", false, false),
|
||||
useItemGameModeMode("Advanced.UseItem.GameMode.Protection.Mode", "blacklist", false),
|
||||
useItemGameModeList("Advanced.UseItem.GameMode.Protection.List", Arrays.asList("CREATIVE", "Spectator"), false),
|
||||
|
||||
useItemWorldChangeEnable("Advanced.UseItem.World.Change.Enable", true, false),
|
||||
useItemWorldChangeDelayInTicks("Advanced.UseItem.World.Change.DelayInTicks", 1, false),
|
||||
useItemWorldProtection("Advanced.UseItem.World.Protection.Enable", false, false),
|
||||
useItemWorldRemoveItemWhenItIsDisabled("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled", false, false),
|
||||
useItemWorldMode("Advanced.UseItem.World.Protection.Mode", "blacklist", false),
|
||||
useItemWorldList("Advanced.UseItem.World.Protection.List", Arrays.asList("World1", "World2"), false),
|
||||
|
||||
|
||||
UseItemGameModeChangeEnable("Advanced.UseItem.GameMode.Change.Enable", null),
|
||||
UseItemGameModeChangeDelayInTicks("Advanced.UseItem.GameMode.Change.DelayInTicks", null),
|
||||
UseItemGameModeProtection("Advanced.UseItem.GameMode.Protection.Enable", null),
|
||||
UseItemGameModeRemoveItemWhenItIsDisabled("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled", null),
|
||||
UseItemGameModeMode("Advanced.UseItem.GameMode.Protection.Mode", null),
|
||||
UseItemGameModeList("Advanced.UseItem.GameMode.Protection.List", null),
|
||||
|
||||
UseItemWorldChangeEnable("Advanced.UseItem.World.Change.Enable", null),
|
||||
UseItemWorldChangeDelayInTicks("Advanced.UseItem.World.Change.DelayInTicks", null),
|
||||
UseItemWorldProtection("Advanced.UseItem.World.Protection.Enable", null),
|
||||
UseItemWorldRemoveItemWhenItIsDisabled("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled", null),
|
||||
UseItemWorldMode("Advanced.UseItem.World.Protection.Mode", null),
|
||||
UseItemWorldList("Advanced.UseItem.World.Protection.List", null),
|
||||
|
||||
|
||||
disableInfoBySneak("Advanced.UseItem.DisableInfoBySneak", null),
|
||||
UseItemItemBlockBlacklist("Advanced.UseItem.ItemBlockBlacklist", null);
|
||||
disableInfoBySneak("Advanced.UseItem.DisableInfoBySneak", false, false),
|
||||
useItemItemBlockBlacklist("Advanced.UseItem.ItemBlockBlacklist", getItemBlockBlacklist(), false);
|
||||
|
||||
|
||||
public final String path;
|
||||
public Object value;
|
||||
public final boolean forceSet;
|
||||
|
||||
Config(String path, Object defaultValue) {
|
||||
Config(String path, Object defaultValue, boolean forceSet) {
|
||||
this.path = path;
|
||||
this.value = defaultValue;
|
||||
this.forceSet = forceSet;
|
||||
}
|
||||
|
||||
public static void sound() {
|
||||
check(soundOpenInventoryInput,getOpenInventory());
|
||||
check(soundNoMoneyInput,getNoMoney());
|
||||
check(soundNoInventorySpaceInput,getNoInventorySpace());
|
||||
check(soundGiveInput,getGive());
|
||||
check(soundPlayerNotFoundInput,getPlayerNotFound());
|
||||
}
|
||||
|
||||
private static void check(Config object, Sound defaultSound){
|
||||
try {
|
||||
Sound sound = Sound.valueOf(String.valueOf(object.value));
|
||||
if (sound != null) {
|
||||
object.value = defaultSound;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Util.getPrefix())
|
||||
.replace("[sound]", "§8OpenInventory: §6" + object.value) + "§4\n§4\n§4\n");
|
||||
object.value = defaultSound;
|
||||
}
|
||||
}
|
||||
|
||||
private static Sound getOpenInventory() {
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
return Sound.valueOf("CHEST_OPEN");
|
||||
} else return Sound.valueOf("BLOCK_CHEST_OPEN");
|
||||
}
|
||||
|
||||
private static Sound getClick() {
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
return Sound.valueOf("NOTE_STICKS");
|
||||
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
return Sound.valueOf("BLOCK_NOTE_HAT");
|
||||
} else return Sound.valueOf("BLOCK_NOTE_BLOCK_HAT");
|
||||
}
|
||||
|
||||
private static Sound getNoMoney() {
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
return Sound.valueOf("NOTE_PIANO");
|
||||
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
return Sound.valueOf("BLOCK_NOTE_HARP");
|
||||
} else return Sound.valueOf("BLOCK_NOTE_BLOCK_HARP");
|
||||
}
|
||||
|
||||
private static Sound getNoInventorySpace() {
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
return Sound.valueOf("NOTE_PIANO");
|
||||
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
return Sound.valueOf("BLOCK_NOTE_HARP");
|
||||
} else return Sound.valueOf("BLOCK_NOTE_BLOCK_HARP");
|
||||
}
|
||||
|
||||
private static Sound getGive() {
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
return Sound.valueOf("LEVEL_UP");
|
||||
} else return Sound.valueOf("ENTITY_PLAYER_LEVELUP");
|
||||
}
|
||||
|
||||
private static Sound getPlayerNotFound() {
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
return Sound.valueOf("NOTE_PIANO");
|
||||
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
return Sound.valueOf("BLOCK_NOTE_HARP");
|
||||
} else return Sound.valueOf("BLOCK_NOTE_BLOCK_HARP");
|
||||
}
|
||||
|
||||
private static List<String> getItemBlockBlacklist() {
|
||||
List<String> materialList = Arrays.asList("BUTTON", "DOOR", "FENCE", "CHEST", "FURNACE", "NOTE_BLOCK", "CRAFTING_TABLE", "WORKBENCH",
|
||||
"ANVIL", "LOOM", "COMPOSTER", "BARREL", "SMOKER", "BLAST_FURNACE", "CARTOGRAPHY_TABLE", "FLETCHING_TABLE", "GRINDSTONE",
|
||||
"SMITHING_TABLE", "STONECUTTER", "HOPPER", "DISPENSER", "DROPPER", "REPEATER", "COMPARATOR", "LEVER", "DAYLIGHT_DETECTOR", "BREWING_STAND", "TRAPDOOR", "BEACON"
|
||||
);
|
||||
|
||||
List<String> materialBlacklist = new ArrayList<>();
|
||||
for (Material material : Material.values()) {
|
||||
if (materialList.contains(material.toString())) materialBlacklist.add(material.toString());
|
||||
}
|
||||
return materialBlacklist;
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,12 @@ public class ConfigSelect {
|
||||
public static void selectConfig() {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
for (Config value : Config.values()) {
|
||||
T2Cconfig.set(value.path, value.value, yamlConfiguration);
|
||||
value.value = T2Cconfig.selectObject(String.valueOf(Config.messagesPrefix.value), value.path, yamlConfiguration);
|
||||
if (value.forceSet) {
|
||||
yamlConfiguration.set(value.path, value.value);
|
||||
} else T2Cconfig.set(value.path, value.value, yamlConfiguration);
|
||||
value.value = T2Cconfig.selectObject(Util.getPrefix(), value.path, yamlConfiguration);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -368,335 +368,335 @@ public class SelectConfig {
|
||||
private static Sound Sound_PlayerNotFound;
|
||||
private static String Sound_PlayerNotFound_input;
|
||||
|
||||
public static Boolean getDebug() {
|
||||
return Debug;
|
||||
}
|
||||
|
||||
public static Boolean getUpdateCheckOnJoin() {
|
||||
return updateCheckOnJoin;
|
||||
}
|
||||
|
||||
public static Boolean getUpdateCheckSeePreReleaseUpdates() {
|
||||
return updateCheckSeePreReleaseUpdates;
|
||||
}
|
||||
|
||||
public static Integer getUpdateCheckTimeInterval() {
|
||||
return updateCheckTimeInterval;
|
||||
}
|
||||
|
||||
public static Boolean getHelpAlias() {
|
||||
return HelpAlias;
|
||||
}
|
||||
|
||||
public static String getAdminSubCommand() {
|
||||
return adminSubCommand;
|
||||
}
|
||||
|
||||
public static String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public static String getCurrency() {
|
||||
return Currency;
|
||||
}
|
||||
|
||||
public static String getStorage() {
|
||||
return storage;
|
||||
}
|
||||
|
||||
public static String getMysqlIp() {
|
||||
return mysqlIp;
|
||||
}
|
||||
|
||||
public static Integer getMysqlPort() {
|
||||
return mysqlPort;
|
||||
}
|
||||
|
||||
public static String getMysqlDatabase() {
|
||||
return mysqlDatabase;
|
||||
}
|
||||
|
||||
public static String getMysqlUser() {
|
||||
return mysqlUser;
|
||||
}
|
||||
|
||||
public static String getMysqlPassword() {
|
||||
return mysqlPassword;
|
||||
}
|
||||
|
||||
public static Boolean getMysqlSSL() {
|
||||
return mysqlSSL;
|
||||
}
|
||||
|
||||
public static Boolean getBungee() {
|
||||
return Bungee;
|
||||
}
|
||||
|
||||
public static String getDefaultGUI() {
|
||||
return DefaultGUI;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_Enable() {
|
||||
return UseItem_Enable;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_AllowToggle() {
|
||||
return UseItem_AllowToggle;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_AllowSetSlot() {
|
||||
return UseItem_AllowSetSlot;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_GiveOnEveryJoin() {
|
||||
return UseItem_GiveOnEveryJoin;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_GiveOnlyOnFirstJoin() {
|
||||
return UseItem_GiveOnlyOnFirstJoin;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_ServerChange() {
|
||||
return UseItem_ServerChange;
|
||||
}
|
||||
|
||||
public static Boolean getCursor_ToGUIItem_OnLogin() {
|
||||
return Cursor_ToGUIItem_OnLogin;
|
||||
}
|
||||
|
||||
public static Boolean getCursor_ToGUIItem_OnlyOnFirstLogin() {
|
||||
return Cursor_ToGUIItem_OnlyOnFirstLogin;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_BlockMoveAndDrop() {
|
||||
return UseItem_BlockMoveAndDrop;
|
||||
}
|
||||
|
||||
public static String getUseItem_OpenGUI() {
|
||||
return UseItem_OpenGUI;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_Permission() {
|
||||
return UseItem_Permission;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_KeepAtCommandClear() {
|
||||
return UseItem_KeepAtCommandClear;
|
||||
}
|
||||
|
||||
public static Boolean getUseItemGameModeChangeEnable() {
|
||||
return UseItemGameModeChangeEnable;
|
||||
}
|
||||
|
||||
public static int getUseItemGameModeChangeDelayInTicks() {
|
||||
return UseItemGameModeChangeDelayInTicks;
|
||||
}
|
||||
|
||||
public static Boolean getUseItemGameModeProtection() {
|
||||
return UseItemGameModeProtection;
|
||||
}
|
||||
|
||||
public static Boolean getUseItemGameModeRemoveItemWhenItIsDisabled() {
|
||||
return UseItemGameModeRemoveItemWhenItIsDisabled;
|
||||
}
|
||||
|
||||
public static String getUseItemGameModeMode() {
|
||||
return UseItemGameModeMode;
|
||||
}
|
||||
|
||||
public static List<String> getUseItemGameModeList() {
|
||||
return UseItemGameModeList;
|
||||
}
|
||||
|
||||
public static Boolean getUseItemWorldChangeEnable() {
|
||||
return UseItemWorldChangeEnable;
|
||||
}
|
||||
|
||||
public static int getUseItemWorldChangeDelayInTicks() {
|
||||
return UseItemWorldChangeDelayInTicks;
|
||||
}
|
||||
|
||||
public static Boolean getUseItemWorldProtection() {
|
||||
return UseItemWorldProtection;
|
||||
}
|
||||
|
||||
public static Boolean getUseItemWorldRemoveItemWhenItIsDisabled() {
|
||||
return UseItemWorldRemoveItemWhenItIsDisabled;
|
||||
}
|
||||
|
||||
public static String getUseItemWorldMode() {
|
||||
return UseItemWorldMode;
|
||||
}
|
||||
|
||||
public static List<String> getUseItemWorldList() {
|
||||
return UseItemWorldList;
|
||||
}
|
||||
|
||||
public static List<String> getUseItemItemBlockBlacklist() {
|
||||
return UseItemItemBlockBlacklist;
|
||||
}
|
||||
|
||||
public static Boolean getDisableInfoBySneak() {
|
||||
return disableInfoBySneak;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_InventorySlot_FreeSlot() {
|
||||
return UseItem_InventorySlot_FreeSlot;
|
||||
}
|
||||
|
||||
public static Integer getUseItem_InventorySlot() {
|
||||
return UseItem_InventorySlot;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_InventorySlotEnforce() {
|
||||
return UseItem_InventorySlotEnforce;
|
||||
}
|
||||
|
||||
public static String getUseItem_Material() {
|
||||
return UseItem_Material;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_PlayerHead_Enable() {
|
||||
return UseItem_PlayerHead_Enable;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_Base64_Enable() {
|
||||
return UseItem_Base64_Enable;
|
||||
}
|
||||
|
||||
public static String getUseItem_Base64value() {
|
||||
return UseItem_Base64value;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_PlayerWhoHasOpenedTheGUI() {
|
||||
return UseItem_PlayerWhoHasOpenedTheGUI;
|
||||
}
|
||||
|
||||
public static String getUseItem_PlayerName() {
|
||||
return UseItem_PlayerName;
|
||||
}
|
||||
|
||||
public static String getUseItem_Name() {
|
||||
return UseItem_Name;
|
||||
}
|
||||
|
||||
public static List<String> getUseItem_Lore() {
|
||||
return UseItem_Lore;
|
||||
}
|
||||
|
||||
public static Boolean getToggleItemOnOrYesBase64() {
|
||||
return toggleItemOnOrYesBase64;
|
||||
}
|
||||
|
||||
public static String getToggleItemOnOrYesBase64Value() {
|
||||
return toggleItemOnOrYesBase64Value;
|
||||
}
|
||||
|
||||
public static String getToggleItemOnOrYesMaterial() {
|
||||
return toggleItemOnOrYesMaterial;
|
||||
}
|
||||
|
||||
public static Boolean getToggleItemOffOrNoBase64() {
|
||||
return toggleItemOffOrNoBase64;
|
||||
}
|
||||
|
||||
public static String getToggleItemOffOrNoBase64Value() {
|
||||
return toggleItemOffOrNoBase64Value;
|
||||
}
|
||||
|
||||
public static String getToggleItemOffOrNoMaterial() {
|
||||
return toggleItemOffOrNoMaterial;
|
||||
}
|
||||
|
||||
public static String getTogglePermTrue() {
|
||||
return togglePermTrue;
|
||||
}
|
||||
|
||||
public static String getTogglePermFalse() {
|
||||
return togglePermFalse;
|
||||
}
|
||||
|
||||
public static String getPlaceholderTrue() {
|
||||
return placeholderTrue;
|
||||
}
|
||||
|
||||
public static String getPlaceholderFalse() {
|
||||
return placeholderFalse;
|
||||
}
|
||||
|
||||
public static Boolean getSound_Enable() {
|
||||
return Sound_Enable;
|
||||
}
|
||||
|
||||
public static Boolean getSound_OpenInventory_Enable() {
|
||||
return Sound_OpenInventory_Enable;
|
||||
}
|
||||
|
||||
public static Sound getSound_OpenInventory() {
|
||||
return Sound_OpenInventory;
|
||||
}
|
||||
|
||||
public static String getSound_OpenInventory_input() {
|
||||
return Sound_OpenInventory_input;
|
||||
}
|
||||
|
||||
public static Boolean getSound_Click_Enable() {
|
||||
return Sound_Click_Enable;
|
||||
}
|
||||
|
||||
public static Sound getSound_Click() {
|
||||
return Sound_Click;
|
||||
}
|
||||
|
||||
public static String getSound_Click_input() {
|
||||
return Sound_Click_input;
|
||||
}
|
||||
|
||||
public static Boolean getSound_NoMoney_Enable() {
|
||||
return Sound_NoMoney_Enable;
|
||||
}
|
||||
|
||||
public static Sound getSound_NoMoney() {
|
||||
return Sound_NoMoney;
|
||||
}
|
||||
|
||||
public static String getSound_NoMoney_input() {
|
||||
return Sound_NoMoney_input;
|
||||
}
|
||||
|
||||
public static Boolean getSound_NoInventorySpace_Enable() {
|
||||
return Sound_NoInventorySpace_Enable;
|
||||
}
|
||||
|
||||
public static Sound getSound_NoInventorySpace() {
|
||||
return Sound_NoInventorySpace;
|
||||
}
|
||||
|
||||
public static String getSound_NoInventorySpace_input() {
|
||||
return Sound_NoInventorySpace_input;
|
||||
}
|
||||
|
||||
public static Boolean getSound_Give_Enable() {
|
||||
return Sound_Give_Enable;
|
||||
}
|
||||
|
||||
public static Sound getSound_Give() {
|
||||
return Sound_Give;
|
||||
}
|
||||
|
||||
public static String getSound_Give_input() {
|
||||
return Sound_Give_input;
|
||||
}
|
||||
|
||||
public static Boolean getSound_PlayerNotFound_Enable() {
|
||||
return Sound_PlayerNotFound_Enable;
|
||||
}
|
||||
|
||||
public static Sound getSound_PlayerNotFound() {
|
||||
return Sound_PlayerNotFound;
|
||||
}
|
||||
|
||||
public static String getSound_PlayerNotFound_input() {
|
||||
return Sound_PlayerNotFound_input;
|
||||
}
|
||||
// public static Boolean getDebug() {
|
||||
// return Debug;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUpdateCheckOnJoin() {
|
||||
// return updateCheckOnJoin;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUpdateCheckSeePreReleaseUpdates() {
|
||||
// return updateCheckSeePreReleaseUpdates;
|
||||
// }
|
||||
//
|
||||
// public static Integer getUpdateCheckTimeInterval() {
|
||||
// return updateCheckTimeInterval;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getHelpAlias() {
|
||||
// return HelpAlias;
|
||||
// }
|
||||
//
|
||||
// public static String getAdminSubCommand() {
|
||||
// return adminSubCommand;
|
||||
// }
|
||||
//
|
||||
// public static String getLanguage() {
|
||||
// return language;
|
||||
// }
|
||||
//
|
||||
// public static String getCurrency() {
|
||||
// return Currency;
|
||||
// }
|
||||
//
|
||||
// public static String getStorage() {
|
||||
// return storage;
|
||||
// }
|
||||
//
|
||||
// public static String getMysqlIp() {
|
||||
// return mysqlIp;
|
||||
// }
|
||||
//
|
||||
// public static Integer getMysqlPort() {
|
||||
// return mysqlPort;
|
||||
// }
|
||||
//
|
||||
// public static String getMysqlDatabase() {
|
||||
// return mysqlDatabase;
|
||||
// }
|
||||
//
|
||||
// public static String getMysqlUser() {
|
||||
// return mysqlUser;
|
||||
// }
|
||||
//
|
||||
// public static String getMysqlPassword() {
|
||||
// return mysqlPassword;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getMysqlSSL() {
|
||||
// return mysqlSSL;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getBungee() {
|
||||
// return Bungee;
|
||||
// }
|
||||
//
|
||||
// public static String getDefaultGUI() {
|
||||
// return DefaultGUI;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItem_Enable() {
|
||||
// return UseItem_Enable;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItem_AllowToggle() {
|
||||
// return UseItem_AllowToggle;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItem_AllowSetSlot() {
|
||||
// return UseItem_AllowSetSlot;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItem_GiveOnEveryJoin() {
|
||||
// return UseItem_GiveOnEveryJoin;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItem_GiveOnlyOnFirstJoin() {
|
||||
// return UseItem_GiveOnlyOnFirstJoin;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItem_ServerChange() {
|
||||
// return UseItem_ServerChange;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getCursor_ToGUIItem_OnLogin() {
|
||||
// return Cursor_ToGUIItem_OnLogin;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getCursor_ToGUIItem_OnlyOnFirstLogin() {
|
||||
// return Cursor_ToGUIItem_OnlyOnFirstLogin;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItem_BlockMoveAndDrop() {
|
||||
// return UseItem_BlockMoveAndDrop;
|
||||
// }
|
||||
//
|
||||
// public static String getUseItem_OpenGUI() {
|
||||
// return UseItem_OpenGUI;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItem_Permission() {
|
||||
// return UseItem_Permission;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItem_KeepAtCommandClear() {
|
||||
// return UseItem_KeepAtCommandClear;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItemGameModeChangeEnable() {
|
||||
// return UseItemGameModeChangeEnable;
|
||||
// }
|
||||
//
|
||||
// public static int getUseItemGameModeChangeDelayInTicks() {
|
||||
// return UseItemGameModeChangeDelayInTicks;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItemGameModeProtection() {
|
||||
// return UseItemGameModeProtection;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItemGameModeRemoveItemWhenItIsDisabled() {
|
||||
// return UseItemGameModeRemoveItemWhenItIsDisabled;
|
||||
// }
|
||||
//
|
||||
// public static String getUseItemGameModeMode() {
|
||||
// return UseItemGameModeMode;
|
||||
// }
|
||||
//
|
||||
// public static List<String> getUseItemGameModeList() {
|
||||
// return UseItemGameModeList;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItemWorldChangeEnable() {
|
||||
// return UseItemWorldChangeEnable;
|
||||
// }
|
||||
//
|
||||
// public static int getUseItemWorldChangeDelayInTicks() {
|
||||
// return UseItemWorldChangeDelayInTicks;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItemWorldProtection() {
|
||||
// return UseItemWorldProtection;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItemWorldRemoveItemWhenItIsDisabled() {
|
||||
// return UseItemWorldRemoveItemWhenItIsDisabled;
|
||||
// }
|
||||
//
|
||||
// public static String getUseItemWorldMode() {
|
||||
// return UseItemWorldMode;
|
||||
// }
|
||||
//
|
||||
// public static List<String> getUseItemWorldList() {
|
||||
// return UseItemWorldList;
|
||||
// }
|
||||
//
|
||||
// public static List<String> getUseItemItemBlockBlacklist() {
|
||||
// return UseItemItemBlockBlacklist;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getDisableInfoBySneak() {
|
||||
// return disableInfoBySneak;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItem_InventorySlot_FreeSlot() {
|
||||
// return UseItem_InventorySlot_FreeSlot;
|
||||
// }
|
||||
//
|
||||
// public static Integer getUseItem_InventorySlot() {
|
||||
// return UseItem_InventorySlot;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItem_InventorySlotEnforce() {
|
||||
// return UseItem_InventorySlotEnforce;
|
||||
// }
|
||||
//
|
||||
// public static String getUseItem_Material() {
|
||||
// return UseItem_Material;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItem_PlayerHead_Enable() {
|
||||
// return UseItem_PlayerHead_Enable;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItem_Base64_Enable() {
|
||||
// return UseItem_Base64_Enable;
|
||||
// }
|
||||
//
|
||||
// public static String getUseItem_Base64value() {
|
||||
// return UseItem_Base64value;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getUseItem_PlayerWhoHasOpenedTheGUI() {
|
||||
// return UseItem_PlayerWhoHasOpenedTheGUI;
|
||||
// }
|
||||
//
|
||||
// public static String getUseItem_PlayerName() {
|
||||
// return UseItem_PlayerName;
|
||||
// }
|
||||
//
|
||||
// public static String getUseItem_Name() {
|
||||
// return UseItem_Name;
|
||||
// }
|
||||
//
|
||||
// public static List<String> getUseItem_Lore() {
|
||||
// return UseItem_Lore;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getToggleItemOnOrYesBase64() {
|
||||
// return toggleItemOnOrYesBase64;
|
||||
// }
|
||||
//
|
||||
// public static String getToggleItemOnOrYesBase64Value() {
|
||||
// return toggleItemOnOrYesBase64Value;
|
||||
// }
|
||||
//
|
||||
// public static String getToggleItemOnOrYesMaterial() {
|
||||
// return toggleItemOnOrYesMaterial;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getToggleItemOffOrNoBase64() {
|
||||
// return toggleItemOffOrNoBase64;
|
||||
// }
|
||||
//
|
||||
// public static String getToggleItemOffOrNoBase64Value() {
|
||||
// return toggleItemOffOrNoBase64Value;
|
||||
// }
|
||||
//
|
||||
// public static String getToggleItemOffOrNoMaterial() {
|
||||
// return toggleItemOffOrNoMaterial;
|
||||
// }
|
||||
//
|
||||
// public static String getTogglePermTrue() {
|
||||
// return togglePermTrue;
|
||||
// }
|
||||
//
|
||||
// public static String getTogglePermFalse() {
|
||||
// return togglePermFalse;
|
||||
// }
|
||||
//
|
||||
// public static String getPlaceholderTrue() {
|
||||
// return placeholderTrue;
|
||||
// }
|
||||
//
|
||||
// public static String getPlaceholderFalse() {
|
||||
// return placeholderFalse;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getSound_Enable() {
|
||||
// return Sound_Enable;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getSound_OpenInventory_Enable() {
|
||||
// return Sound_OpenInventory_Enable;
|
||||
// }
|
||||
//
|
||||
// public static Sound getSound_OpenInventory() {
|
||||
// return Sound_OpenInventory;
|
||||
// }
|
||||
//
|
||||
// public static String getSound_OpenInventory_input() {
|
||||
// return Sound_OpenInventory_input;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getSound_Click_Enable() {
|
||||
// return Sound_Click_Enable;
|
||||
// }
|
||||
//
|
||||
// public static Sound getSound_Click() {
|
||||
// return Sound_Click;
|
||||
// }
|
||||
//
|
||||
// public static String getSound_Click_input() {
|
||||
// return Sound_Click_input;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getSound_NoMoney_Enable() {
|
||||
// return Sound_NoMoney_Enable;
|
||||
// }
|
||||
//
|
||||
// public static Sound getSound_NoMoney() {
|
||||
// return Sound_NoMoney;
|
||||
// }
|
||||
//
|
||||
// public static String getSound_NoMoney_input() {
|
||||
// return Sound_NoMoney_input;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getSound_NoInventorySpace_Enable() {
|
||||
// return Sound_NoInventorySpace_Enable;
|
||||
// }
|
||||
//
|
||||
// public static Sound getSound_NoInventorySpace() {
|
||||
// return Sound_NoInventorySpace;
|
||||
// }
|
||||
//
|
||||
// public static String getSound_NoInventorySpace_input() {
|
||||
// return Sound_NoInventorySpace_input;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getSound_Give_Enable() {
|
||||
// return Sound_Give_Enable;
|
||||
// }
|
||||
//
|
||||
// public static Sound getSound_Give() {
|
||||
// return Sound_Give;
|
||||
// }
|
||||
//
|
||||
// public static String getSound_Give_input() {
|
||||
// return Sound_Give_input;
|
||||
// }
|
||||
//
|
||||
// public static Boolean getSound_PlayerNotFound_Enable() {
|
||||
// return Sound_PlayerNotFound_Enable;
|
||||
// }
|
||||
//
|
||||
// public static Sound getSound_PlayerNotFound() {
|
||||
// return Sound_PlayerNotFound;
|
||||
// }
|
||||
//
|
||||
// public static String getSound_PlayerNotFound_input() {
|
||||
// return Sound_PlayerNotFound_input;
|
||||
// }
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
package net.t2code.commandguiv2.Spigot.config.configConverter;
|
||||
|
||||
public class ConfigConverterUnderV6 {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package net.t2code.commandguiv2.Spigot.config.languages;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||
@ -87,17 +88,17 @@ public class SelectMessages {
|
||||
|
||||
File msg;
|
||||
|
||||
msg = new File(Main.getPath(), "languages/" + SelectConfig.getLanguage() + "_messages.yml");
|
||||
msg = new File(Main.getPath(), "languages/" + Config.language.value + "_messages.yml");
|
||||
if (!msg.isFile()) {
|
||||
T2Csend.console(Prefix);
|
||||
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.console(Prefix + " §4The selected §c" + SelectConfig.getLanguage() + " §4language file was not found.");
|
||||
T2Csend.console(Prefix + " §4The selected §c" + Config.language.value + " §4language file was not found.");
|
||||
T2Csend.console(Prefix + " §6The default language §eEnglish §6is used!");
|
||||
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.console(Prefix);
|
||||
msg = new File(Main.getPath(), "languages/" + "english_messages.yml");
|
||||
selectMSG = "english";
|
||||
} else selectMSG = SelectConfig.getLanguage();
|
||||
} else selectMSG = String.valueOf(Config.language.value);
|
||||
YamlConfiguration yamlConfiguration_msg = YamlConfiguration.loadConfiguration(msg);
|
||||
|
||||
VaultNotSetUp = select("Plugin.VaultNotSetUp", yamlConfiguration_msg);
|
||||
|
@ -3,6 +3,7 @@ package net.t2code.commandguiv2.Spigot.database;
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
@ -24,11 +25,11 @@ public class MySQL {
|
||||
ZoneId timeZone = now.getTimeZone().toZoneId();
|
||||
T2Csend.debug(Main.getPlugin(), "Server TimeZone is : " + timeZone);
|
||||
try {
|
||||
config.setJdbcUrl("jdbc:mysql://" + SelectConfig.getMysqlIp() + ":" + SelectConfig.getMysqlPort() + "/" + SelectConfig.getMysqlDatabase()
|
||||
config.setJdbcUrl("jdbc:mysql://" + Config.mysqlIp.value + ":" + Config.mysqlPort.value + "/" + Config.mysqlDatabase.value
|
||||
+ "?useJDBCCompliantTimezoneShift=true&allowMultiQueries=true&useLegacyDatetimeCode=false&autoReconnect=true&serverTimezone=" + timeZone
|
||||
+ "&useSSL=" + SelectConfig.getMysqlSSL());
|
||||
config.setUsername(SelectConfig.getMysqlUser());
|
||||
config.setPassword(SelectConfig.getMysqlPassword());
|
||||
+ "&useSSL=" + Config.mysqlSSL.value);
|
||||
config.setUsername(String.valueOf(Config.mysqlUser.value));
|
||||
config.setPassword(String.valueOf(Config.mysqlPassword.value));
|
||||
config.addDataSourceProperty("cachePrepStmts", "true");
|
||||
config.addDataSourceProperty("prepStmtCacheSize", "250");
|
||||
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
||||
@ -39,7 +40,7 @@ public class MySQL {
|
||||
T2Csend.error(Main.getPlugin(), ex.getMessage() + " --- " + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
if (SelectConfig.getDebug() || Main.version.toLowerCase().contains("dev") || Main.version.toLowerCase().contains("beta") || Main.version.toLowerCase().contains("snapshot")) {
|
||||
if ((Boolean) Config.debug.value || Main.version.toLowerCase().contains("dev") || Main.version.toLowerCase().contains("beta") || Main.version.toLowerCase().contains("snapshot")) {
|
||||
try {
|
||||
T2Csend.error(Main.getPlugin(), "MySQL DEBUG:");
|
||||
Connection con = ds.getConnection();
|
||||
|
@ -101,7 +101,7 @@ public class SelectDatabase {
|
||||
}
|
||||
break;
|
||||
case YML:
|
||||
YML.setGuiitemOff(player);
|
||||
YML.setGuiItem(player, status);
|
||||
break;
|
||||
case SQLITE:
|
||||
default:
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.t2code.commandguiv2.Spigot.gui;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.commandguiv2.Spigot.listener.ServerChange;
|
||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||
@ -18,6 +19,7 @@ import net.t2code.t2codelib.SPIGOT.api.eco.T2Ceco;
|
||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CLibConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@ -29,6 +31,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -118,7 +121,7 @@ public class GUIListener implements Listener {
|
||||
@Override
|
||||
public void run() {
|
||||
if (slot.command_BungeeCommand) {
|
||||
if (SelectConfig.getBungee()) {
|
||||
if (T2CLibConfig.getBungee()) {
|
||||
for (String cmd : slot.command) {
|
||||
Bungee_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), slot.commandAsConsole);
|
||||
}
|
||||
@ -152,11 +155,11 @@ public class GUIListener implements Listener {
|
||||
for (String msg : slot.message) {
|
||||
if (Main.PaPi) {
|
||||
if (slot.cost_Enable) {
|
||||
T2Csend.player(player, T2Creplace.replacePrice(prefix, player, Placeholder.replace(msg, player), slot.price + " " + SelectConfig.getCurrency()));
|
||||
T2Csend.player(player, T2Creplace.replacePrice(prefix, player, Placeholder.replace(msg, player), slot.price + " " + Config.currency.value));
|
||||
} else T2Csend.player(player, T2Creplace.replace(prefix, player, Placeholder.replace(msg, player)));
|
||||
} else {
|
||||
if (slot.cost_Enable) {
|
||||
T2Csend.player(player, T2Creplace.replacePrice(prefix, Placeholder.replace(msg, player), slot.price + " " + SelectConfig.getCurrency()));
|
||||
T2Csend.player(player, T2Creplace.replacePrice(prefix, Placeholder.replace(msg, player), slot.price + " " + Config.currency.value));
|
||||
} else T2Csend.player(player, T2Creplace.replace(prefix, Placeholder.replace(msg, player)));
|
||||
}
|
||||
}
|
||||
@ -246,7 +249,7 @@ public class GUIListener implements Listener {
|
||||
|
||||
private static void togglePerm(Function function, Gui gui, Player player) {
|
||||
if (player.hasPermission(function.togglePermissionPerm)) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.getTogglePermFalse().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() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -255,7 +258,7 @@ public class GUIListener implements Listener {
|
||||
}
|
||||
}.runTaskLater(plugin, 4L);
|
||||
} else
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.getTogglePermTrue().replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), String.valueOf(Config.togglePermTrue.value).replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -360,7 +363,7 @@ public class GUIListener implements Listener {
|
||||
Sound.play(player, SoundEnum.NoMoney);
|
||||
} else {
|
||||
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
|
||||
.replace("[price]", function.price + " " + SelectConfig.getCurrency()));
|
||||
.replace("[price]", function.price + " " + Config.currency.value));
|
||||
execute(function, slot, player, e, gui);
|
||||
}
|
||||
break;
|
||||
|
@ -3,6 +3,7 @@ package net.t2code.commandguiv2.Spigot.gui;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||
@ -68,13 +69,13 @@ public class GuiBuilder {
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setDisplayName(T2Creplace.replace(prefix, player, Placeholder.replace(function.name, player)));
|
||||
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
|
||||
itemMeta.setLore(T2Creplace.replacePrice(prefix, player, Placeholder.replace(function.noPermLore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||
} else itemMeta.setLore(T2Creplace.replacePrice(prefix, player, Placeholder.replace(function.lore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||
itemMeta.setLore(T2Creplace.replacePrice(prefix, player, Placeholder.replace(function.noPermLore, player), function.price + " " + Config.currency.value));
|
||||
} else itemMeta.setLore(T2Creplace.replacePrice(prefix, player, Placeholder.replace(function.lore, player), function.price + " " + Config.currency.value));
|
||||
} else {
|
||||
itemMeta.setDisplayName(T2Creplace.replace(prefix, Placeholder.replace(function.name, player)));
|
||||
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
|
||||
itemMeta.setLore(T2Creplace.replacePrice(prefix, Placeholder.replace(function.noPermLore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||
} else itemMeta.setLore(T2Creplace.replacePrice(prefix, Placeholder.replace(function.lore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||
itemMeta.setLore(T2Creplace.replacePrice(prefix, Placeholder.replace(function.noPermLore, player), function.price + " " + Config.currency.value));
|
||||
} else itemMeta.setLore(T2Creplace.replacePrice(prefix, Placeholder.replace(function.lore, player), function.price + " " + Config.currency.value));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.t2code.commandguiv2.Spigot.gui;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
@ -136,14 +137,14 @@ public class OpenGUI {
|
||||
}
|
||||
|
||||
private static void toggleOn(Function function, Slot slot, Player player, Inventory inventory) {
|
||||
if (SelectConfig.getToggleItemOnOrYesBase64()) {
|
||||
GuiBuilder.base64(SelectConfig.getToggleItemOnOrYesBase64Value(), slot, player, inventory);
|
||||
} else GuiBuilder.item(SelectConfig.getToggleItemOnOrYesMaterial(), slot, player, inventory);
|
||||
if ((Boolean) Config.toggleItemOnOrYesBase64.value) {
|
||||
GuiBuilder.base64(String.valueOf( Config.toggleItemOnOrYesBase64Value.value), slot, player, inventory);
|
||||
} else GuiBuilder.item(String.valueOf(Config.toggleItemOnOrYesMaterial.value), slot, player, inventory);
|
||||
}
|
||||
|
||||
private static void toggleOff(Function function, Slot slot, Player player, Inventory inventory) {
|
||||
if (SelectConfig.getToggleItemOffOrNoBase64()) {
|
||||
GuiBuilder.base64(SelectConfig.getToggleItemOffOrNoBase64Value(), slot, player, inventory);
|
||||
} else GuiBuilder.item(SelectConfig.getToggleItemOffOrNoMaterial(), slot, player, inventory);
|
||||
if ((Boolean) Config.toggleItemOffOrNoBase64.value) {
|
||||
GuiBuilder.base64(String.valueOf( Config.toggleItemOffOrNoBase64Value.value), slot, player, inventory);
|
||||
} else GuiBuilder.item(String.valueOf(Config.toggleItemOffOrNoMaterial.value), slot, player, inventory);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.t2code.commandguiv2.Spigot.sound;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||
@ -14,21 +14,20 @@ public class Sound {
|
||||
private static String prefix = Util.getPrefix();
|
||||
|
||||
public static void play(Player player, SoundEnum soundEnum) {
|
||||
if (!SelectConfig.getSound_Enable()) return;
|
||||
play(player, soundEnum, null, null, null);
|
||||
}
|
||||
|
||||
public static void play(Player player, SoundEnum soundEnum, Function function, Slot slot, Gui gui) {
|
||||
if (!SelectConfig.getSound_Enable()) return;
|
||||
if (!(Boolean) Config.soundEnable.value) return;
|
||||
switch (soundEnum) {
|
||||
case OpenInventory:
|
||||
if (!SelectConfig.getSound_OpenInventory_Enable()) return;
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_OpenInventory(), 3, 1);
|
||||
if (!(Boolean) Config.soundOpenInventoryEnable.value) return;
|
||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundOpenInventoryInput.value)), 3, 1);
|
||||
break;
|
||||
case Click:
|
||||
if (!SelectConfig.getSound_Click_Enable()) return;
|
||||
if (!(Boolean) Config.soundClickEnable.value) return;
|
||||
if (!function.customSound_Enable) {
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_Click(), 3, 1);
|
||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundClickInput.value)), 3, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -38,24 +37,24 @@ public class Sound {
|
||||
} catch (Exception e1) {
|
||||
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
|
||||
.replace("[sound]", "§6GUI: §e" + gui.key + " §6Function: §e" + function.key + "§r §6Slot: §e" + (slot.slot + 1) + " §6CustomSound: §9" + function.customSound_Sound));
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_Click(), 3, 1);
|
||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundClickInput.value)), 3, 1);
|
||||
}
|
||||
break;
|
||||
case NoMoney:
|
||||
if (!SelectConfig.getSound_NoMoney_Enable()) return;
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_NoMoney(), 3, 1);
|
||||
if (!(Boolean) Config.soundNoMoneyEnable.value) return;
|
||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundNoMoneyInput.value)), 3, 1);
|
||||
break;
|
||||
case NoInventorySpace:
|
||||
if (!SelectConfig.getSound_NoInventorySpace_Enable()) return;
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_NoInventorySpace(), 3, 1);
|
||||
if (!(Boolean) Config.soundNoInventorySpaceEnable.value) return;
|
||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundNoInventorySpaceInput.value)), 3, 1);
|
||||
break;
|
||||
case Give:
|
||||
if (!SelectConfig.getSound_Give_Enable()) return;
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_Give(), 3, 1);
|
||||
if (!(Boolean) Config.soundGiveEnable.value) return;
|
||||
player.playSound(player.getLocation(),org.bukkit.Sound.valueOf(String.valueOf( Config.soundGiveInput.value)), 3, 1);
|
||||
break;
|
||||
case PlayerNotFound:
|
||||
if (!SelectConfig.getSound_PlayerNotFound_Enable()) return;
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_PlayerNotFound(), 3, 1);
|
||||
if (!(Boolean) Config.soundPlayerNotFoundEnable.value) return;
|
||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundPlayerNotFoundInput.value)), 3, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.t2code.commandguiv2.Spigot.system;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.ConfigSelect;
|
||||
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
|
||||
import net.t2code.commandguiv2.Spigot.gui.GUIListener;
|
||||
import net.t2code.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
|
||||
@ -28,6 +30,7 @@ import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CLibConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@ -74,12 +77,7 @@ public class Load {
|
||||
}
|
||||
|
||||
try {
|
||||
ConfigCreate.configCreate();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
SelectConfig.onSelect();
|
||||
ConfigSelect.selectConfig();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -96,7 +94,7 @@ public class Load {
|
||||
|
||||
SelectConfig.setConfigVersion();
|
||||
|
||||
if (SelectConfig.getBungee()) {
|
||||
if (T2CLibConfig.getBungee()) {
|
||||
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin, "t2c:bcmd")) {
|
||||
T2Csend.debug(plugin, "registerOutgoingPluginChannel §et2c:bcmd");
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
||||
@ -128,12 +126,12 @@ public class Load {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
SelectConfig.sound(prefix);
|
||||
Config.sound();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
CmdExecuter_GUI.arg1.put(SelectConfig.getAdminSubCommand(), Permissions.admin + ";" + Permissions.giveItemOther + ";" + Permissions.info);
|
||||
CmdExecuter_GUI.arg1.put(String.valueOf(Config.adminSubCommand.value), Permissions.admin + ";" + Permissions.giveItemOther + ";" + Permissions.info);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -154,7 +152,7 @@ public class Load {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (SelectConfig.getHelpAlias()) {
|
||||
if ((Boolean) Config.helpAlias.value) {
|
||||
Main.getPlugin().getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
|
||||
T2Csend.debug(plugin, "CommandRegister: commandguihelp");
|
||||
}
|
||||
@ -179,7 +177,7 @@ public class Load {
|
||||
}
|
||||
|
||||
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), spigotID, discord
|
||||
,SelectConfig.getUpdateCheckOnJoin(),SelectConfig.getUpdateCheckSeePreReleaseUpdates(),SelectConfig.getUpdateCheckTimeInterval());
|
||||
, (Boolean) Config.updateCheckOnJoin.value, (Boolean) Config.updateCheckSeePreReleaseUpdates.value, (Integer) Config.updateCheckTimeInterval.value);
|
||||
Metrics.Bstats();
|
||||
Main.addonLoad();
|
||||
T2Ctemplate.onLoadFooter(prefix, long_);
|
||||
@ -187,9 +185,9 @@ public class Load {
|
||||
|
||||
private static void loadStorage(String prefix) {
|
||||
try {
|
||||
SelectDatabase.setStorage(StorageEnum.valueOf(SelectConfig.getStorage()));
|
||||
SelectDatabase.setStorage(StorageEnum.valueOf(String.valueOf(Config.storage.value)));
|
||||
} catch (Exception ignored) {
|
||||
T2Csend.error(plugin, "The storage medium " + SelectConfig.getStorage() + " is not supported!");
|
||||
T2Csend.error(plugin, "The storage medium '" + Config.storage.value + "' is not supported!");
|
||||
T2Csend.error(plugin, "Storage medium " + StorageEnum.SQLITE + " is used.");
|
||||
SelectDatabase.setStorage(StorageEnum.SQLITE);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.t2code.commandguiv2.Spigot.system;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,8 +11,8 @@ import java.util.List;
|
||||
public class Placeholder {
|
||||
public static String useitem(Player p) {
|
||||
if (Events.useItemHashMap.get(p.getName())) {
|
||||
return SelectConfig.getPlaceholderTrue();
|
||||
} else return SelectConfig.getPlaceholderFalse();
|
||||
return Config.placeholderTrue.name();
|
||||
} else return Config.placeholderFalse.name();
|
||||
}
|
||||
|
||||
public static String useitem_boolean(Player p) {
|
||||
|
@ -2,7 +2,7 @@ package net.t2code.commandguiv2.Spigot.useItem;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Spigot.gui.OpenGUI;
|
||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
||||
@ -40,7 +40,7 @@ public class Events implements Listener {
|
||||
useItemHashMap.put(e.getPlayer().getName(), SelectDatabase.selectItemStatus(e.getPlayer()));
|
||||
Integer i = SelectDatabase.selectSlot(e.getPlayer());
|
||||
if (i == null) {
|
||||
useItemSlotHashMap.put(e.getPlayer().getName(), SelectConfig.getUseItem_InventorySlot());
|
||||
useItemSlotHashMap.put(e.getPlayer().getName(), (Integer) Config.useItemInventorySlot.value);
|
||||
} else useItemSlotHashMap.put(e.getPlayer().getName(), i);
|
||||
|
||||
if (CGuiAPI.JoinDisable) {
|
||||
@ -64,7 +64,6 @@ public class Events implements Listener {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onDeathDrop(PlayerDeathEvent e) {
|
||||
Player player = e.getEntity().getPlayer();
|
||||
@ -74,7 +73,7 @@ public class Events implements Listener {
|
||||
while (var3.hasNext()) {
|
||||
ItemStack items = (ItemStack) var3.next();
|
||||
if (items != null && items.hasItemMeta() && items.getItemMeta().hasDisplayName()
|
||||
&& items.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
&& items.getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
e.getDrops().remove(items);
|
||||
}
|
||||
}
|
||||
@ -84,10 +83,10 @@ public class Events implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onRespawn(PlayerRespawnEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if (SelectConfig.getUseItem_Enable()) {
|
||||
if ((Boolean) Config.useItemEnable.value) {
|
||||
ItemChange.itemChange(player, false);
|
||||
//if (!SelectConfig.getUseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
||||
// if (SelectConfig.getUseItem_GiveOnlyOnFirstJoin) {
|
||||
//if (!Config.getUseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
||||
// if (Config.getUseItem_GiveOnlyOnFirstJoin) {
|
||||
// if (!player.hasPlayedBefore()) {
|
||||
// new BukkitRunnable() {
|
||||
// @Override
|
||||
@ -111,7 +110,7 @@ public class Events implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onGameModeChange(PlayerGameModeChangeEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if (!SelectConfig.getUseItemGameModeChangeEnable()) {
|
||||
if (!(Boolean) Config.useItemGameModeChangeEnable.value) {
|
||||
return;
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
@ -119,13 +118,13 @@ public class Events implements Listener {
|
||||
public void run() {
|
||||
ItemChange.itemChange(player, false);
|
||||
}
|
||||
}.runTaskLater(Main.getPlugin(), SelectConfig.getUseItemGameModeChangeDelayInTicks() * 1L);
|
||||
}.runTaskLater(Main.getPlugin(), (Integer) Config.useItemGameModeChangeDelayInTicks.value * 1L);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onWorldChange(PlayerChangedWorldEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if (!SelectConfig.getUseItemWorldChangeEnable()) {
|
||||
if (!(Boolean) Config.useItemWorldChangeEnable.value) {
|
||||
return;
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
@ -133,30 +132,30 @@ public class Events implements Listener {
|
||||
public void run() {
|
||||
ItemChange.itemChange(player, false);
|
||||
}
|
||||
}.runTaskLater(Main.getPlugin(), SelectConfig.getUseItemWorldChangeDelayInTicks() * 1L);
|
||||
}.runTaskLater(Main.getPlugin(), (Integer) Config.useItemWorldChangeDelayInTicks.value * 1L);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onInteract(PlayerInteractEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
if (!p.isSneaking()) {
|
||||
for (String material : SelectConfig.getUseItemItemBlockBlacklist()) {
|
||||
for (String material : (ArrayList<String>) Config.useItemItemBlockBlacklist.value) {
|
||||
if (e.getClickedBlock() != null) {
|
||||
if (e.getClickedBlock().getType() == Material.valueOf(material)) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SelectConfig.getUseItem_Enable()) {
|
||||
if (SelectConfig.getUseItem_PlayerHead_Enable()) {
|
||||
if ((Boolean) Config.useItemEnable.value) {
|
||||
if ((Boolean) Config.useItemPlayerHeadEnable.value) {
|
||||
if (e.getItem() != null && p.getItemInHand().getType() == T2CitemVersion.getHead()) {
|
||||
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
if (e.getItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
openGUI(e, p);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (e.getItem() != null && p.getItemInHand().getType() == Material.valueOf(SelectConfig.getUseItem_Material())) {
|
||||
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
if (e.getItem() != null && p.getItemInHand().getType() == Material.valueOf(String.valueOf(Config.useItemMaterial.value))) {
|
||||
if (e.getItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
openGUI(e, p);
|
||||
}
|
||||
}
|
||||
@ -167,7 +166,7 @@ public class Events implements Listener {
|
||||
private static void openGUI(PlayerInteractEvent e, Player player) {
|
||||
e.setCancelled(true);
|
||||
|
||||
if ((!SelectConfig.getDisableInfoBySneak()) && player.isSneaking()) {
|
||||
if ((!(Boolean) Config.disableInfoBySneak.value) && player.isSneaking()) {
|
||||
Commands.info(player);
|
||||
return;
|
||||
}
|
||||
@ -178,45 +177,45 @@ public class Events implements Listener {
|
||||
|
||||
if (UseItem.protection(player, true)) return;
|
||||
|
||||
if (SelectConfig.getUseItemGameModeProtection()) {
|
||||
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||
if ((Boolean) Config.useItemGameModeProtection.value) {
|
||||
if (String.valueOf(Config.useItemGameModeMode.value).equalsIgnoreCase("blacklist") && String.valueOf(Config.useItemGameModeList.value).contains(player.getGameMode().toString())) {
|
||||
e.setCancelled(true);
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||
if (String.valueOf(Config.useItemGameModeMode.value).equalsIgnoreCase("whitelist") && !String.valueOf(Config.useItemGameModeList.value).contains(player.getGameMode().toString())) {
|
||||
e.setCancelled(true);
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (SelectConfig.getUseItemWorldProtection()) {
|
||||
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||
if ((Boolean) Config.useItemWorldProtection.value) {
|
||||
if (String.valueOf(Config.useItemWorldMode.value).equalsIgnoreCase("blacklist") && String.valueOf(Config.useItemWorldList.value).contains(player.getWorld().getName())) {
|
||||
e.setCancelled(true);
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||
if (String.valueOf(Config.useItemWorldMode.value).equalsIgnoreCase("whitelist") && !String.valueOf(Config.useItemWorldList.value).contains(player.getWorld().getName())) {
|
||||
e.setCancelled(true);
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!SelectConfig.getUseItem_Permission() || player.hasPermission("commandgui.useitem")) {
|
||||
OpenGUI.openGUI(player, SelectConfig.getUseItem_OpenGUI(), true);
|
||||
if (!(Boolean) Config.useItemPermission.value || player.hasPermission("commandgui.useitem")) {
|
||||
OpenGUI.openGUI(player, String.valueOf(Config.useItemOpenGUI.value), true);
|
||||
} else {
|
||||
T2Csend.player(player, SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
|
||||
.replace("[gui]", SelectConfig.getUseItem_OpenGUI()));
|
||||
.replace("[gui]", String.valueOf(Config.useItemOpenGUI.value)));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onItemMoveEvent(InventoryMoveItemEvent e) {
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
if (!(Boolean) Config.useItemBlockMoveAndDrop.value || !(Boolean) Config.useItemEnable.value) return;
|
||||
if (e.getItem() != null && e.getItem().hasItemMeta() && e.getItem().getItemMeta().hasDisplayName()
|
||||
&& e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
&& e.getItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -224,19 +223,19 @@ public class Events implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onItemMove(InventoryDragEvent e) {
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
if (!(Boolean) Config.useItemBlockMoveAndDrop.value || !(Boolean) Config.useItemEnable.value) return;
|
||||
|
||||
if (e.getWhoClicked() instanceof Player) {
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
||||
&& e.getCursor().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
&& e.getCursor().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
p.closeInventory();
|
||||
e.setCancelled(true);
|
||||
ItemChange.itemChange(p, false);
|
||||
}
|
||||
|
||||
if (e.getOldCursor() != null && e.getOldCursor().hasItemMeta() && e.getOldCursor().getItemMeta().hasDisplayName()
|
||||
&& e.getOldCursor().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
&& e.getOldCursor().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
p.closeInventory();
|
||||
e.setCancelled(true);
|
||||
ItemChange.itemChange(p, false);
|
||||
@ -246,14 +245,14 @@ public class Events implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onItemMove(InventoryClickEvent e) {
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
if (!(Boolean) Config.useItemBlockMoveAndDrop.value || !(Boolean) Config.useItemEnable.value) return;
|
||||
|
||||
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
||||
&& e.getCursor().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
&& e.getCursor().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
if (e.getCurrentItem() != null && e.getCurrentItem().hasItemMeta() && e.getCurrentItem().getItemMeta().hasDisplayName()
|
||||
&& e.getCurrentItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
&& e.getCurrentItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
|
||||
e.setCancelled(true);
|
||||
}
|
||||
@ -261,12 +260,12 @@ public class Events implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onItemMove(InventoryPickupItemEvent e) {
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
if (!(Boolean) Config.useItemBlockMoveAndDrop.value || !(Boolean) Config.useItemEnable.value) return;
|
||||
|
||||
if (e.getItem() != null && e.getItem().getItemStack() != null) {
|
||||
ItemStack item = e.getItem().getItemStack();
|
||||
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
&& item.getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -274,21 +273,21 @@ public class Events implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlace(BlockPlaceEvent e) {
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
if (!(Boolean) Config.useItemBlockMoveAndDrop.value || !(Boolean) Config.useItemEnable.value) return;
|
||||
if (e.getItemInHand() != null && e.getItemInHand().hasItemMeta() && e.getItemInHand().getItemMeta().hasDisplayName()
|
||||
&& e.getItemInHand().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
&& e.getItemInHand().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onDrop(PlayerDropItemEvent e) {
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
if (!(Boolean) Config.useItemBlockMoveAndDrop.value || !(Boolean) Config.useItemEnable.value) return;
|
||||
|
||||
if (e.getItemDrop() != null && e.getItemDrop().getItemStack() != null) {
|
||||
ItemStack item = e.getItemDrop().getItemStack();
|
||||
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
&& item.getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -300,7 +299,7 @@ public class Events implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onClearServer(ServerCommandEvent event) {
|
||||
if (SelectConfig.getUseItem_KeepAtCommandClear()) {
|
||||
if ((Boolean) Config.useItemKeepAtCommandClear.value) {
|
||||
if (event.getCommand().contains("clear " + event.getCommand().replace("/", "").replace("clear ", ""))) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
@ -324,7 +323,7 @@ public class Events implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onClearPlayer(PlayerCommandPreprocessEvent event) {
|
||||
if (SelectConfig.getUseItem_KeepAtCommandClear()) {
|
||||
if ((Boolean) Config.useItemKeepAtCommandClear.value) {
|
||||
if (event.getMessage().toLowerCase().contains("clear")) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.t2code.commandguiv2.Spigot.useItem;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -11,27 +11,27 @@ public class EventsFrom110 implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onHandSwap(PlayerSwapHandItemsEvent e) {
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
if (!(Boolean) Config.useItemBlockMoveAndDrop.value || !(Boolean) Config.useItemEnable.value) return;
|
||||
if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
|
||||
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
}
|
||||
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
|
||||
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onItemMove(PlayerSwapHandItemsEvent e) {
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
if (!(Boolean)Config.useItemBlockMoveAndDrop.value || !(Boolean)Config.useItemEnable.value) return;
|
||||
Player p = e.getPlayer();
|
||||
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
|
||||
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
p.closeInventory();
|
||||
e.setCancelled(true);
|
||||
}
|
||||
if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
|
||||
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
p.closeInventory();
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
@ -1,27 +1,28 @@
|
||||
package net.t2code.commandguiv2.Spigot.useItem;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CLibConfig;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class ItemChange {
|
||||
public static void itemChange(Player player, Boolean setCursor) {
|
||||
Integer slot;
|
||||
if (SelectConfig.getUseItem_InventorySlotEnforce()) {
|
||||
slot = SelectConfig.getUseItem_InventorySlot();
|
||||
if ((Boolean) Config.useItemInventorySlotEnforce.value) {
|
||||
slot =(Integer) Config.useItemInventorySlot.value;
|
||||
} else {
|
||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||
}
|
||||
|
||||
if (!SelectConfig.getUseItem_Enable()) {
|
||||
if (!(Boolean)Config.useItemEnable.value) {
|
||||
return;
|
||||
}
|
||||
UseItem.removeItem(player);
|
||||
if (UseItem.protection(player, false)) return;
|
||||
if (SelectConfig.getUseItem_GiveOnlyOnFirstJoin()) {
|
||||
if (!SelectConfig.getUseItem_AllowToggle() || Events.useItemHashMap.get(player.getName())) {
|
||||
if ((Boolean)Config.useItemGiveOnlyOnFirstJoin.value) {
|
||||
if (!(Boolean)Config.useItemAllowToggle.value || Events.useItemHashMap.get(player.getName())) {
|
||||
if (!player.hasPlayedBefore()) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
@ -32,7 +33,7 @@ public class ItemChange {
|
||||
}
|
||||
}
|
||||
}.runTaskLater(Main.getPlugin(), 1L * 1);
|
||||
if (SelectConfig.getCursor_ToGUIItem_OnlyOnFirstLogin() || SelectConfig.getCursor_ToGUIItem_OnLogin()) {
|
||||
if ((Boolean)Config.cursorToGUIItemOnlyOnFirstLogin.value ||(Boolean) Config.cursorToGUIItemOnLogin.value) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
}
|
||||
}
|
||||
@ -40,7 +41,7 @@ public class ItemChange {
|
||||
T2Csend.debug(Main.getPlugin(), "GiveOnlyOnFirstJoin: " + player.getName());
|
||||
return;
|
||||
}
|
||||
if (!SelectConfig.getUseItem_GiveOnEveryJoin()) {
|
||||
if (!(Boolean)Config.useItemGiveOnEveryJoin.value) {
|
||||
T2Csend.debug(Main.getPlugin(), "!GiveOnEveryJoin: " + player.getName());
|
||||
return;
|
||||
}
|
||||
@ -49,14 +50,14 @@ public class ItemChange {
|
||||
public void run() {
|
||||
Boolean pln = Events.useItemHashMap.get(player.getName());
|
||||
if (pln == null) return;
|
||||
if (!SelectConfig.getUseItem_AllowToggle() || pln) {
|
||||
if (SelectConfig.getUseItem_InventorySlotEnforce() || player.getInventory().getItem(slot - 1) == null) {
|
||||
if (!(Boolean)Config.useItemAllowToggle.value || pln) {
|
||||
if ((Boolean)Config.useItemInventorySlotEnforce.value || player.getInventory().getItem(slot - 1) == null) {
|
||||
T2Csend.debug(Main.getPlugin(), "Give: " + player.getName());
|
||||
UseItem.giveUseItem(player);
|
||||
if (setCursor) {
|
||||
setCursor(player, slot);
|
||||
}
|
||||
} else if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
|
||||
} else if ((Boolean)Config.useItemInventorySlotFreeSlot.value) {
|
||||
boolean empty = false;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (player.getInventory().getItem(i) == null) {
|
||||
@ -76,11 +77,11 @@ public class ItemChange {
|
||||
private static void setCursor(Player player, int slot) {
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 1 Player: " + player.getName());
|
||||
|
||||
if (!SelectConfig.getCursor_ToGUIItem_OnLogin()) {
|
||||
if (!(Boolean)Config.cursorToGUIItemOnLogin.value) {
|
||||
return;
|
||||
}
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 2 Player: " + player.getName());
|
||||
if (SelectConfig.getCursor_ToGUIItem_OnlyOnFirstLogin()) {
|
||||
if ((Boolean)Config.cursorToGUIItemOnlyOnFirstLogin.value) {
|
||||
if (!player.hasPlayedBefore()) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 3 Player: " + player.getName());
|
||||
@ -88,13 +89,13 @@ public class ItemChange {
|
||||
return;
|
||||
}
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 4 Player: " + player.getName());
|
||||
if (!SelectConfig.getBungee()) {
|
||||
if (!T2CLibConfig.getBungee()) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 5 Player: " + player.getName());
|
||||
return;
|
||||
}
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 6 Player: " + player.getName());
|
||||
if (SelectConfig.getUseItem_ServerChange()) {
|
||||
if ((Boolean)Config.useItemServerChange.value) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 7 Player: " + player.getName());
|
||||
return;
|
||||
|
@ -3,7 +3,7 @@ package net.t2code.commandguiv2.Spigot.useItem;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||
@ -17,18 +17,19 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
public class UseItem {
|
||||
public static void giveUseItem(Player player) {
|
||||
Integer slot;
|
||||
if (protection(player, false)) return;
|
||||
if (SelectConfig.getUseItem_InventorySlotEnforce()) {
|
||||
slot = SelectConfig.getUseItem_InventorySlot();
|
||||
if ((Boolean) Config.useItemInventorySlotEnforce.value) {
|
||||
slot = (Integer) Config.useItemInventorySlot.value;
|
||||
} else {
|
||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||
}
|
||||
if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
|
||||
if ((Boolean) Config.useItemInventorySlotFreeSlot.value) {
|
||||
player.getInventory().addItem(itemStack(player));
|
||||
} else {
|
||||
T2Csend.debug(Main.getPlugin(), "setUseItem: " + player.getName() + " Slot: " + Integer.parseInt(String.valueOf(slot - 1)));
|
||||
@ -38,27 +39,27 @@ public class UseItem {
|
||||
|
||||
public static void addUseItem(Player player) {
|
||||
if (protection(player, false)) return;
|
||||
if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
|
||||
if ((Boolean) Config.useItemInventorySlotFreeSlot.value) {
|
||||
player.getInventory().addItem(itemStack(player));
|
||||
} else player.getInventory().addItem(itemStack(player));
|
||||
}
|
||||
|
||||
private static ItemStack itemStack(Player player) {
|
||||
ItemStack item = null;
|
||||
if (SelectConfig.getUseItem_PlayerHead_Enable()) {
|
||||
if ((Boolean) Config.useItemPlayerHeadEnable.value) {
|
||||
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
T2Csend.player(player, Util.getPrefix() + "§c Playerheads for UseItem are only available from version §61.13§c!");
|
||||
T2Csend.error(Main.getPlugin(), "Playerheads for UseItem are only available from version 1.13!");
|
||||
} else {
|
||||
item = T2CitemVersion.getHeadIS();
|
||||
SkullMeta playerheadmeta = (SkullMeta) item.getItemMeta();
|
||||
playerheadmeta.setDisplayName(SelectConfig.getUseItem_Name());
|
||||
if (SelectConfig.getUseItem_Base64_Enable()) {
|
||||
playerheadmeta.setDisplayName(String.valueOf(Config.useItemName.value));
|
||||
if ((Boolean) Config.useItemBase64Enable.value) {
|
||||
if (Main.PaPi) {
|
||||
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
|
||||
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
|
||||
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, (ArrayList<String>) Config.useItemLore.value));
|
||||
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), (ArrayList<String>) Config.useItemLore.value));
|
||||
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
|
||||
profile.getProperties().put("textures", new Property("textures", SelectConfig.getUseItem_Base64value()));
|
||||
profile.getProperties().put("textures", new Property("textures", String.valueOf(Config.useItemBase64value.value)));
|
||||
Field profileField = null;
|
||||
try {
|
||||
profileField = playerheadmeta.getClass().getDeclaredField("profile");
|
||||
@ -69,23 +70,23 @@ public class UseItem {
|
||||
}
|
||||
} else {
|
||||
String p;
|
||||
if (SelectConfig.getUseItem_PlayerWhoHasOpenedTheGUI()) {
|
||||
if ((Boolean) Config.useItemPlayerWhoHasOpenedTheGUI.value) {
|
||||
p = player.getName();
|
||||
} else p = SelectConfig.getUseItem_PlayerName();
|
||||
} else p = String.valueOf(Config.useItemPlayerName.value);
|
||||
playerheadmeta.setOwner(p);
|
||||
if (Main.PaPi) {
|
||||
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
|
||||
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
|
||||
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, (ArrayList<String>) Config.useItemLore.value));
|
||||
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), (ArrayList<String>) Config.useItemLore.value));
|
||||
}
|
||||
item.setItemMeta(playerheadmeta);
|
||||
}
|
||||
} else {
|
||||
item = new ItemStack(Material.valueOf(SelectConfig.getUseItem_Material()));
|
||||
item = new ItemStack(Material.valueOf(String.valueOf(Config.useItemMaterial.value)));
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
itemMeta.setDisplayName(SelectConfig.getUseItem_Name());
|
||||
itemMeta.setDisplayName(String.valueOf(Config.useItemName.value));
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
|
||||
} else itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
|
||||
itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), player, (ArrayList<String>) Config.useItemLore.value));
|
||||
} else itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), (ArrayList<String>) Config.useItemLore.value));
|
||||
item.setItemMeta(itemMeta);
|
||||
item.setAmount(1);
|
||||
}
|
||||
@ -93,31 +94,31 @@ public class UseItem {
|
||||
}
|
||||
|
||||
public static boolean protection(Player player, Boolean interact) {
|
||||
if (SelectConfig.getUseItemGameModeProtection()) {
|
||||
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||
if ((Boolean) Config.useItemGameModeProtection.value) {
|
||||
if (String.valueOf(Config.useItemGameModeMode.value).equalsIgnoreCase("blacklist") && String.valueOf(Config.useItemGameModeList.value).contains(player.getGameMode().toString())) {
|
||||
if (interact) {
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||
} else if (!SelectConfig.getUseItemGameModeRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||
} else if (!(Boolean) Config.useItemGameModeRemoveItemWhenItIsDisabled.value) removeItem(player);
|
||||
return true;
|
||||
}
|
||||
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||
if (String.valueOf(Config.useItemGameModeMode.value).equalsIgnoreCase("whitelist") && !String.valueOf(Config.useItemGameModeList.value).contains(player.getGameMode().toString())) {
|
||||
if (interact) {
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||
} else if (!SelectConfig.getUseItemGameModeRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||
} else if (!(Boolean) Config.useItemGameModeRemoveItemWhenItIsDisabled.value) removeItem(player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (SelectConfig.getUseItemWorldProtection()) {
|
||||
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||
if ((Boolean) Config.useItemWorldProtection.value) {
|
||||
if (String.valueOf(Config.useItemWorldMode.value).equalsIgnoreCase("blacklist") && String.valueOf(Config.useItemWorldList.value).contains(player.getWorld().getName())) {
|
||||
if (interact) {
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||
} else if (!SelectConfig.getUseItemWorldRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||
} else if (!(Boolean) Config.useItemWorldRemoveItemWhenItIsDisabled.value) removeItem(player);
|
||||
return true;
|
||||
}
|
||||
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||
if (String.valueOf(Config.useItemWorldMode.value).equalsIgnoreCase("whitelist") && !String.valueOf(Config.useItemWorldList.value).contains(player.getWorld().getName())) {
|
||||
if (interact) {
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||
} else if (!SelectConfig.getUseItemWorldRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||
} else if (!(Boolean) Config.useItemWorldRemoveItemWhenItIsDisabled.value) removeItem(player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -129,8 +130,8 @@ public class UseItem {
|
||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm != null) {
|
||||
if (itm.getType() == Material.valueOf(SelectConfig.getUseItem_Material()) || itm.getType() == T2CitemVersion.getHead()) {
|
||||
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
if (itm.getType() == Material.valueOf(String.valueOf(Config.useItemMaterial.value)) || itm.getType() == T2CitemVersion.getHead()) {
|
||||
if (itm.getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
||||
player.getInventory().remove(itm);
|
||||
player.updateInventory();
|
||||
break;
|
||||
|
@ -7,7 +7,7 @@ public class Util {
|
||||
}
|
||||
|
||||
public static String getRequiredT2CodeLibVersion() {
|
||||
return "14.0";
|
||||
return "14.2";
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.t2code.commandguiv2.api;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
||||
import net.t2code.commandguiv2.Spigot.useItem.ItemChange;
|
||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
@ -29,13 +30,13 @@ public class CGuiAPI {
|
||||
public static boolean hasUseItemInMainHand(Player player) {
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
return item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name());
|
||||
&& item.getItemMeta().getDisplayName().equals(String.valueOf(Config.useItemName.value));
|
||||
}
|
||||
|
||||
public static boolean hasUseItemInOffHand(Player player) {
|
||||
ItemStack item = player.getInventory().getItemInOffHand();
|
||||
return item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name());
|
||||
&& item.getItemMeta().getDisplayName().equals(String.valueOf(Config.useItemName.value));
|
||||
}
|
||||
|
||||
public static void disableItemGiveOnJoin(Boolean disableItemGiveOnJoin) {
|
||||
|
Loading…
Reference in New Issue
Block a user