big changes
This commit is contained in:
parent
754f486d1b
commit
2abdcdd3ad
@ -39,11 +39,6 @@ public final class Main extends JavaPlugin {
|
|||||||
public static Boolean LuckyBox = false;
|
public static Boolean LuckyBox = false;
|
||||||
public static Boolean PlugManGUI = false;
|
public static Boolean PlugManGUI = false;
|
||||||
|
|
||||||
public static HashMap<String, GuiObject> guiHashMap = new HashMap<>();
|
|
||||||
public static ArrayList<String> allAliases = new ArrayList<>();
|
|
||||||
|
|
||||||
public static HashMap<String, FunctionObject> functionHashMap = new HashMap<>();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
// Plugin startup logic
|
// Plugin startup logic
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Spigot.config.gui.CreateGUI;
|
import net.t2code.commandguiv2.Spigot.config.gui.CreateGUI;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
@ -30,7 +30,7 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
Commands.gui(player);
|
Commands.gui(player);
|
||||||
} else {
|
} else {
|
||||||
if (args[0].equals(String.valueOf(Config.adminSubCommand.value))) {
|
if (args[0].equals(String.valueOf(ConfigValues.adminSubCommand.value))) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
Help.sendHelp(sender, prefix);
|
Help.sendHelp(sender, prefix);
|
||||||
return false;
|
return false;
|
||||||
@ -105,7 +105,7 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
|||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
|
|
||||||
T2Ctab.tab(list, sender, 0, args, arg1);
|
T2Ctab.tab(list, sender, 0, args, arg1);
|
||||||
T2Ctab.tab(list, sender, 0, String.valueOf(Config.adminSubCommand.value), 1, args, arg2);
|
T2Ctab.tab(list, sender, 0, String.valueOf(ConfigValues.adminSubCommand.value), 1, args, arg2);
|
||||||
T2Ctab.tab(list, sender, 1, "give", 2, args, "commandgui.giveitem.other", true);
|
T2Ctab.tab(list, sender, 1, "give", 2, args, "commandgui.giveitem.other", true);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
|
import net.t2code.commandguiv2.cache.Cache;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -20,26 +21,44 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (sender.hasPermission("commandgui.useitem.toggle")) {
|
if (sender.hasPermission("commandgui.useitem.toggle")) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
if ((Boolean) Config.useItemAllowToggle.value) {
|
if ((Boolean) ConfigValues.useItemAllowToggle.value) {
|
||||||
Help.sendGUIItemHelp(sender);
|
Help.sendGUIItemHelp(sender);
|
||||||
} else T2Csend.sender(sender, "§4UseItem toggle is disabled!");// todo
|
} else T2Csend.sender(sender, "§4UseItem toggle is disabled!");// todo
|
||||||
} else {
|
} else {
|
||||||
if (args.length == 1 || args.length == 2) {
|
if (args.length == 2 || args.length == 3) {
|
||||||
|
String useItemKey= args[0];
|
||||||
|
|
||||||
|
if (!Cache.useItemHash.containsKey(useItemKey)){
|
||||||
|
T2Csend.sender(sender,"das useitem " +useItemKey+" exestiert nicht");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
if ((Boolean) Config.useItemAllowToggle.value) {
|
if ((Boolean) ConfigValues.useItemAllowToggle.value) {
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[1].toLowerCase()) {
|
||||||
case "on":
|
case "on":
|
||||||
Commands.itemOn(player);
|
Commands.itemOn(player, useItemKey);
|
||||||
break;
|
break;
|
||||||
case "off":
|
case "off":
|
||||||
Commands.itemOff(player);
|
Commands.itemOff(player, useItemKey);
|
||||||
break;
|
break;
|
||||||
case "slot":
|
case "slot":
|
||||||
if (args.length == 2) {
|
if (args.length == 3) {
|
||||||
try {
|
try {
|
||||||
Commands.onSetSlot(player, Integer.valueOf(args[1]));
|
Commands.onSetSlot(player, useItemKey, Integer.valueOf(args[2]));
|
||||||
} catch (Exception e5) {
|
} catch (Exception e5) {
|
||||||
T2Csend.player(player, SelectMessages.ItemSlot_wrongValue);
|
T2Csend.player(player, SelectMessages.ItemSlot_wrongValue);
|
||||||
}
|
}
|
||||||
@ -65,7 +84,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
|||||||
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
||||||
put("on", "commandgui.useitem.toggle");
|
put("on", "commandgui.useitem.toggle");
|
||||||
put("off", "commandgui.useitem.toggle");
|
put("off", "commandgui.useitem.toggle");
|
||||||
if ((Boolean) Config.useItemAllowToggle.value) {
|
if ((Boolean) ConfigValues.useItemAllowToggle.value) {
|
||||||
put("slot", "commandgui.useitem.toggle");
|
put("slot", "commandgui.useitem.toggle");
|
||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
@ -74,7 +93,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
if ((Boolean) Config.useItemAllowToggle.value) {
|
if ((Boolean) ConfigValues.useItemAllowToggle.value) {
|
||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
for (String command : arg1.keySet()) {
|
for (String command : arg1.keySet()) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.ConfigSelect;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigSelect;
|
||||||
import net.t2code.commandguiv2.Spigot.config.functions.SelectFunctions;
|
import net.t2code.commandguiv2.Spigot.config.functions.SelectFunctions;
|
||||||
import net.t2code.commandguiv2.Spigot.config.gui.SelectGui;
|
import net.t2code.commandguiv2.Spigot.config.gui.SelectGui;
|
||||||
@ -17,6 +17,7 @@ import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
|||||||
import net.t2code.commandguiv2.Spigot.sound.PlaySound;
|
import net.t2code.commandguiv2.Spigot.sound.PlaySound;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
|
import net.t2code.commandguiv2.cache.Cache;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||||
@ -48,9 +49,9 @@ public class Commands {
|
|||||||
Main.getPlugin().reloadConfig();
|
Main.getPlugin().reloadConfig();
|
||||||
|
|
||||||
CmdExecuter_GUI.arg1.clear();
|
CmdExecuter_GUI.arg1.clear();
|
||||||
CmdExecuter_GUI.arg1.put(String.valueOf(Config.adminSubCommand.value), "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
|
CmdExecuter_GUI.arg1.put(String.valueOf(ConfigValues.adminSubCommand.value), "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
|
||||||
|
|
||||||
if (!Objects.equals(SelectDatabase.getStorage().toString(), Config.storage.value)) {
|
if (!Objects.equals(SelectDatabase.getStorage().toString(), ConfigValues.storage.value)) {
|
||||||
if (sender instanceof Player) T2Csend.sender(sender, "You have changed the storage medium! To apply this change, you must restart the server!");
|
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!");
|
T2Csend.warning(Main.getPlugin(), "You have changed the storage medium! To apply this change, you must restart the server!");
|
||||||
}
|
}
|
||||||
@ -68,7 +69,7 @@ public class Commands {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
SelectMessages.onSelect(Util.getPrefix());
|
SelectMessages.onSelect(Util.getPrefix());
|
||||||
Config.sound();
|
ConfigValues.sound();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AliasRegister.onRegister();
|
AliasRegister.onRegister();
|
||||||
@ -97,8 +98,8 @@ public class Commands {
|
|||||||
public static void give(CommandSender sender, Player target) {
|
public static void give(CommandSender sender, Player target) {
|
||||||
if (Bukkit.getPlayer(target.getName()) != null) {
|
if (Bukkit.getPlayer(target.getName()) != null) {
|
||||||
UseItem.giveUseItem(target);
|
UseItem.giveUseItem(target);
|
||||||
T2Csend.sender(sender, SelectMessages.Give_Sender.replace("[player]", target.getName()).replace("[item]", String.valueOf(Config.useItemName.value)));
|
T2Csend.sender(sender, SelectMessages.Give_Sender.replace("[player]", target.getName()).replace("[item]", String.valueOf(ConfigValues.useItemName.value)));
|
||||||
T2Csend.player(target, SelectMessages.Give_Receiver.replace("[sender]", sender.getName()).replace("[item]", String.valueOf(Config.useItemName.value)));
|
T2Csend.player(target, SelectMessages.Give_Receiver.replace("[sender]", sender.getName()).replace("[item]", String.valueOf(ConfigValues.useItemName.value)));
|
||||||
PlaySound.play(target, SoundEnum.Give);
|
PlaySound.play(target, SoundEnum.Give);
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(SelectMessages.PlayerNotFond.replace("[player]", target.getName()));
|
sender.sendMessage(SelectMessages.PlayerNotFond.replace("[player]", target.getName()));
|
||||||
@ -106,17 +107,17 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void itemOn(Player player) {
|
public static void itemOn(Player player, String useItemKey) {
|
||||||
UseItem.removeItem(player);
|
UseItem.removeItem(player);
|
||||||
Integer slot = null;
|
Integer slot = null;
|
||||||
if ((Boolean) Config.useItemInventorySlotEnforce.value) {
|
if ((Boolean) ConfigValues.useItemInventorySlotEnforce.value) {
|
||||||
slot = (Integer) Config.useItemInventorySlot.value;
|
slot = (Integer) ConfigValues.useItemInventorySlot.value;
|
||||||
} else {
|
} else {
|
||||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||||
}
|
}
|
||||||
T2Csend.debug(Main.getPlugin(), String.valueOf(slot));
|
T2Csend.debug(Main.getPlugin(), String.valueOf(slot));
|
||||||
if (player.getInventory().getItem(slot - 1) == null) {
|
if (player.getInventory().getItem(slot - 1) == null) {
|
||||||
SelectDatabase.setItemStatus(player, true);
|
SelectDatabase.setItemStatus(player, useItemKey, true);
|
||||||
UseItem.giveUseItem(player);
|
UseItem.giveUseItem(player);
|
||||||
} else {
|
} else {
|
||||||
boolean empty = false;
|
boolean empty = false;
|
||||||
@ -127,7 +128,7 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty) {
|
if (empty) {
|
||||||
SelectDatabase.setItemStatus(player, true);
|
SelectDatabase.setItemStatus(player, useItemKey, true);
|
||||||
UseItem.addUseItem(player);
|
UseItem.addUseItem(player);
|
||||||
T2Csend.player(player, SelectMessages.ItemON);
|
T2Csend.player(player, SelectMessages.ItemON);
|
||||||
} else {
|
} else {
|
||||||
@ -137,14 +138,14 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void itemOff(Player player) {
|
public static void itemOff(Player player, String useItemKey) {
|
||||||
SelectDatabase.setItemStatus(player, false);
|
SelectDatabase.setItemStatus(player, useItemKey, false);
|
||||||
UseItem.removeItem(player);
|
UseItem.removeItem(player);
|
||||||
T2Csend.player(player, SelectMessages.ItemOFF);
|
T2Csend.player(player, SelectMessages.ItemOFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onSetSlot(Player player, Integer setSlot) {
|
public static void onSetSlot(Player player, String useItemKey, Integer setSlot) {
|
||||||
if (!(Boolean) Config.useItemAllowSetSlot.value) {
|
if (!(Boolean) ConfigValues.useItemAllowSetSlot.value) {
|
||||||
T2Csend.player(player, Util.getPrefix() + " §4Function disabled");
|
T2Csend.player(player, Util.getPrefix() + " §4Function disabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -165,13 +166,13 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Boolean) Config.useItemInventorySlotEnforce.value || player.getInventory().getItem(setSlot - 1) != null) {
|
if ((Boolean) ConfigValues.useItemInventorySlotEnforce.value || player.getInventory().getItem(setSlot - 1) != null) {
|
||||||
T2Csend.player(player, SelectMessages.ItemSlotNotEmpty.replace("[slot]", setSlot.toString()));
|
T2Csend.player(player, SelectMessages.ItemSlotNotEmpty.replace("[slot]", setSlot.toString()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UseItem.removeItem(player);
|
UseItem.removeItem(player);
|
||||||
SelectDatabase.setSlot(player, setSlot);
|
SelectDatabase.setSlot(player, useItemKey, setSlot);
|
||||||
Events.useItemSlotHashMap.replace(player.getName(), setSlot);
|
Events.useItemSlotHashMap.replace(player.getName(), setSlot);
|
||||||
|
|
||||||
if (Events.useItemHashMap.get(player.getName())) {
|
if (Events.useItemHashMap.get(player.getName())) {
|
||||||
@ -182,11 +183,11 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void gui(Player player) {
|
public static void gui(Player player) {
|
||||||
if (Main.guiHashMap.containsKey(String.valueOf(Config.defaultGUI.value))) {
|
if (Cache.guiHashMap.containsKey(String.valueOf(ConfigValues.defaultGUI.value))) {
|
||||||
GuiObject gui = Main.guiHashMap.get(String.valueOf(Config.defaultGUI.value));
|
GuiObject gui = Cache.guiHashMap.get(String.valueOf(ConfigValues.defaultGUI.value));
|
||||||
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||||
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) {
|
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) {
|
||||||
OpenGUI.openGUI(player, String.valueOf(Config.defaultGUI.value), true);
|
OpenGUI.openGUI(player, String.valueOf(ConfigValues.defaultGUI.value), true);
|
||||||
} else T2Csend.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui")
|
} else T2Csend.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui")
|
||||||
.replace("[perm]", "commandgui.command"));
|
.replace("[perm]", "commandgui.command"));
|
||||||
} else T2Csend.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", gui.guiName));
|
} else T2Csend.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", gui.guiName));
|
||||||
@ -194,8 +195,8 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void gui(Player player, String arg) {
|
public static void gui(Player player, String arg) {
|
||||||
if (Main.guiHashMap.containsKey(arg)) {
|
if (Cache.guiHashMap.containsKey(arg)) {
|
||||||
GuiObject gui = Main.guiHashMap.get(arg);
|
GuiObject gui = Cache.guiHashMap.get(arg);
|
||||||
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||||
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + gui.key) || player.hasPermission("commandgui.bypass")) {
|
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + gui.key) || player.hasPermission("commandgui.bypass")) {
|
||||||
OpenGUI.openGUI(player, arg, true);
|
OpenGUI.openGUI(player, arg, true);
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
|
import net.t2code.commandguiv2.cache.Cache;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -14,7 +15,7 @@ public class Help {
|
|||||||
private static String prefix = Util.getPrefix();
|
private static String prefix = Util.getPrefix();
|
||||||
|
|
||||||
public static void sendHelp(CommandSender sender, String Prefix) {
|
public static void sendHelp(CommandSender sender, String Prefix) {
|
||||||
GuiObject gui = Main.guiHashMap.get(String.valueOf(Config.defaultGUI.value));
|
GuiObject gui = Cache.guiHashMap.get(String.valueOf(ConfigValues.defaultGUI.value));
|
||||||
|
|
||||||
T2Csend.sender(sender, Prefix + " §8----- §4Command§9GUI §chelp §8-----");
|
T2Csend.sender(sender, Prefix + " §8----- §4Command§9GUI §chelp §8-----");
|
||||||
cgui(sender, gui);
|
cgui(sender, gui);
|
||||||
@ -40,12 +41,12 @@ public class Help {
|
|||||||
private static void open(CommandSender sender) {
|
private static void open(CommandSender sender) {
|
||||||
if (!sender.hasPermission("commandgui.command")) return;
|
if (!sender.hasPermission("commandgui.command")) return;
|
||||||
|
|
||||||
for (String alias : Main.allAliases) {
|
for (String alias : Cache.allAliases) {
|
||||||
if (Main.guiHashMap.get(alias).guiEnable || sender.hasPermission("commandgui.bypass")) {
|
if (Cache.guiHashMap.get(alias).guiEnable || sender.hasPermission("commandgui.bypass")) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpOpen.replace("[gui]", alias).replace("[guiname]", T2Creplace.replace(prefix, Main.guiHashMap.get(alias).guiName)));
|
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpOpen.replace("[gui]", alias).replace("[guiname]", T2Creplace.replace(prefix, Cache.guiHashMap.get(alias).guiName)));
|
||||||
} else
|
} else
|
||||||
T2Csend.sender(sender, prefix + " " + SelectMessages.HelpOpen.replace("[gui]", alias).replace("[guiname]", T2Creplace.replace(prefix, Main.guiHashMap.get(alias).guiName)));
|
T2Csend.sender(sender, prefix + " " + SelectMessages.HelpOpen.replace("[gui]", alias).replace("[guiname]", T2Creplace.replace(prefix, Cache.guiHashMap.get(alias).guiName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package net.t2code.commandguiv2.Spigot.cmdManagement.register;
|
|||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
|
import net.t2code.commandguiv2.cache.Cache;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandMap;
|
import org.bukkit.command.CommandMap;
|
||||||
@ -14,13 +15,13 @@ public class AliasRegister {
|
|||||||
public static void onRegister() {
|
public static void onRegister() {
|
||||||
Plugin plugin = Main.getPlugin();
|
Plugin plugin = Main.getPlugin();
|
||||||
T2Csend.debug(plugin, Bukkit.getServer().getClass().getPackage().getName());
|
T2Csend.debug(plugin, Bukkit.getServer().getClass().getPackage().getName());
|
||||||
if (Main.allAliases.toString().equals("[]")) {
|
if (Cache.allAliases.toString().equals("[]")) {
|
||||||
T2Csend.console(Util.getPrefix() + " §4No GUI files available");
|
T2Csend.console(Util.getPrefix() + " §4No GUI files available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (String alias : Main.allAliases) {
|
for (String alias : Cache.allAliases) {
|
||||||
if (Main.guiHashMap.get(alias) != null) {
|
if (Cache.guiHashMap.get(alias) != null) {
|
||||||
if (Main.guiHashMap.get(alias).commandAliasEnable) {
|
if (Cache.guiHashMap.get(alias).commandAliasEnable) {
|
||||||
try {
|
try {
|
||||||
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||||
bukkitCommandMap.setAccessible(true);
|
bukkitCommandMap.setAccessible(true);
|
||||||
|
@ -5,6 +5,7 @@ import net.t2code.commandguiv2.Spigot.Main;
|
|||||||
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
||||||
import net.t2code.commandguiv2.Spigot.function.gui.OpenGUI;
|
import net.t2code.commandguiv2.Spigot.function.gui.OpenGUI;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
|
import net.t2code.commandguiv2.cache.Cache;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -23,7 +24,7 @@ public class RegisterCommand extends Command {
|
|||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
GuiObject gui = Main.guiHashMap.get(alias);
|
GuiObject gui = Cache.guiHashMap.get(alias);
|
||||||
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||||
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) {
|
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) {
|
||||||
OpenGUI.openGUI(player, alias, true);
|
OpenGUI.openGUI(player, alias, true);
|
||||||
|
@ -18,7 +18,7 @@ public class ConfigSelect {
|
|||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
if (yamlConfiguration.contains("ConfigVersion")) {
|
if (yamlConfiguration.contains("ConfigVersion")) {
|
||||||
if (yamlConfiguration.getInt("ConfigVersion") < (Integer) Config.configVersion.value && new File(Main.getPath(), "config.yml").exists()) {
|
if (yamlConfiguration.getInt("ConfigVersion") < (Integer) ConfigValues.configVersion.value && new File(Main.getPath(), "config.yml").exists()) {
|
||||||
T2Csend.console(Util.getPrefix() + " §4----------------------");
|
T2Csend.console(Util.getPrefix() + " §4----------------------");
|
||||||
T2Csend.console(Util.getPrefix() + " ");
|
T2Csend.console(Util.getPrefix() + " ");
|
||||||
T2Csend.console(Util.getPrefix() + " §6New features have been added to CommandGUI. The Config is adapted!");
|
T2Csend.console(Util.getPrefix() + " §6New features have been added to CommandGUI. The Config is adapted!");
|
||||||
@ -37,8 +37,8 @@ public class ConfigSelect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
yamlConfiguration.set(Config.configVersion.path, Config.configVersion.value);
|
yamlConfiguration.set(ConfigValues.configVersion.path, ConfigValues.configVersion.value);
|
||||||
for (Config value : Config.values()) {
|
for (ConfigValues value : ConfigValues.values()) {
|
||||||
T2Cconfig.set(value.path, value.value, yamlConfiguration);
|
T2Cconfig.set(value.path, value.value, yamlConfiguration);
|
||||||
value.value = T2Cconfig.selectObject(Util.getPrefix(), value.path, yamlConfiguration);
|
value.value = T2Cconfig.selectObject(Util.getPrefix(), value.path, yamlConfiguration);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public enum Config {
|
public enum ConfigValues {
|
||||||
|
|
||||||
configVersion("configVersion", 6),
|
configVersion("configVersion", 6),
|
||||||
debug("plugins.debug", false),
|
debug("plugins.debug", false),
|
||||||
@ -115,7 +115,7 @@ public enum Config {
|
|||||||
public final String path;
|
public final String path;
|
||||||
public Object value;
|
public Object value;
|
||||||
|
|
||||||
Config(String path, Object defaultValue) {
|
ConfigValues(String path, Object defaultValue) {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.value = defaultValue;
|
this.value = defaultValue;
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ public enum Config {
|
|||||||
check(soundPlayerNotFoundInput,getPlayerNotFound());
|
check(soundPlayerNotFoundInput,getPlayerNotFound());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void check(Config object, Sound defaultSound){
|
private static void check(ConfigValues object, Sound defaultSound){
|
||||||
try {
|
try {
|
||||||
Sound sound = Sound.valueOf(String.valueOf(object.value));
|
Sound sound = Sound.valueOf(String.valueOf(object.value));
|
||||||
if (sound != null) {
|
if (sound != null) {
|
@ -1,7 +1,7 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.config.configConverter;
|
package net.t2code.commandguiv2.Spigot.config.configConverter;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Spigot.config.functions.CreateFunctions;
|
import net.t2code.commandguiv2.Spigot.config.functions.CreateFunctions;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
||||||
@ -78,7 +78,7 @@ public class ConfigConverterV5 {
|
|||||||
File config = new File(Main.getPath(), "GUIs/" + configOld.getName().replace(".yml", "") + ".yml");
|
File config = new File(Main.getPath(), "GUIs/" + configOld.getName().replace(".yml", "") + ".yml");
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
yamlConfiguration.set(Config.configVersion.path, 5);
|
yamlConfiguration.set(ConfigValues.configVersion.path, 5);
|
||||||
|
|
||||||
Boolean enable = yamlConfigurationOld.getBoolean("GUI.Enable");
|
Boolean enable = yamlConfigurationOld.getBoolean("GUI.Enable");
|
||||||
Integer lines = yamlConfigurationOld.getInt("GUI.Lines");
|
Integer lines = yamlConfigurationOld.getInt("GUI.Lines");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.config.configConverter;
|
package net.t2code.commandguiv2.Spigot.config.configConverter;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -32,102 +32,102 @@ public class ConfigConverterV6 {
|
|||||||
|
|
||||||
configOld = new File(Main.getPath(), "configV5.yml");
|
configOld = new File(Main.getPath(), "configV5.yml");
|
||||||
yamlConfigurationOld = YamlConfiguration.loadConfiguration(configOld);
|
yamlConfigurationOld = YamlConfiguration.loadConfiguration(configOld);
|
||||||
set(Config.debug, "Plugin.Debug");
|
set(ConfigValues.debug, "Plugin.Debug");
|
||||||
|
|
||||||
set(Config.updateCheckOnJoin, "Plugin.updateCheck.onJoin");
|
set(ConfigValues.updateCheckOnJoin, "Plugin.updateCheck.onJoin");
|
||||||
set(Config.updateCheckSeePreReleaseUpdates, "Plugin.updateCheck.seePreReleaseUpdates");
|
set(ConfigValues.updateCheckSeePreReleaseUpdates, "Plugin.updateCheck.seePreReleaseUpdates");
|
||||||
set(Config.updateCheckTimeInterval, "Plugin.updateCheck.timeInterval");
|
set(ConfigValues.updateCheckTimeInterval, "Plugin.updateCheck.timeInterval");
|
||||||
set(Config.helpAlias, "Plugin.HelpAlias");
|
set(ConfigValues.helpAlias, "Plugin.HelpAlias");
|
||||||
set(Config.adminSubCommand, "Plugin.AdminSubCommand");
|
set(ConfigValues.adminSubCommand, "Plugin.AdminSubCommand");
|
||||||
set(Config.language, "Plugin.language");
|
set(ConfigValues.language, "Plugin.language");
|
||||||
set(Config.currency, "Plugin.Currency");
|
set(ConfigValues.currency, "Plugin.Currency");
|
||||||
set(Config.defaultGUI, "Plugin.DefaultGUI");
|
set(ConfigValues.defaultGUI, "Plugin.DefaultGUI");
|
||||||
|
|
||||||
set(Config.storage, "Storage.Type");
|
set(ConfigValues.storage, "Storage.Type");
|
||||||
set(Config.mysqlIp, "Storage.MySQL.IP");
|
set(ConfigValues.mysqlIp, "Storage.MySQL.IP");
|
||||||
set(Config.mysqlPort, "Storage.MySQL.Port");
|
set(ConfigValues.mysqlPort, "Storage.MySQL.Port");
|
||||||
set(Config.mysqlDatabase, "Storage.MySQL.Database");
|
set(ConfigValues.mysqlDatabase, "Storage.MySQL.Database");
|
||||||
set(Config.mysqlUser, "Storage.MySQL.User");
|
set(ConfigValues.mysqlUser, "Storage.MySQL.User");
|
||||||
set(Config.mysqlPassword, "Storage.MySQL.Password");
|
set(ConfigValues.mysqlPassword, "Storage.MySQL.Password");
|
||||||
set(Config.mysqlSSL, "Storage.MySQL.SSL");
|
set(ConfigValues.mysqlSSL, "Storage.MySQL.SSL");
|
||||||
|
|
||||||
set(Config.useItemEnable, "UseItem.Enable");
|
set(ConfigValues.useItemEnable, "UseItem.Enable");
|
||||||
set(Config.useItemAllowToggle, "UseItem.AllowToggle");
|
set(ConfigValues.useItemAllowToggle, "UseItem.AllowToggle");
|
||||||
set(Config.useItemAllowSetSlot, "UseItem.AllowSetSlot");
|
set(ConfigValues.useItemAllowSetSlot, "UseItem.AllowSetSlot");
|
||||||
set(Config.useItemBlockMoveAndDrop, "UseItem.BlockMoveAndDrop");
|
set(ConfigValues.useItemBlockMoveAndDrop, "UseItem.BlockMoveAndDrop");
|
||||||
set(Config.useItemOpenGUI, "UseItem.OpenGUI");
|
set(ConfigValues.useItemOpenGUI, "UseItem.OpenGUI");
|
||||||
set(Config.useItemPermission, "UseItem.Permission.NeededToUse");
|
set(ConfigValues.useItemPermission, "UseItem.Permission.NeededToUse");
|
||||||
set(Config.useItemKeepAtCommandClear, "UseItem.KeepAtCommandClear");
|
set(ConfigValues.useItemKeepAtCommandClear, "UseItem.KeepAtCommandClear");
|
||||||
|
|
||||||
set(Config.useItemInventorySlotFreeSlot, "UseItem.InventorySlot.FreeSlot");
|
set(ConfigValues.useItemInventorySlotFreeSlot, "UseItem.InventorySlot.FreeSlot");
|
||||||
set(Config.useItemInventorySlot, "UseItem.InventorySlot.Slot");
|
set(ConfigValues.useItemInventorySlot, "UseItem.InventorySlot.Slot");
|
||||||
set(Config.useItemInventorySlotEnforce, "UseItem.InventorySlot.SlotEnforce");
|
set(ConfigValues.useItemInventorySlotEnforce, "UseItem.InventorySlot.SlotEnforce");
|
||||||
set(Config.useItemMaterial, "UseItem.Item.Material");
|
set(ConfigValues.useItemMaterial, "UseItem.Item.Material");
|
||||||
|
|
||||||
set(Config.useItemPlayerHeadEnable, "UseItem.Item.PlayerHead.Enable");
|
set(ConfigValues.useItemPlayerHeadEnable, "UseItem.Item.PlayerHead.Enable");
|
||||||
set(Config.useItemBase64Enable, "UseItem.Item.PlayerHead.Base64.Enable");
|
set(ConfigValues.useItemBase64Enable, "UseItem.Item.PlayerHead.Base64.Enable");
|
||||||
set(Config.useItemBase64value, "UseItem.Item.PlayerHead.Base64.Base64Value");
|
set(ConfigValues.useItemBase64value, "UseItem.Item.PlayerHead.Base64.Base64Value");
|
||||||
set(Config.useItemPlayerWhoHasOpenedTheGUI, "UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI");
|
set(ConfigValues.useItemPlayerWhoHasOpenedTheGUI, "UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI");
|
||||||
set(Config.useItemPlayerName, "UseItem.Item.PlayerHead.PlayerName");
|
set(ConfigValues.useItemPlayerName, "UseItem.Item.PlayerHead.PlayerName");
|
||||||
set(Config.useItemName, "UseItem.Item.Name");
|
set(ConfigValues.useItemName, "UseItem.Item.Name");
|
||||||
set(Config.useItemLore, "UseItem.Item.Lore");
|
set(ConfigValues.useItemLore, "UseItem.Item.Lore");
|
||||||
set(Config.useItemGiveOnEveryJoin, "UseItem.Join.GiveOnEveryJoin");
|
set(ConfigValues.useItemGiveOnEveryJoin, "UseItem.Join.GiveOnEveryJoin");
|
||||||
set(Config.useItemGiveOnlyOnFirstJoin, "UseItem.Join.GiveOnlyOnFirstJoin");
|
set(ConfigValues.useItemGiveOnlyOnFirstJoin, "UseItem.Join.GiveOnlyOnFirstJoin");
|
||||||
set(Config.cursorToGUIItemOnLogin, "UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable");
|
set(ConfigValues.cursorToGUIItemOnLogin, "UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable");
|
||||||
set(Config.cursorToGUIItemOnlyOnFirstLogin, "UseItem.Join.Cursor.ToGUIItem.Spigot.OnlyOnFirstLogin");
|
set(ConfigValues.cursorToGUIItemOnlyOnFirstLogin, "UseItem.Join.Cursor.ToGUIItem.Spigot.OnlyOnFirstLogin");
|
||||||
set(Config.useItemServerChange, "UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange");
|
set(ConfigValues.useItemServerChange, "UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange");
|
||||||
|
|
||||||
set(Config.toggleItemOnOrYesBase64, "Toggle.Items.OnOrYes.Item.Base64.Enable");
|
set(ConfigValues.toggleItemOnOrYesBase64, "Toggle.Items.OnOrYes.Item.Base64.Enable");
|
||||||
set(Config.toggleItemOnOrYesBase64Value, "Toggle.Items.OnOrYes.Item.Base64.Base64Value");
|
set(ConfigValues.toggleItemOnOrYesBase64Value, "Toggle.Items.OnOrYes.Item.Base64.Base64Value");
|
||||||
set(Config.toggleItemOnOrYesMaterial, "Toggle.Items.OnOrYes.Item.Material");
|
set(ConfigValues.toggleItemOnOrYesMaterial, "Toggle.Items.OnOrYes.Item.Material");
|
||||||
|
|
||||||
set(Config.toggleItemOffOrNoBase64, "Toggle.Items.OffOrNo.Item.Base64.Enable");
|
set(ConfigValues.toggleItemOffOrNoBase64, "Toggle.Items.OffOrNo.Item.Base64.Enable");
|
||||||
set(Config.toggleItemOffOrNoBase64Value, "Toggle.Items.OffOrNo.Item.Base64.Base64Value");
|
set(ConfigValues.toggleItemOffOrNoBase64Value, "Toggle.Items.OffOrNo.Item.Base64.Base64Value");
|
||||||
set(Config.toggleItemOffOrNoMaterial, "Toggle.Items.OffOrNo.Item.Material");
|
set(ConfigValues.toggleItemOffOrNoMaterial, "Toggle.Items.OffOrNo.Item.Material");
|
||||||
|
|
||||||
set(Config.togglePermTrue, "Toggle.Permission.Commands.True");
|
set(ConfigValues.togglePermTrue, "Toggle.Permission.Commands.True");
|
||||||
set(Config.togglePermFalse, "Toggle.Permission.Commands.False");
|
set(ConfigValues.togglePermFalse, "Toggle.Permission.Commands.False");
|
||||||
|
|
||||||
set(Config.placeholderTrue, "Placeholder.True");
|
set(ConfigValues.placeholderTrue, "Placeholder.True");
|
||||||
set(Config.placeholderFalse, "Placeholder.False");
|
set(ConfigValues.placeholderFalse, "Placeholder.False");
|
||||||
|
|
||||||
set(Config.soundEnable, "Sound.Enable");
|
set(ConfigValues.soundEnable, "Sound.Enable");
|
||||||
set(Config.soundOpenInventoryEnable, "Sound.OpenInventory.Enable");
|
set(ConfigValues.soundOpenInventoryEnable, "Sound.OpenInventory.Enable");
|
||||||
set(Config.soundOpenInventoryInput, "Sound.OpenInventory.Sound");
|
set(ConfigValues.soundOpenInventoryInput, "Sound.OpenInventory.Sound");
|
||||||
set(Config.soundClickEnable, "Sound.Click.Enable");
|
set(ConfigValues.soundClickEnable, "Sound.Click.Enable");
|
||||||
set(Config.soundClickInput, "Sound.Click.Sound");
|
set(ConfigValues.soundClickInput, "Sound.Click.Sound");
|
||||||
set(Config.soundNoMoneyEnable, "Sound.NoMoney.Enable");
|
set(ConfigValues.soundNoMoneyEnable, "Sound.NoMoney.Enable");
|
||||||
set(Config.soundNoMoneyInput, "Sound.NoMoney.Sound");
|
set(ConfigValues.soundNoMoneyInput, "Sound.NoMoney.Sound");
|
||||||
|
|
||||||
set(Config.soundNoInventorySpaceEnable, "Sound.NoInventorySpace.Enable");
|
set(ConfigValues.soundNoInventorySpaceEnable, "Sound.NoInventorySpace.Enable");
|
||||||
set(Config.soundNoInventorySpaceInput, "Sound.NoInventorySpace.Sound");
|
set(ConfigValues.soundNoInventorySpaceInput, "Sound.NoInventorySpace.Sound");
|
||||||
set(Config.soundGiveEnable, "Sound.Give.Enable");
|
set(ConfigValues.soundGiveEnable, "Sound.Give.Enable");
|
||||||
set(Config.soundGiveInput, "Sound.Give.Sound");
|
set(ConfigValues.soundGiveInput, "Sound.Give.Sound");
|
||||||
set(Config.soundPlayerNotFoundEnable, "Sound.PlayerNotFound.Enable");
|
set(ConfigValues.soundPlayerNotFoundEnable, "Sound.PlayerNotFound.Enable");
|
||||||
set(Config.soundPlayerNotFoundInput, "Sound.PlayerNotFound.Sound");
|
set(ConfigValues.soundPlayerNotFoundInput, "Sound.PlayerNotFound.Sound");
|
||||||
|
|
||||||
set(Config.useItemGameModeChangeEnable, "Advanced.UseItem.GameMode.Change.Enable");
|
set(ConfigValues.useItemGameModeChangeEnable, "Advanced.UseItem.GameMode.Change.Enable");
|
||||||
set(Config.useItemGameModeChangeDelayInTicks, "Advanced.UseItem.GameMode.Change.DelayInTicks");
|
set(ConfigValues.useItemGameModeChangeDelayInTicks, "Advanced.UseItem.GameMode.Change.DelayInTicks");
|
||||||
set(Config.useItemGameModeProtection, "Advanced.UseItem.GameMode.Protection.Enable");
|
set(ConfigValues.useItemGameModeProtection, "Advanced.UseItem.GameMode.Protection.Enable");
|
||||||
set(Config.useItemGameModeRemoveItemWhenItIsDisabled, "Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled");
|
set(ConfigValues.useItemGameModeRemoveItemWhenItIsDisabled, "Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled");
|
||||||
set(Config.useItemGameModeMode, "Advanced.UseItem.GameMode.Protection.Mode");
|
set(ConfigValues.useItemGameModeMode, "Advanced.UseItem.GameMode.Protection.Mode");
|
||||||
|
|
||||||
set(Config.useItemGameModeList, "Advanced.UseItem.GameMode.Protection.List");
|
set(ConfigValues.useItemGameModeList, "Advanced.UseItem.GameMode.Protection.List");
|
||||||
|
|
||||||
set(Config.useItemWorldChangeEnable, "Advanced.UseItem.World.Change.Enable");
|
set(ConfigValues.useItemWorldChangeEnable, "Advanced.UseItem.World.Change.Enable");
|
||||||
set(Config.useItemWorldChangeDelayInTicks, "Advanced.UseItem.World.Change.DelayInTicks");
|
set(ConfigValues.useItemWorldChangeDelayInTicks, "Advanced.UseItem.World.Change.DelayInTicks");
|
||||||
set(Config.useItemWorldProtection, "Advanced.UseItem.World.Protection.Enable");
|
set(ConfigValues.useItemWorldProtection, "Advanced.UseItem.World.Protection.Enable");
|
||||||
set(Config.useItemWorldRemoveItemWhenItIsDisabled, "Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled");
|
set(ConfigValues.useItemWorldRemoveItemWhenItIsDisabled, "Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled");
|
||||||
set(Config.useItemWorldMode, "Advanced.UseItem.World.Protection.Mode");
|
set(ConfigValues.useItemWorldMode, "Advanced.UseItem.World.Protection.Mode");
|
||||||
set(Config.useItemWorldList, "Advanced.UseItem.World.Protection.List");
|
set(ConfigValues.useItemWorldList, "Advanced.UseItem.World.Protection.List");
|
||||||
|
|
||||||
set(Config.disableInfoBySneak, "Advanced.UseItem.DisableInfoBySneak");
|
set(ConfigValues.disableInfoBySneak, "Advanced.UseItem.DisableInfoBySneak");
|
||||||
|
|
||||||
|
|
||||||
set(Config.useItemItemBlockBlacklist, "Advanced.UseItem.ItemBlockBlacklist");
|
set(ConfigValues.useItemItemBlockBlacklist, "Advanced.UseItem.ItemBlockBlacklist");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void set(Config obj, String path) {
|
private void set(ConfigValues obj, String path) {
|
||||||
if (!yamlConfigurationOld.contains(path)) return;
|
if (!yamlConfigurationOld.contains(path)) return;
|
||||||
obj.value = yamlConfigurationOld.get(path);
|
obj.value = yamlConfigurationOld.get(path);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import net.t2code.commandguiv2.Spigot.enums.EcoEnum;
|
|||||||
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
||||||
|
import net.t2code.commandguiv2.cache.Cache;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class SelectFunctions {
|
public class SelectFunctions {
|
||||||
public static void onSelectFunction() {
|
public static void onSelectFunction() {
|
||||||
Main.functionHashMap.clear();
|
Cache.functionHashMap.clear();
|
||||||
File f = new File(Main.getPath() + "/Functions/");
|
File f = new File(Main.getPath() + "/Functions/");
|
||||||
File[] fileArray = f.listFiles();
|
File[] fileArray = f.listFiles();
|
||||||
|
|
||||||
@ -127,7 +128,7 @@ public class SelectFunctions {
|
|||||||
configDoubleValueLeft, configListValueLeft, configStringValueRight, configBooleanValueRight, configIntegerValueRight, configDoubleValueRight,
|
configDoubleValueLeft, configListValueLeft, configStringValueRight, configBooleanValueRight, configIntegerValueRight, configDoubleValueRight,
|
||||||
configListValueRight, pluginReloadEnable, pluginReloadCommand, functionVotePoints, functionVotePointsMode, functionVotePointsAmount,
|
configListValueRight, pluginReloadEnable, pluginReloadCommand, functionVotePoints, functionVotePointsMode, functionVotePointsAmount,
|
||||||
functionItem, functionItemMode, functionItemItem);
|
functionItem, functionItemMode, functionItemItem);
|
||||||
Main.functionHashMap.put(key, function);
|
Cache.functionHashMap.put(key, function);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
yamlConfiguration.save(config);
|
yamlConfiguration.save(config);
|
||||||
|
@ -5,6 +5,7 @@ import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
|
|||||||
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
|
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
|
||||||
|
import net.t2code.commandguiv2.cache.Cache;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@ -15,8 +16,8 @@ import java.util.ArrayList;
|
|||||||
public class SelectGui {
|
public class SelectGui {
|
||||||
|
|
||||||
public static void onSelectGui() {
|
public static void onSelectGui() {
|
||||||
Main.guiHashMap.clear();
|
Cache.guiHashMap.clear();
|
||||||
Main.allAliases.clear();
|
Cache.allAliases.clear();
|
||||||
File f = new File(Main.getPath() + "/GUIs/");
|
File f = new File(Main.getPath() + "/GUIs/");
|
||||||
File[] fileArray = f.listFiles();
|
File[] fileArray = f.listFiles();
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ public class SelectGui {
|
|||||||
String sub = config.getName().substring(config.getName().length() - 4);
|
String sub = config.getName().substring(config.getName().length() - 4);
|
||||||
if (sub.equals(".yml")) {
|
if (sub.equals(".yml")) {
|
||||||
String key = config.getName().replace(".yml", "");
|
String key = config.getName().replace(".yml", "");
|
||||||
Main.allAliases.add(key);
|
Cache.allAliases.add(key);
|
||||||
YamlConfiguration yamlConfiguration_gui = YamlConfiguration.loadConfiguration(config);
|
YamlConfiguration yamlConfiguration_gui = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
Boolean guiEnable = yamlConfiguration_gui.getBoolean("GUI.Enable");
|
Boolean guiEnable = yamlConfiguration_gui.getBoolean("GUI.Enable");
|
||||||
@ -53,7 +54,7 @@ public class SelectGui {
|
|||||||
Integer slotNumber = yamlConfiguration_gui.getInt("Slots." + slotKey + ".Slot") - 1;
|
Integer slotNumber = yamlConfiguration_gui.getInt("Slots." + slotKey + ".Slot") - 1;
|
||||||
Boolean enable = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Enable");
|
Boolean enable = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Enable");
|
||||||
String function = yamlConfiguration_gui.getString("Slots." + slotKey + ".Function");
|
String function = yamlConfiguration_gui.getString("Slots." + slotKey + ".Function");
|
||||||
FunctionObject functionCheck = Main.functionHashMap.get(function);
|
FunctionObject functionCheck = Cache.functionHashMap.get(function);
|
||||||
if (functionCheck == null) {
|
if (functionCheck == null) {
|
||||||
T2Csend.error(Main.getPlugin(), "The Function " + function + " in the GUI " + key + " does not exist!");
|
T2Csend.error(Main.getPlugin(), "The Function " + function + " in the GUI " + key + " does not exist!");
|
||||||
}
|
}
|
||||||
@ -71,7 +72,7 @@ public class SelectGui {
|
|||||||
GuiObject gui = new GuiObject(guiEnable, guiLines, guiName, guiFillItemEnable, guiFillItemItem,
|
GuiObject gui = new GuiObject(guiEnable, guiLines, guiName, guiFillItemEnable, guiFillItemItem,
|
||||||
key, commandAliasEnable, commandPermission, slots);
|
key, commandAliasEnable, commandPermission, slots);
|
||||||
|
|
||||||
Main.guiHashMap.put(key, gui);
|
Cache.guiHashMap.put(key, gui);
|
||||||
CmdExecuter_GUI.arg1.put(config.getName()
|
CmdExecuter_GUI.arg1.put(config.getName()
|
||||||
.replace(".yml", ""), "commandgui.gui." + key);
|
.replace(".yml", ""), "commandgui.gui." + key);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.config.languages;
|
package net.t2code.commandguiv2.Spigot.config.languages;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
@ -87,17 +87,17 @@ public class SelectMessages {
|
|||||||
|
|
||||||
File msg;
|
File msg;
|
||||||
|
|
||||||
msg = new File(Main.getPath(), "languages/" + Config.language.value + "_messages.yml");
|
msg = new File(Main.getPath(), "languages/" + ConfigValues.language.value + "_messages.yml");
|
||||||
if (!msg.isFile()) {
|
if (!msg.isFile()) {
|
||||||
T2Csend.console(Prefix);
|
T2Csend.console(Prefix);
|
||||||
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
T2Csend.console(Prefix + " §4The selected §c" + Config.language.value + " §4language file was not found.");
|
T2Csend.console(Prefix + " §4The selected §c" + ConfigValues.language.value + " §4language file was not found.");
|
||||||
T2Csend.console(Prefix + " §6The default language §eEnglish §6is used!");
|
T2Csend.console(Prefix + " §6The default language §eEnglish §6is used!");
|
||||||
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
T2Csend.console(Prefix);
|
T2Csend.console(Prefix);
|
||||||
msg = new File(Main.getPath(), "languages/" + "english_messages.yml");
|
msg = new File(Main.getPath(), "languages/" + "english_messages.yml");
|
||||||
selectMSG = "english";
|
selectMSG = "english";
|
||||||
} else selectMSG = String.valueOf(Config.language.value);
|
} else selectMSG = String.valueOf(ConfigValues.language.value);
|
||||||
YamlConfiguration yamlConfiguration_msg = YamlConfiguration.loadConfiguration(msg);
|
YamlConfiguration yamlConfiguration_msg = YamlConfiguration.loadConfiguration(msg);
|
||||||
|
|
||||||
VaultNotSetUp = select("Plugin.VaultNotSetUp", yamlConfiguration_msg);
|
VaultNotSetUp = select("Plugin.VaultNotSetUp", yamlConfiguration_msg);
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
package net.t2code.commandguiv2.Spigot.config.useItems;
|
||||||
|
|
||||||
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterV5;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterV6;
|
||||||
|
import net.t2code.commandguiv2.Spigot.enums.EcoEnum;
|
||||||
|
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
||||||
|
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
||||||
|
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
||||||
|
import net.t2code.commandguiv2.Spigot.objects.UseItemObject;
|
||||||
|
import net.t2code.commandguiv2.Util;
|
||||||
|
import net.t2code.commandguiv2.cache.Cache;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class UseItemSelect {
|
||||||
|
|
||||||
|
public UseItemSelect(){
|
||||||
|
create();
|
||||||
|
onSelectFunction();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void create(){
|
||||||
|
File config = new File(Main.getPath(), "/UseItems/default.yml");
|
||||||
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
|
for (UseItemValues value : UseItemValues.values()) {
|
||||||
|
T2Cconfig.set(value.path, value.value, yamlConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
yamlConfiguration.save(config);
|
||||||
|
} catch (
|
||||||
|
IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void onSelectFunction() {
|
||||||
|
Cache.useItemHash.clear();
|
||||||
|
File f = new File(Main.getPath() + "/UseItems/");
|
||||||
|
File[] fileArray = f.listFiles();
|
||||||
|
|
||||||
|
for (File config : fileArray) {
|
||||||
|
if (config.getName().equals("useItemDeclaration.yml")) continue;
|
||||||
|
String sub = config.getName().substring(config.getName().length() - 4);
|
||||||
|
if (sub.equals(".yml")) {
|
||||||
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
|
String key = config.getName().replace(".yml", "");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UseItemObject useItem = new UseItemObject(key);
|
||||||
|
Cache.useItemHash.put(key, useItem);
|
||||||
|
|
||||||
|
try {
|
||||||
|
yamlConfiguration.save(config);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package net.t2code.commandguiv2.Spigot.config.useItems;
|
||||||
|
|
||||||
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
|
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
||||||
|
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
||||||
|
import net.t2code.commandguiv2.Util;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public enum UseItemValues {
|
||||||
|
|
||||||
|
enable("useItem.enable",true),
|
||||||
|
openGUI("useItem.openGUI","default"),
|
||||||
|
allowToggle("useItem.allowToggle",true),
|
||||||
|
allowSetSlot("useItem.allowSetSlot",true),
|
||||||
|
blockMoveAndDrop("useItem.blockMoveAndDrop",true),
|
||||||
|
permissionBecomeNeeded("useItem.permission.become.needed",true),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null),
|
||||||
|
xxxx("useItem.enable",null);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public final String path;
|
||||||
|
public Object value;
|
||||||
|
|
||||||
|
UseItemValues(String path, Object defaultValue) {
|
||||||
|
this.path = path;
|
||||||
|
this.value = defaultValue;
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,7 @@ package net.t2code.commandguiv2.Spigot.database;
|
|||||||
import com.zaxxer.hikari.HikariConfig;
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
|
||||||
@ -24,11 +24,11 @@ public class MySQL {
|
|||||||
ZoneId timeZone = now.getTimeZone().toZoneId();
|
ZoneId timeZone = now.getTimeZone().toZoneId();
|
||||||
T2Csend.debug(Main.getPlugin(), "Server TimeZone is : " + timeZone);
|
T2Csend.debug(Main.getPlugin(), "Server TimeZone is : " + timeZone);
|
||||||
try {
|
try {
|
||||||
config.setJdbcUrl("jdbc:mysql://" + Config.mysqlIp.value + ":" + Config.mysqlPort.value + "/" + Config.mysqlDatabase.value
|
config.setJdbcUrl("jdbc:mysql://" + ConfigValues.mysqlIp.value + ":" + ConfigValues.mysqlPort.value + "/" + ConfigValues.mysqlDatabase.value
|
||||||
+ "?useJDBCCompliantTimezoneShift=true&allowMultiQueries=true&useLegacyDatetimeCode=false&autoReconnect=true&serverTimezone=" + timeZone
|
+ "?useJDBCCompliantTimezoneShift=true&allowMultiQueries=true&useLegacyDatetimeCode=false&autoReconnect=true&serverTimezone=" + timeZone
|
||||||
+ "&useSSL=" + Config.mysqlSSL.value);
|
+ "&useSSL=" + ConfigValues.mysqlSSL.value);
|
||||||
config.setUsername(String.valueOf(Config.mysqlUser.value));
|
config.setUsername(String.valueOf(ConfigValues.mysqlUser.value));
|
||||||
config.setPassword(String.valueOf(Config.mysqlPassword.value));
|
config.setPassword(String.valueOf(ConfigValues.mysqlPassword.value));
|
||||||
config.addDataSourceProperty("cachePrepStmts", "true");
|
config.addDataSourceProperty("cachePrepStmts", "true");
|
||||||
config.addDataSourceProperty("prepStmtCacheSize", "250");
|
config.addDataSourceProperty("prepStmtCacheSize", "250");
|
||||||
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
||||||
@ -39,7 +39,7 @@ public class MySQL {
|
|||||||
T2Csend.error(Main.getPlugin(), ex.getMessage() + " --- " + (System.currentTimeMillis() - long_) + "ms");
|
T2Csend.error(Main.getPlugin(), ex.getMessage() + " --- " + (System.currentTimeMillis() - long_) + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Boolean) Config.debug.value || Main.version.toLowerCase().contains("dev") || Main.version.toLowerCase().contains("beta") || Main.version.toLowerCase().contains("snapshot")) {
|
if ((Boolean) ConfigValues.debug.value || Main.version.toLowerCase().contains("dev") || Main.version.toLowerCase().contains("beta") || Main.version.toLowerCase().contains("snapshot")) {
|
||||||
try {
|
try {
|
||||||
T2Csend.error(Main.getPlugin(), "MySQL DEBUG:");
|
T2Csend.error(Main.getPlugin(), "MySQL DEBUG:");
|
||||||
Connection con = ds.getConnection();
|
Connection con = ds.getConnection();
|
||||||
|
@ -39,7 +39,7 @@ public class SelectDatabase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setSlot(Player player, Integer slot) {
|
public static void setSlot(Player player, String useItemKey, Integer slot) {
|
||||||
switch (Storage) {
|
switch (Storage) {
|
||||||
case MYSQL:
|
case MYSQL:
|
||||||
try {
|
try {
|
||||||
@ -84,7 +84,7 @@ public class SelectDatabase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setItemStatus(Player player, boolean status) {
|
public static void setItemStatus(Player player, String useItemKey, boolean status) {
|
||||||
int i;
|
int i;
|
||||||
if (status) {
|
if (status) {
|
||||||
i = 1;
|
i = 1;
|
||||||
@ -111,7 +111,7 @@ public class SelectDatabase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean selectItemStatus(Player player) {
|
public static Boolean selectItemStatus(Player player,String useItemKey) {
|
||||||
switch (Storage) {
|
switch (Storage) {
|
||||||
case MYSQL:
|
case MYSQL:
|
||||||
String result = MySQL.select("SELECT `Status` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
String result = MySQL.select("SELECT `Status` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
||||||
@ -131,7 +131,7 @@ public class SelectDatabase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer selectSlot(Player player) {
|
public static Integer selectSlot(Player player,String useItemKey) {
|
||||||
switch (Storage) {
|
switch (Storage) {
|
||||||
case MYSQL:
|
case MYSQL:
|
||||||
String result = MySQL.select("SELECT `Slot` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
String result = MySQL.select("SELECT `Slot` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.function.gui;
|
package net.t2code.commandguiv2.Spigot.function.gui;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Spigot.function.listener.ServerChange;
|
import net.t2code.commandguiv2.Spigot.function.listener.ServerChange;
|
||||||
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
|
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
||||||
@ -14,6 +14,7 @@ import net.t2code.commandguiv2.Spigot.system.Placeholder;
|
|||||||
import net.t2code.commandguiv2.Spigot.sound.PlaySound;
|
import net.t2code.commandguiv2.Spigot.sound.PlaySound;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
|
import net.t2code.commandguiv2.cache.Cache;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.eco.T2Ceco;
|
import net.t2code.t2codelib.SPIGOT.api.eco.T2Ceco;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
@ -45,7 +46,7 @@ public class GUIListener implements Listener {
|
|||||||
Player player = (Player) e.getWhoClicked();
|
Player player = (Player) e.getWhoClicked();
|
||||||
if (e.getInventory() == null) return;
|
if (e.getInventory() == null) return;
|
||||||
if (e.getCurrentItem() == null) return;
|
if (e.getCurrentItem() == null) return;
|
||||||
for (GuiObject gui : Main.guiHashMap.values()) {
|
for (GuiObject gui : Cache.guiHashMap.values()) {
|
||||||
if (player.getOpenInventory().getTitle().equals(T2Creplace.replace(prefix, GUICode + gui.guiName))
|
if (player.getOpenInventory().getTitle().equals(T2Creplace.replace(prefix, GUICode + gui.guiName))
|
||||||
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(T2Creplace.replace(prefix, player, GUICode + gui.guiName)))) {
|
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(T2Creplace.replace(prefix, player, GUICode + gui.guiName)))) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
@ -61,7 +62,7 @@ public class GUIListener implements Listener {
|
|||||||
|
|
||||||
private static void execute(InventoryClickEvent e, SlotObject slot, Player player, GuiObject gui) {
|
private static void execute(InventoryClickEvent e, SlotObject slot, Player player, GuiObject gui) {
|
||||||
if (e.getSlot() != slot.slot) return;
|
if (e.getSlot() != slot.slot) return;
|
||||||
FunctionObject function = Main.functionHashMap.get(slot.function);
|
FunctionObject function = Cache.functionHashMap.get(slot.function);
|
||||||
if (slot.permission && !player.hasPermission(slot.permissionToSee)) return;
|
if (slot.permission && !player.hasPermission(slot.permissionToSee)) return;
|
||||||
if (slot.permission && !player.hasPermission(slot.permissionToUse)) {
|
if (slot.permission && !player.hasPermission(slot.permissionToUse)) {
|
||||||
if (function.noPermMessageEnable) {
|
if (function.noPermMessageEnable) {
|
||||||
@ -153,11 +154,11 @@ public class GUIListener implements Listener {
|
|||||||
for (String msg : slot.message) {
|
for (String msg : slot.message) {
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
if (slot.cost_Enable) {
|
if (slot.cost_Enable) {
|
||||||
T2Csend.player(player, T2Creplace.replacePrice(prefix, player, Placeholder.replace(msg, player), slot.price + " " + Config.currency.value));
|
T2Csend.player(player, T2Creplace.replacePrice(prefix, player, Placeholder.replace(msg, player), slot.price + " " + ConfigValues.currency.value));
|
||||||
} else T2Csend.player(player, T2Creplace.replace(prefix, player, Placeholder.replace(msg, player)));
|
} else T2Csend.player(player, T2Creplace.replace(prefix, player, Placeholder.replace(msg, player)));
|
||||||
} else {
|
} else {
|
||||||
if (slot.cost_Enable) {
|
if (slot.cost_Enable) {
|
||||||
T2Csend.player(player, T2Creplace.replacePrice(prefix, Placeholder.replace(msg, player), slot.price + " " + Config.currency.value));
|
T2Csend.player(player, T2Creplace.replacePrice(prefix, Placeholder.replace(msg, player), slot.price + " " + ConfigValues.currency.value));
|
||||||
} else T2Csend.player(player, T2Creplace.replace(prefix, Placeholder.replace(msg, player)));
|
} else T2Csend.player(player, T2Creplace.replace(prefix, Placeholder.replace(msg, player)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,7 +248,7 @@ public class GUIListener implements Listener {
|
|||||||
|
|
||||||
private static void togglePerm(FunctionObject function, GuiObject gui, Player player) {
|
private static void togglePerm(FunctionObject function, GuiObject gui, Player player) {
|
||||||
if (player.hasPermission(function.togglePermissionPerm)) {
|
if (player.hasPermission(function.togglePermissionPerm)) {
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), String.valueOf(Config.togglePermFalse.value).replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), String.valueOf(ConfigValues.togglePermFalse.value).replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -256,7 +257,7 @@ public class GUIListener implements Listener {
|
|||||||
}
|
}
|
||||||
}.runTaskLater(plugin, 4L);
|
}.runTaskLater(plugin, 4L);
|
||||||
} else
|
} else
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), String.valueOf(Config.togglePermTrue.value).replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), String.valueOf(ConfigValues.togglePermTrue.value).replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -361,7 +362,7 @@ public class GUIListener implements Listener {
|
|||||||
PlaySound.play(player, SoundEnum.NoMoney);
|
PlaySound.play(player, SoundEnum.NoMoney);
|
||||||
} else {
|
} else {
|
||||||
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
|
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
|
||||||
.replace("[price]", function.price + " " + Config.currency.value));
|
.replace("[price]", function.price + " " + ConfigValues.currency.value));
|
||||||
execute(function, slot, player, e, gui);
|
execute(function, slot, player, e, gui);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3,12 +3,13 @@ package net.t2code.commandguiv2.Spigot.function.gui;
|
|||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
|
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
|
||||||
import net.t2code.commandguiv2.Spigot.system.Placeholder;
|
import net.t2code.commandguiv2.Spigot.system.Placeholder;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
|
import net.t2code.commandguiv2.cache.Cache;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
@ -27,7 +28,7 @@ public class GuiBuilder {
|
|||||||
private static String prefix = Util.getPrefix();
|
private static String prefix = Util.getPrefix();
|
||||||
|
|
||||||
protected static void item(SlotObject slot, Player player, Inventory inventory) {
|
protected static void item(SlotObject slot, Player player, Inventory inventory) {
|
||||||
FunctionObject function = Main.functionHashMap.get(slot.function);
|
FunctionObject function = Cache.functionHashMap.get(slot.function);
|
||||||
ItemStack item;
|
ItemStack item;
|
||||||
if (Main.legacy && function.item.toUpperCase().contains(",")) {
|
if (Main.legacy && function.item.toUpperCase().contains(",")) {
|
||||||
String[] split = function.item.toUpperCase().split(",");
|
String[] split = function.item.toUpperCase().split(",");
|
||||||
@ -45,7 +46,7 @@ public class GuiBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected static void item(String material, SlotObject slot, Player player, Inventory inventory) {
|
protected static void item(String material, SlotObject slot, Player player, Inventory inventory) {
|
||||||
FunctionObject function = Main.functionHashMap.get(slot.function);
|
FunctionObject function = Cache.functionHashMap.get(slot.function);
|
||||||
ItemStack item;
|
ItemStack item;
|
||||||
if (Main.legacy && material.contains(",")) {
|
if (Main.legacy && material.contains(",")) {
|
||||||
String[] split = material.split(",");
|
String[] split = material.split(",");
|
||||||
@ -64,22 +65,22 @@ public class GuiBuilder {
|
|||||||
|
|
||||||
|
|
||||||
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, SlotObject slot) {
|
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, SlotObject slot) {
|
||||||
FunctionObject function = Main.functionHashMap.get(slot.function);
|
FunctionObject function = Cache.functionHashMap.get(slot.function);
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
itemMeta.setDisplayName(T2Creplace.replace(prefix, player, Placeholder.replace(function.name, player)));
|
itemMeta.setDisplayName(T2Creplace.replace(prefix, player, Placeholder.replace(function.name, player)));
|
||||||
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
|
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
|
||||||
itemMeta.setLore(T2Creplace.replacePrice(prefix, player, Placeholder.replace(function.noPermLore, player), function.price + " " + Config.currency.value));
|
itemMeta.setLore(T2Creplace.replacePrice(prefix, player, Placeholder.replace(function.noPermLore, player), function.price + " " + ConfigValues.currency.value));
|
||||||
} else itemMeta.setLore(T2Creplace.replacePrice(prefix, player, Placeholder.replace(function.lore, player), function.price + " " + Config.currency.value));
|
} else itemMeta.setLore(T2Creplace.replacePrice(prefix, player, Placeholder.replace(function.lore, player), function.price + " " + ConfigValues.currency.value));
|
||||||
} else {
|
} else {
|
||||||
itemMeta.setDisplayName(T2Creplace.replace(prefix, Placeholder.replace(function.name, player)));
|
itemMeta.setDisplayName(T2Creplace.replace(prefix, Placeholder.replace(function.name, player)));
|
||||||
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
|
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
|
||||||
itemMeta.setLore(T2Creplace.replacePrice(prefix, Placeholder.replace(function.noPermLore, player), function.price + " " + Config.currency.value));
|
itemMeta.setLore(T2Creplace.replacePrice(prefix, Placeholder.replace(function.noPermLore, player), function.price + " " + ConfigValues.currency.value));
|
||||||
} else itemMeta.setLore(T2Creplace.replacePrice(prefix, Placeholder.replace(function.lore, player), function.price + " " + Config.currency.value));
|
} else itemMeta.setLore(T2Creplace.replacePrice(prefix, Placeholder.replace(function.lore, player), function.price + " " + ConfigValues.currency.value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void base64(String base64Value, SlotObject slot, Player player, Inventory inventory) {
|
protected static void base64(String base64Value, SlotObject slot, Player player, Inventory inventory) {
|
||||||
FunctionObject function = Main.functionHashMap.get(slot.function);
|
FunctionObject function = Cache.functionHashMap.get(slot.function);
|
||||||
ItemStack item = T2CitemVersion.getHeadIS();
|
ItemStack item = T2CitemVersion.getHeadIS();
|
||||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||||
setBase64(itemMeta, base64Value);
|
setBase64(itemMeta, base64Value);
|
||||||
@ -107,12 +108,12 @@ public class GuiBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected static void base64(SlotObject slot, Player player, Inventory inventory) {
|
protected static void base64(SlotObject slot, Player player, Inventory inventory) {
|
||||||
FunctionObject function = Main.functionHashMap.get(slot.function);
|
FunctionObject function = Cache.functionHashMap.get(slot.function);
|
||||||
base64(function.base64Value, slot, player, inventory);
|
base64(function.base64Value, slot, player, inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void playerHead(SlotObject slot, Player player, Inventory inventory, String skullName) {
|
protected static void playerHead(SlotObject slot, Player player, Inventory inventory, String skullName) {
|
||||||
FunctionObject function = Main.functionHashMap.get(slot.function);
|
FunctionObject function = Cache.functionHashMap.get(slot.function);
|
||||||
ItemStack item = T2CitemVersion.getHeadIS();
|
ItemStack item = T2CitemVersion.getHeadIS();
|
||||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||||
setDisplayNameAndLore(itemMeta, player, slot);
|
setDisplayNameAndLore(itemMeta, player, slot);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.function.gui;
|
package net.t2code.commandguiv2.Spigot.function.gui;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
||||||
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
|
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
@ -12,6 +12,7 @@ import net.t2code.commandguiv2.Spigot.sound.PlaySound;
|
|||||||
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import io.github.solyze.plugmangui.inventories.PluginListGUI;
|
import io.github.solyze.plugmangui.inventories.PluginListGUI;
|
||||||
|
import net.t2code.commandguiv2.cache.Cache;
|
||||||
import net.t2code.luckyBox.api.LuckyBoxAPI;
|
import net.t2code.luckyBox.api.LuckyBoxAPI;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
@ -29,7 +30,7 @@ public class OpenGUI {
|
|||||||
private static String prefix = Util.getPrefix();
|
private static String prefix = Util.getPrefix();
|
||||||
|
|
||||||
public static void openGUI(Player player, String guiString, Boolean sound) {
|
public static void openGUI(Player player, String guiString, Boolean sound) {
|
||||||
GuiObject gui = Main.guiHashMap.get(guiString);
|
GuiObject gui = Cache.guiHashMap.get(guiString);
|
||||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||||
switch (guiString) {
|
switch (guiString) {
|
||||||
//case "plugin.PlotSquaredGUI":
|
//case "plugin.PlotSquaredGUI":
|
||||||
@ -78,7 +79,7 @@ public class OpenGUI {
|
|||||||
}
|
}
|
||||||
for (SlotObject slot : gui.slots) {
|
for (SlotObject slot : gui.slots) {
|
||||||
try {
|
try {
|
||||||
FunctionObject function = Main.functionHashMap.get(slot.function);
|
FunctionObject function = Cache.functionHashMap.get(slot.function);
|
||||||
if (function == null) {
|
if (function == null) {
|
||||||
T2Csend.error(Main.getPlugin(), "The Function " + slot.function + " in the GUI " + gui.key + " does not exist!");
|
T2Csend.error(Main.getPlugin(), "The Function " + slot.function + " in the GUI " + gui.key + " does not exist!");
|
||||||
continue;
|
continue;
|
||||||
@ -136,14 +137,14 @@ public class OpenGUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void toggleOn(FunctionObject function, SlotObject slot, Player player, Inventory inventory) {
|
private static void toggleOn(FunctionObject function, SlotObject slot, Player player, Inventory inventory) {
|
||||||
if ((Boolean) Config.toggleItemOnOrYesBase64.value) {
|
if ((Boolean) ConfigValues.toggleItemOnOrYesBase64.value) {
|
||||||
GuiBuilder.base64(String.valueOf( Config.toggleItemOnOrYesBase64Value.value), slot, player, inventory);
|
GuiBuilder.base64(String.valueOf( ConfigValues.toggleItemOnOrYesBase64Value.value), slot, player, inventory);
|
||||||
} else GuiBuilder.item(String.valueOf(Config.toggleItemOnOrYesMaterial.value), slot, player, inventory);
|
} else GuiBuilder.item(String.valueOf(ConfigValues.toggleItemOnOrYesMaterial.value), slot, player, inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void toggleOff(FunctionObject function, SlotObject slot, Player player, Inventory inventory) {
|
private static void toggleOff(FunctionObject function, SlotObject slot, Player player, Inventory inventory) {
|
||||||
if ((Boolean) Config.toggleItemOffOrNoBase64.value) {
|
if ((Boolean) ConfigValues.toggleItemOffOrNoBase64.value) {
|
||||||
GuiBuilder.base64(String.valueOf( Config.toggleItemOffOrNoBase64Value.value), slot, player, inventory);
|
GuiBuilder.base64(String.valueOf( ConfigValues.toggleItemOffOrNoBase64Value.value), slot, player, inventory);
|
||||||
} else GuiBuilder.item(String.valueOf(Config.toggleItemOffOrNoMaterial.value), slot, player, inventory);
|
} else GuiBuilder.item(String.valueOf(ConfigValues.toggleItemOffOrNoMaterial.value), slot, player, inventory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package net.t2code.commandguiv2.Spigot.function.useItem;
|
|||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.function.gui.OpenGUI;
|
import net.t2code.commandguiv2.Spigot.function.gui.OpenGUI;
|
||||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
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()));
|
useItemHashMap.put(e.getPlayer().getName(), SelectDatabase.selectItemStatus(e.getPlayer()));
|
||||||
Integer i = SelectDatabase.selectSlot(e.getPlayer());
|
Integer i = SelectDatabase.selectSlot(e.getPlayer());
|
||||||
if (i == null) {
|
if (i == null) {
|
||||||
useItemSlotHashMap.put(e.getPlayer().getName(), (Integer) Config.useItemInventorySlot.value);
|
useItemSlotHashMap.put(e.getPlayer().getName(), (Integer) ConfigValues.useItemInventorySlot.value);
|
||||||
} else useItemSlotHashMap.put(e.getPlayer().getName(), i);
|
} else useItemSlotHashMap.put(e.getPlayer().getName(), i);
|
||||||
|
|
||||||
if (CGuiAPI.JoinDisable) {
|
if (CGuiAPI.JoinDisable) {
|
||||||
@ -73,7 +73,7 @@ public class Events implements Listener {
|
|||||||
while (var3.hasNext()) {
|
while (var3.hasNext()) {
|
||||||
ItemStack items = (ItemStack) var3.next();
|
ItemStack items = (ItemStack) var3.next();
|
||||||
if (items != null && items.hasItemMeta() && items.getItemMeta().hasDisplayName()
|
if (items != null && items.hasItemMeta() && items.getItemMeta().hasDisplayName()
|
||||||
&& items.getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
&& items.getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
e.getDrops().remove(items);
|
e.getDrops().remove(items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ public class Events implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onRespawn(PlayerRespawnEvent e) {
|
public void onRespawn(PlayerRespawnEvent e) {
|
||||||
Player player = e.getPlayer();
|
Player player = e.getPlayer();
|
||||||
if ((Boolean) Config.useItemEnable.value) {
|
if ((Boolean) ConfigValues.useItemEnable.value) {
|
||||||
ItemChange.itemChange(player, false);
|
ItemChange.itemChange(player, false);
|
||||||
//if (!Config.getUseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
//if (!Config.getUseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
||||||
// if (Config.getUseItem_GiveOnlyOnFirstJoin) {
|
// if (Config.getUseItem_GiveOnlyOnFirstJoin) {
|
||||||
@ -110,7 +110,7 @@ public class Events implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onGameModeChange(PlayerGameModeChangeEvent e) {
|
public void onGameModeChange(PlayerGameModeChangeEvent e) {
|
||||||
Player player = e.getPlayer();
|
Player player = e.getPlayer();
|
||||||
if (!(Boolean) Config.useItemGameModeChangeEnable.value) {
|
if (!(Boolean) ConfigValues.useItemGameModeChangeEnable.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@ -118,13 +118,13 @@ public class Events implements Listener {
|
|||||||
public void run() {
|
public void run() {
|
||||||
ItemChange.itemChange(player, false);
|
ItemChange.itemChange(player, false);
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.getPlugin(), (Integer) Config.useItemGameModeChangeDelayInTicks.value * 1L);
|
}.runTaskLater(Main.getPlugin(), (Integer) ConfigValues.useItemGameModeChangeDelayInTicks.value * 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onWorldChange(PlayerChangedWorldEvent e) {
|
public void onWorldChange(PlayerChangedWorldEvent e) {
|
||||||
Player player = e.getPlayer();
|
Player player = e.getPlayer();
|
||||||
if (!(Boolean) Config.useItemWorldChangeEnable.value) {
|
if (!(Boolean) ConfigValues.useItemWorldChangeEnable.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@ -132,30 +132,30 @@ public class Events implements Listener {
|
|||||||
public void run() {
|
public void run() {
|
||||||
ItemChange.itemChange(player, false);
|
ItemChange.itemChange(player, false);
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.getPlugin(), (Integer) Config.useItemWorldChangeDelayInTicks.value * 1L);
|
}.runTaskLater(Main.getPlugin(), (Integer) ConfigValues.useItemWorldChangeDelayInTicks.value * 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onInteract(PlayerInteractEvent e) {
|
public void onInteract(PlayerInteractEvent e) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
if (!p.isSneaking()) {
|
if (!p.isSneaking()) {
|
||||||
for (String material : (ArrayList<String>) Config.useItemItemBlockBlacklist.value) {
|
for (String material : (ArrayList<String>) ConfigValues.useItemItemBlockBlacklist.value) {
|
||||||
if (e.getClickedBlock() != null) {
|
if (e.getClickedBlock() != null) {
|
||||||
if (e.getClickedBlock().getType() == Material.valueOf(material)) return;
|
if (e.getClickedBlock().getType() == Material.valueOf(material)) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Boolean) Config.useItemEnable.value) {
|
if ((Boolean) ConfigValues.useItemEnable.value) {
|
||||||
if ((Boolean) Config.useItemPlayerHeadEnable.value) {
|
if ((Boolean) ConfigValues.useItemPlayerHeadEnable.value) {
|
||||||
if (e.getItem() != null && p.getItemInHand().getType() == T2CitemVersion.getHead()) {
|
if (e.getItem() != null && p.getItemInHand().getType() == T2CitemVersion.getHead()) {
|
||||||
if (e.getItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
if (e.getItem().getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
openGUI(e, p);
|
openGUI(e, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (e.getItem() != null && p.getItemInHand().getType() == Material.valueOf(String.valueOf(Config.useItemMaterial.value))) {
|
if (e.getItem() != null && p.getItemInHand().getType() == Material.valueOf(String.valueOf(ConfigValues.useItemMaterial.value))) {
|
||||||
if (e.getItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
if (e.getItem().getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
openGUI(e, p);
|
openGUI(e, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ public class Events implements Listener {
|
|||||||
private static void openGUI(PlayerInteractEvent e, Player player) {
|
private static void openGUI(PlayerInteractEvent e, Player player) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
|
||||||
if ((!(Boolean) Config.disableInfoBySneak.value) && player.isSneaking()) {
|
if ((!(Boolean) ConfigValues.disableInfoBySneak.value) && player.isSneaking()) {
|
||||||
Commands.info(player);
|
Commands.info(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -177,45 +177,45 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
if (UseItem.protection(player, true)) return;
|
if (UseItem.protection(player, true)) return;
|
||||||
|
|
||||||
if ((Boolean) Config.useItemGameModeProtection.value) {
|
if ((Boolean) ConfigValues.useItemGameModeProtection.value) {
|
||||||
if (String.valueOf(Config.useItemGameModeMode.value).equalsIgnoreCase("blacklist") && String.valueOf(Config.useItemGameModeList.value).contains(player.getGameMode().toString())) {
|
if (String.valueOf(ConfigValues.useItemGameModeMode.value).equalsIgnoreCase("blacklist") && String.valueOf(ConfigValues.useItemGameModeList.value).contains(player.getGameMode().toString())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (String.valueOf(Config.useItemGameModeMode.value).equalsIgnoreCase("whitelist") && !String.valueOf(Config.useItemGameModeList.value).contains(player.getGameMode().toString())) {
|
if (String.valueOf(ConfigValues.useItemGameModeMode.value).equalsIgnoreCase("whitelist") && !String.valueOf(ConfigValues.useItemGameModeList.value).contains(player.getGameMode().toString())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Boolean) Config.useItemWorldProtection.value) {
|
if ((Boolean) ConfigValues.useItemWorldProtection.value) {
|
||||||
if (String.valueOf(Config.useItemWorldMode.value).equalsIgnoreCase("blacklist") && String.valueOf(Config.useItemWorldList.value).contains(player.getWorld().getName())) {
|
if (String.valueOf(ConfigValues.useItemWorldMode.value).equalsIgnoreCase("blacklist") && String.valueOf(ConfigValues.useItemWorldList.value).contains(player.getWorld().getName())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (String.valueOf(Config.useItemWorldMode.value).equalsIgnoreCase("whitelist") && !String.valueOf(Config.useItemWorldList.value).contains(player.getWorld().getName())) {
|
if (String.valueOf(ConfigValues.useItemWorldMode.value).equalsIgnoreCase("whitelist") && !String.valueOf(ConfigValues.useItemWorldList.value).contains(player.getWorld().getName())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(Boolean) Config.useItemPermission.value || player.hasPermission("commandgui.useitem")) {
|
if (!(Boolean) ConfigValues.useItemPermission.value || player.hasPermission("commandgui.useitem")) {
|
||||||
OpenGUI.openGUI(player, String.valueOf(Config.useItemOpenGUI.value), true);
|
OpenGUI.openGUI(player, String.valueOf(ConfigValues.useItemOpenGUI.value), true);
|
||||||
} else {
|
} else {
|
||||||
T2Csend.player(player, SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
|
T2Csend.player(player, SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
|
||||||
.replace("[gui]", String.valueOf(Config.useItemOpenGUI.value)));
|
.replace("[gui]", String.valueOf(ConfigValues.useItemOpenGUI.value)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onItemMoveEvent(InventoryMoveItemEvent e) {
|
public void onItemMoveEvent(InventoryMoveItemEvent e) {
|
||||||
if (!(Boolean) Config.useItemBlockMoveAndDrop.value || !(Boolean) Config.useItemEnable.value) return;
|
if (!(Boolean) ConfigValues.useItemBlockMoveAndDrop.value || !(Boolean) ConfigValues.useItemEnable.value) return;
|
||||||
if (e.getItem() != null && e.getItem().hasItemMeta() && e.getItem().getItemMeta().hasDisplayName()
|
if (e.getItem() != null && e.getItem().hasItemMeta() && e.getItem().getItemMeta().hasDisplayName()
|
||||||
&& e.getItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
&& e.getItem().getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,19 +223,19 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onItemMove(InventoryDragEvent e) {
|
public void onItemMove(InventoryDragEvent e) {
|
||||||
if (!(Boolean) Config.useItemBlockMoveAndDrop.value || !(Boolean) Config.useItemEnable.value) return;
|
if (!(Boolean) ConfigValues.useItemBlockMoveAndDrop.value || !(Boolean) ConfigValues.useItemEnable.value) return;
|
||||||
|
|
||||||
if (e.getWhoClicked() instanceof Player) {
|
if (e.getWhoClicked() instanceof Player) {
|
||||||
Player p = (Player) e.getWhoClicked();
|
Player p = (Player) e.getWhoClicked();
|
||||||
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
||||||
&& e.getCursor().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
&& e.getCursor().getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
ItemChange.itemChange(p, false);
|
ItemChange.itemChange(p, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.getOldCursor() != null && e.getOldCursor().hasItemMeta() && e.getOldCursor().getItemMeta().hasDisplayName()
|
if (e.getOldCursor() != null && e.getOldCursor().hasItemMeta() && e.getOldCursor().getItemMeta().hasDisplayName()
|
||||||
&& e.getOldCursor().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
&& e.getOldCursor().getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
ItemChange.itemChange(p, false);
|
ItemChange.itemChange(p, false);
|
||||||
@ -245,14 +245,14 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onItemMove(InventoryClickEvent e) {
|
public void onItemMove(InventoryClickEvent e) {
|
||||||
if (!(Boolean) Config.useItemBlockMoveAndDrop.value || !(Boolean) Config.useItemEnable.value) return;
|
if (!(Boolean) ConfigValues.useItemBlockMoveAndDrop.value || !(Boolean) ConfigValues.useItemEnable.value) return;
|
||||||
|
|
||||||
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
||||||
&& e.getCursor().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
&& e.getCursor().getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
if (e.getCurrentItem() != null && e.getCurrentItem().hasItemMeta() && e.getCurrentItem().getItemMeta().hasDisplayName()
|
if (e.getCurrentItem() != null && e.getCurrentItem().hasItemMeta() && e.getCurrentItem().getItemMeta().hasDisplayName()
|
||||||
&& e.getCurrentItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
&& e.getCurrentItem().getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
|
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -260,12 +260,12 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onItemMove(InventoryPickupItemEvent e) {
|
public void onItemMove(InventoryPickupItemEvent e) {
|
||||||
if (!(Boolean) Config.useItemBlockMoveAndDrop.value || !(Boolean) Config.useItemEnable.value) return;
|
if (!(Boolean) ConfigValues.useItemBlockMoveAndDrop.value || !(Boolean) ConfigValues.useItemEnable.value) return;
|
||||||
|
|
||||||
if (e.getItem() != null && e.getItem().getItemStack() != null) {
|
if (e.getItem() != null && e.getItem().getItemStack() != null) {
|
||||||
ItemStack item = e.getItem().getItemStack();
|
ItemStack item = e.getItem().getItemStack();
|
||||||
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||||
&& item.getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
&& item.getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -273,21 +273,21 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlace(BlockPlaceEvent e) {
|
public void onPlace(BlockPlaceEvent e) {
|
||||||
if (!(Boolean) Config.useItemBlockMoveAndDrop.value || !(Boolean) Config.useItemEnable.value) return;
|
if (!(Boolean) ConfigValues.useItemBlockMoveAndDrop.value || !(Boolean) ConfigValues.useItemEnable.value) return;
|
||||||
if (e.getItemInHand() != null && e.getItemInHand().hasItemMeta() && e.getItemInHand().getItemMeta().hasDisplayName()
|
if (e.getItemInHand() != null && e.getItemInHand().hasItemMeta() && e.getItemInHand().getItemMeta().hasDisplayName()
|
||||||
&& e.getItemInHand().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
&& e.getItemInHand().getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onDrop(PlayerDropItemEvent e) {
|
public void onDrop(PlayerDropItemEvent e) {
|
||||||
if (!(Boolean) Config.useItemBlockMoveAndDrop.value || !(Boolean) Config.useItemEnable.value) return;
|
if (!(Boolean) ConfigValues.useItemBlockMoveAndDrop.value || !(Boolean) ConfigValues.useItemEnable.value) return;
|
||||||
|
|
||||||
if (e.getItemDrop() != null && e.getItemDrop().getItemStack() != null) {
|
if (e.getItemDrop() != null && e.getItemDrop().getItemStack() != null) {
|
||||||
ItemStack item = e.getItemDrop().getItemStack();
|
ItemStack item = e.getItemDrop().getItemStack();
|
||||||
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||||
&& item.getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
&& item.getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onClearServer(ServerCommandEvent event) {
|
public void onClearServer(ServerCommandEvent event) {
|
||||||
if ((Boolean) Config.useItemKeepAtCommandClear.value) {
|
if ((Boolean) ConfigValues.useItemKeepAtCommandClear.value) {
|
||||||
if (event.getCommand().contains("clear " + event.getCommand().replace("/", "").replace("clear ", ""))) {
|
if (event.getCommand().contains("clear " + event.getCommand().replace("/", "").replace("clear ", ""))) {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -323,7 +323,7 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onClearPlayer(PlayerCommandPreprocessEvent event) {
|
public void onClearPlayer(PlayerCommandPreprocessEvent event) {
|
||||||
if ((Boolean) Config.useItemKeepAtCommandClear.value) {
|
if ((Boolean) ConfigValues.useItemKeepAtCommandClear.value) {
|
||||||
if (event.getMessage().toLowerCase().contains("clear")) {
|
if (event.getMessage().toLowerCase().contains("clear")) {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.function.useItem;
|
package net.t2code.commandguiv2.Spigot.function.useItem;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -11,27 +11,27 @@ public class EventsFrom110 implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onHandSwap(PlayerSwapHandItemsEvent e) {
|
public void onHandSwap(PlayerSwapHandItemsEvent e) {
|
||||||
if (!(Boolean) Config.useItemBlockMoveAndDrop.value || !(Boolean) Config.useItemEnable.value) return;
|
if (!(Boolean) ConfigValues.useItemBlockMoveAndDrop.value || !(Boolean) ConfigValues.useItemEnable.value) return;
|
||||||
if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
|
if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
|
||||||
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
}
|
}
|
||||||
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
|
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
|
||||||
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onItemMove(PlayerSwapHandItemsEvent e) {
|
public void onItemMove(PlayerSwapHandItemsEvent e) {
|
||||||
if (!(Boolean)Config.useItemBlockMoveAndDrop.value || !(Boolean)Config.useItemEnable.value) return;
|
if (!(Boolean) ConfigValues.useItemBlockMoveAndDrop.value || !(Boolean) ConfigValues.useItemEnable.value) return;
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
|
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
|
||||||
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
|
if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
|
||||||
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.function.useItem;
|
package net.t2code.commandguiv2.Spigot.function.useItem;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CLibConfig;
|
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CLibConfig;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class ItemChange {
|
public class ItemChange {
|
||||||
public static void itemChange(Player player, Boolean setCursor) {
|
public static void itemChange(Player player, Boolean setCursor) {
|
||||||
T2Csend.debug(Main.getPlugin(), "Join: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "Join: " + player.getName());
|
||||||
Integer slot;
|
Integer slot;
|
||||||
if ((Boolean) Config.useItemInventorySlotEnforce.value) {
|
if ((Boolean) ConfigValues.useItemInventorySlotEnforce.value) {
|
||||||
slot =(Integer) Config.useItemInventorySlot.value;
|
slot = (Integer) ConfigValues.useItemInventorySlot.value;
|
||||||
} else {
|
} else {
|
||||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||||
}
|
}
|
||||||
T2Csend.debug(Main.getPlugin(), "Slot " + slot + " for player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "Slot " + slot + " for player: " + player.getName());
|
||||||
|
|
||||||
if (!(Boolean)Config.useItemEnable.value) {
|
if (!(Boolean) ConfigValues.useItemEnable.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UseItem.removeItem(player);
|
UseItem.removeItem(player);
|
||||||
if (UseItem.protection(player, false)) return;
|
if (UseItem.protection(player, false)) return;
|
||||||
if ((Boolean)Config.useItemGiveOnlyOnFirstJoin.value) {
|
if ((Boolean) ConfigValues.useItemGiveOnlyOnFirstJoin.value) {
|
||||||
T2Csend.debug(Main.getPlugin(), "OnlyOnFirstJoin: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "OnlyOnFirstJoin: " + player.getName());
|
||||||
if (!(Boolean)Config.useItemAllowToggle.value || Events.useItemHashMap.get(player.getName())) {
|
if (!(Boolean) ConfigValues.useItemAllowToggle.value || Events.useItemHashMap.get(player.getName())) {
|
||||||
if (!player.hasPlayedBefore()) {
|
if (!player.hasPlayedBefore()) {
|
||||||
new BukkitRunnable() {
|
Bukkit.getScheduler().runTaskLaterAsynchronously(Main.getPlugin(), new Runnable() { //todo testen
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
UseItem.giveUseItem(player);
|
UseItem.giveUseItem(player);
|
||||||
@ -35,8 +35,8 @@ public class ItemChange {
|
|||||||
setCursor(player, slot);
|
setCursor(player, slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.getPlugin(), 1L * 1);
|
},1L);
|
||||||
if ((Boolean)Config.cursorToGUIItemOnlyOnFirstLogin.value ||(Boolean) Config.cursorToGUIItemOnLogin.value) {
|
if ((Boolean) ConfigValues.cursorToGUIItemOnlyOnFirstLogin.value || (Boolean) ConfigValues.cursorToGUIItemOnLogin.value) {
|
||||||
player.getInventory().setHeldItemSlot(slot - 1);
|
player.getInventory().setHeldItemSlot(slot - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,23 +44,24 @@ public class ItemChange {
|
|||||||
T2Csend.debug(Main.getPlugin(), "GiveOnlyOnFirstJoin: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "GiveOnlyOnFirstJoin: " + player.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(Boolean)Config.useItemGiveOnEveryJoin.value) {
|
if (!(Boolean) ConfigValues.useItemGiveOnEveryJoin.value) {
|
||||||
T2Csend.debug(Main.getPlugin(), "!GiveOnEveryJoin: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "!GiveOnEveryJoin: " + player.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new BukkitRunnable() {
|
|
||||||
|
Bukkit.getScheduler().runTaskLaterAsynchronously(Main.getPlugin(), new Runnable() { //todo testen
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Boolean pln = Events.useItemHashMap.get(player.getName());
|
Boolean pln = Events.useItemHashMap.get(player.getName());
|
||||||
if (pln == null) return;
|
if (pln == null) return;
|
||||||
if (!(Boolean)Config.useItemAllowToggle.value || pln) {
|
if (!(Boolean) ConfigValues.useItemAllowToggle.value || pln) {
|
||||||
if ((Boolean)Config.useItemInventorySlotEnforce.value || player.getInventory().getItem(slot - 1) == null) {
|
if ((Boolean) ConfigValues.useItemInventorySlotEnforce.value || player.getInventory().getItem(slot - 1) == null) {
|
||||||
T2Csend.debug(Main.getPlugin(), "Give: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "Give: " + player.getName());
|
||||||
UseItem.giveUseItem(player);
|
UseItem.giveUseItem(player);
|
||||||
if (setCursor) {
|
if (setCursor) {
|
||||||
setCursor(player, slot);
|
setCursor(player, slot);
|
||||||
}
|
}
|
||||||
} else if ((Boolean)Config.useItemInventorySlotFreeSlot.value) {
|
} else if ((Boolean) ConfigValues.useItemInventorySlotFreeSlot.value) {
|
||||||
boolean empty = false;
|
boolean empty = false;
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < 9; i++) {
|
||||||
if (player.getInventory().getItem(i) == null) {
|
if (player.getInventory().getItem(i) == null) {
|
||||||
@ -71,20 +72,20 @@ public class ItemChange {
|
|||||||
if (empty) {
|
if (empty) {
|
||||||
UseItem.addUseItem(player);
|
UseItem.addUseItem(player);
|
||||||
}
|
}
|
||||||
}else T2Csend.debug(Main.getPlugin(), "give skip [1]: " + player.getName());
|
} else T2Csend.debug(Main.getPlugin(), "give skip [1]: " + player.getName());
|
||||||
} else T2Csend.debug(Main.getPlugin(), "give skip [2]: " + player.getName());
|
} else T2Csend.debug(Main.getPlugin(), "give skip [2]: " + player.getName());
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.getPlugin(), 1L * 1);
|
}, 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setCursor(Player player, int slot) {
|
private static void setCursor(Player player, int slot) {
|
||||||
T2Csend.debug(Main.getPlugin(), "setCursor 1 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 1 Player: " + player.getName());
|
||||||
|
|
||||||
if (!(Boolean)Config.cursorToGUIItemOnLogin.value) {
|
if (!(Boolean) ConfigValues.cursorToGUIItemOnLogin.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
T2Csend.debug(Main.getPlugin(), "setCursor 2 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 2 Player: " + player.getName());
|
||||||
if ((Boolean)Config.cursorToGUIItemOnlyOnFirstLogin.value) {
|
if ((Boolean) ConfigValues.cursorToGUIItemOnlyOnFirstLogin.value) {
|
||||||
if (!player.hasPlayedBefore()) {
|
if (!player.hasPlayedBefore()) {
|
||||||
player.getInventory().setHeldItemSlot(slot - 1);
|
player.getInventory().setHeldItemSlot(slot - 1);
|
||||||
T2Csend.debug(Main.getPlugin(), "setCursor 3 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 3 Player: " + player.getName());
|
||||||
@ -98,7 +99,7 @@ public class ItemChange {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
T2Csend.debug(Main.getPlugin(), "setCursor 6 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 6 Player: " + player.getName());
|
||||||
if ((Boolean)Config.useItemServerChange.value) {
|
if ((Boolean) ConfigValues.useItemServerChange.value) {
|
||||||
player.getInventory().setHeldItemSlot(slot - 1);
|
player.getInventory().setHeldItemSlot(slot - 1);
|
||||||
T2Csend.debug(Main.getPlugin(), "setCursor 7 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 7 Player: " + player.getName());
|
||||||
return;
|
return;
|
||||||
|
@ -3,7 +3,7 @@ package net.t2code.commandguiv2.Spigot.function.useItem;
|
|||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||||
@ -24,12 +24,12 @@ public class UseItem {
|
|||||||
public static void giveUseItem(Player player) {
|
public static void giveUseItem(Player player) {
|
||||||
Integer slot;
|
Integer slot;
|
||||||
if (protection(player, false)) return;
|
if (protection(player, false)) return;
|
||||||
if ((Boolean) Config.useItemInventorySlotEnforce.value) {
|
if ((Boolean) ConfigValues.useItemInventorySlotEnforce.value) {
|
||||||
slot = (Integer) Config.useItemInventorySlot.value;
|
slot = (Integer) ConfigValues.useItemInventorySlot.value;
|
||||||
} else {
|
} else {
|
||||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||||
}
|
}
|
||||||
if ((Boolean) Config.useItemInventorySlotFreeSlot.value) {
|
if ((Boolean) ConfigValues.useItemInventorySlotFreeSlot.value) {
|
||||||
player.getInventory().addItem(itemStack(player));
|
player.getInventory().addItem(itemStack(player));
|
||||||
} else {
|
} else {
|
||||||
T2Csend.debug(Main.getPlugin(), "setUseItem: " + player.getName() + " Slot: " + Integer.parseInt(String.valueOf(slot - 1)));
|
T2Csend.debug(Main.getPlugin(), "setUseItem: " + player.getName() + " Slot: " + Integer.parseInt(String.valueOf(slot - 1)));
|
||||||
@ -39,27 +39,27 @@ public class UseItem {
|
|||||||
|
|
||||||
public static void addUseItem(Player player) {
|
public static void addUseItem(Player player) {
|
||||||
if (protection(player, false)) return;
|
if (protection(player, false)) return;
|
||||||
if ((Boolean) Config.useItemInventorySlotFreeSlot.value) {
|
if ((Boolean) ConfigValues.useItemInventorySlotFreeSlot.value) {
|
||||||
player.getInventory().addItem(itemStack(player));
|
player.getInventory().addItem(itemStack(player));
|
||||||
} else player.getInventory().addItem(itemStack(player));
|
} else player.getInventory().addItem(itemStack(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ItemStack itemStack(Player player) {
|
private static ItemStack itemStack(Player player) {
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
if ((Boolean) Config.useItemPlayerHeadEnable.value) {
|
if ((Boolean) ConfigValues.useItemPlayerHeadEnable.value) {
|
||||||
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
T2Csend.player(player, Util.getPrefix() + "§c Playerheads for UseItem are only available from version §61.13§c!");
|
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!");
|
T2Csend.error(Main.getPlugin(), "Playerheads for UseItem are only available from version 1.13!");
|
||||||
} else {
|
} else {
|
||||||
item = T2CitemVersion.getHeadIS();
|
item = T2CitemVersion.getHeadIS();
|
||||||
SkullMeta playerheadmeta = (SkullMeta) item.getItemMeta();
|
SkullMeta playerheadmeta = (SkullMeta) item.getItemMeta();
|
||||||
playerheadmeta.setDisplayName(String.valueOf(Config.useItemName.value));
|
playerheadmeta.setDisplayName(String.valueOf(ConfigValues.useItemName.value));
|
||||||
if ((Boolean) Config.useItemBase64Enable.value) {
|
if ((Boolean) ConfigValues.useItemBase64Enable.value) {
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, (ArrayList<String>) Config.useItemLore.value));
|
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, (ArrayList<String>) ConfigValues.useItemLore.value));
|
||||||
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), (ArrayList<String>) Config.useItemLore.value));
|
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), (ArrayList<String>) ConfigValues.useItemLore.value));
|
||||||
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
|
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
|
||||||
profile.getProperties().put("textures", new Property("textures", String.valueOf(Config.useItemBase64value.value)));
|
profile.getProperties().put("textures", new Property("textures", String.valueOf(ConfigValues.useItemBase64value.value)));
|
||||||
Field profileField = null;
|
Field profileField = null;
|
||||||
try {
|
try {
|
||||||
profileField = playerheadmeta.getClass().getDeclaredField("profile");
|
profileField = playerheadmeta.getClass().getDeclaredField("profile");
|
||||||
@ -70,23 +70,23 @@ public class UseItem {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String p;
|
String p;
|
||||||
if ((Boolean) Config.useItemPlayerWhoHasOpenedTheGUI.value) {
|
if ((Boolean) ConfigValues.useItemPlayerWhoHasOpenedTheGUI.value) {
|
||||||
p = player.getName();
|
p = player.getName();
|
||||||
} else p = String.valueOf(Config.useItemPlayerName.value);
|
} else p = String.valueOf(ConfigValues.useItemPlayerName.value);
|
||||||
playerheadmeta.setOwner(p);
|
playerheadmeta.setOwner(p);
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, (ArrayList<String>) Config.useItemLore.value));
|
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, (ArrayList<String>) ConfigValues.useItemLore.value));
|
||||||
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), (ArrayList<String>) Config.useItemLore.value));
|
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), (ArrayList<String>) ConfigValues.useItemLore.value));
|
||||||
}
|
}
|
||||||
item.setItemMeta(playerheadmeta);
|
item.setItemMeta(playerheadmeta);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
item = new ItemStack(Material.valueOf(String.valueOf(Config.useItemMaterial.value)));
|
item = new ItemStack(Material.valueOf(String.valueOf(ConfigValues.useItemMaterial.value)));
|
||||||
ItemMeta itemMeta = item.getItemMeta();
|
ItemMeta itemMeta = item.getItemMeta();
|
||||||
itemMeta.setDisplayName(String.valueOf(Config.useItemName.value));
|
itemMeta.setDisplayName(String.valueOf(ConfigValues.useItemName.value));
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), player, (ArrayList<String>) Config.useItemLore.value));
|
itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), player, (ArrayList<String>) ConfigValues.useItemLore.value));
|
||||||
} else itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), (ArrayList<String>) Config.useItemLore.value));
|
} else itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), (ArrayList<String>) ConfigValues.useItemLore.value));
|
||||||
item.setItemMeta(itemMeta);
|
item.setItemMeta(itemMeta);
|
||||||
item.setAmount(1);
|
item.setAmount(1);
|
||||||
}
|
}
|
||||||
@ -94,31 +94,31 @@ public class UseItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean protection(Player player, Boolean interact) {
|
public static boolean protection(Player player, Boolean interact) {
|
||||||
if ((Boolean) Config.useItemGameModeProtection.value) {
|
if ((Boolean) ConfigValues.useItemGameModeProtection.value) {
|
||||||
if (String.valueOf(Config.useItemGameModeMode.value).equalsIgnoreCase("blacklist") && String.valueOf(Config.useItemGameModeList.value).contains(player.getGameMode().toString())) {
|
if (String.valueOf(ConfigValues.useItemGameModeMode.value).equalsIgnoreCase("blacklist") && String.valueOf(ConfigValues.useItemGameModeList.value).contains(player.getGameMode().toString())) {
|
||||||
if (interact) {
|
if (interact) {
|
||||||
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||||
} else if (!(Boolean) Config.useItemGameModeRemoveItemWhenItIsDisabled.value) removeItem(player);
|
} else if (!(Boolean) ConfigValues.useItemGameModeRemoveItemWhenItIsDisabled.value) removeItem(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (String.valueOf(Config.useItemGameModeMode.value).equalsIgnoreCase("whitelist") && !String.valueOf(Config.useItemGameModeList.value).contains(player.getGameMode().toString())) {
|
if (String.valueOf(ConfigValues.useItemGameModeMode.value).equalsIgnoreCase("whitelist") && !String.valueOf(ConfigValues.useItemGameModeList.value).contains(player.getGameMode().toString())) {
|
||||||
if (interact) {
|
if (interact) {
|
||||||
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||||
} else if (!(Boolean) Config.useItemGameModeRemoveItemWhenItIsDisabled.value) removeItem(player);
|
} else if (!(Boolean) ConfigValues.useItemGameModeRemoveItemWhenItIsDisabled.value) removeItem(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((Boolean) Config.useItemWorldProtection.value) {
|
if ((Boolean) ConfigValues.useItemWorldProtection.value) {
|
||||||
if (String.valueOf(Config.useItemWorldMode.value).equalsIgnoreCase("blacklist") && String.valueOf(Config.useItemWorldList.value).contains(player.getWorld().getName())) {
|
if (String.valueOf(ConfigValues.useItemWorldMode.value).equalsIgnoreCase("blacklist") && String.valueOf(ConfigValues.useItemWorldList.value).contains(player.getWorld().getName())) {
|
||||||
if (interact) {
|
if (interact) {
|
||||||
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||||
} else if (!(Boolean) Config.useItemWorldRemoveItemWhenItIsDisabled.value) removeItem(player);
|
} else if (!(Boolean) ConfigValues.useItemWorldRemoveItemWhenItIsDisabled.value) removeItem(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (String.valueOf(Config.useItemWorldMode.value).equalsIgnoreCase("whitelist") && !String.valueOf(Config.useItemWorldList.value).contains(player.getWorld().getName())) {
|
if (String.valueOf(ConfigValues.useItemWorldMode.value).equalsIgnoreCase("whitelist") && !String.valueOf(ConfigValues.useItemWorldList.value).contains(player.getWorld().getName())) {
|
||||||
if (interact) {
|
if (interact) {
|
||||||
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||||
} else if (!(Boolean) Config.useItemWorldRemoveItemWhenItIsDisabled.value) removeItem(player);
|
} else if (!(Boolean) ConfigValues.useItemWorldRemoveItemWhenItIsDisabled.value) removeItem(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,8 +130,8 @@ public class UseItem {
|
|||||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||||
ItemStack itm = player.getInventory().getItem(iam);
|
ItemStack itm = player.getInventory().getItem(iam);
|
||||||
if (itm != null) {
|
if (itm != null) {
|
||||||
if (itm.getType() == Material.valueOf(String.valueOf(Config.useItemMaterial.value)) || itm.getType() == T2CitemVersion.getHead()) {
|
if (itm.getType() == Material.valueOf(String.valueOf(ConfigValues.useItemMaterial.value)) || itm.getType() == T2CitemVersion.getHead()) {
|
||||||
if (itm.getItemMeta().getDisplayName().equals(Config.useItemName.value)) {
|
if (itm.getItemMeta().getDisplayName().equals(ConfigValues.useItemName.value)) {
|
||||||
player.getInventory().remove(itm);
|
player.getInventory().remove(itm);
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
break;
|
break;
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package net.t2code.commandguiv2.Spigot.objects.player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class PlayerObject {
|
||||||
|
public ArrayList<UseItemPlayerObject> useItems;
|
||||||
|
|
||||||
|
public PlayerObject(ArrayList<UseItemPlayerObject> useItems) {
|
||||||
|
this.useItems = useItems;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package net.t2code.commandguiv2.Spigot.objects.player;
|
||||||
|
|
||||||
|
public class UseItemPlayerObject {
|
||||||
|
public String key;
|
||||||
|
public Boolean enable;
|
||||||
|
public Integer slot;
|
||||||
|
|
||||||
|
public UseItemPlayerObject(String key, Boolean enable, Integer slot) {
|
||||||
|
this.key = key;
|
||||||
|
this.enable = enable;
|
||||||
|
this.slot = slot;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.sound;
|
package net.t2code.commandguiv2.Spigot.sound;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
||||||
@ -18,16 +18,16 @@ public class PlaySound {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void play(Player player, SoundEnum soundEnum, FunctionObject function, SlotObject slot, GuiObject gui) {
|
public static void play(Player player, SoundEnum soundEnum, FunctionObject function, SlotObject slot, GuiObject gui) {
|
||||||
if (!(Boolean) Config.soundEnable.value) return;
|
if (!(Boolean) ConfigValues.soundEnable.value) return;
|
||||||
switch (soundEnum) {
|
switch (soundEnum) {
|
||||||
case OpenInventory:
|
case OpenInventory:
|
||||||
if (!(Boolean) Config.soundOpenInventoryEnable.value) return;
|
if (!(Boolean) ConfigValues.soundOpenInventoryEnable.value) return;
|
||||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundOpenInventoryInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(ConfigValues.soundOpenInventoryInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
||||||
break;
|
break;
|
||||||
case Click:
|
case Click:
|
||||||
if (!(Boolean) Config.soundClickEnable.value) return;
|
if (!(Boolean) ConfigValues.soundClickEnable.value) return;
|
||||||
if (!function.customSound_Enable) {
|
if (!function.customSound_Enable) {
|
||||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundClickInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(ConfigValues.soundClickInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,24 +37,24 @@ public class PlaySound {
|
|||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
|
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
|
||||||
.replace("[sound]", "§6GUI: §e" + gui.key + " §6Function: §e" + function.key + "§r §6Slot: §e" + (slot.slot + 1) + " §6CustomSound: §9" + function.customSound_Sound));
|
.replace("[sound]", "§6GUI: §e" + gui.key + " §6Function: §e" + function.key + "§r §6Slot: §e" + (slot.slot + 1) + " §6CustomSound: §9" + function.customSound_Sound));
|
||||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundClickInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(ConfigValues.soundClickInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NoMoney:
|
case NoMoney:
|
||||||
if (!(Boolean) Config.soundNoMoneyEnable.value) return;
|
if (!(Boolean) ConfigValues.soundNoMoneyEnable.value) return;
|
||||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundNoMoneyInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(ConfigValues.soundNoMoneyInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
||||||
break;
|
break;
|
||||||
case NoInventorySpace:
|
case NoInventorySpace:
|
||||||
if (!(Boolean) Config.soundNoInventorySpaceEnable.value) return;
|
if (!(Boolean) ConfigValues.soundNoInventorySpaceEnable.value) return;
|
||||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundNoInventorySpaceInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(ConfigValues.soundNoInventorySpaceInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
||||||
break;
|
break;
|
||||||
case Give:
|
case Give:
|
||||||
if (!(Boolean) Config.soundGiveEnable.value) return;
|
if (!(Boolean) ConfigValues.soundGiveEnable.value) return;
|
||||||
player.playSound(player.getLocation(),org.bukkit.Sound.valueOf(String.valueOf( Config.soundGiveInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
player.playSound(player.getLocation(),org.bukkit.Sound.valueOf(String.valueOf( ConfigValues.soundGiveInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
||||||
break;
|
break;
|
||||||
case PlayerNotFound:
|
case PlayerNotFound:
|
||||||
if (!(Boolean) Config.soundPlayerNotFoundEnable.value) return;
|
if (!(Boolean) ConfigValues.soundPlayerNotFoundEnable.value) return;
|
||||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(Config.soundPlayerNotFoundInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(ConfigValues.soundPlayerNotFoundInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.system;
|
package net.t2code.commandguiv2.Spigot.system;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.ConfigSelect;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigSelect;
|
||||||
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterV5;
|
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterV5;
|
||||||
import net.t2code.commandguiv2.Spigot.config.functions.SelectFunctions;
|
import net.t2code.commandguiv2.Spigot.config.functions.SelectFunctions;
|
||||||
@ -129,12 +129,12 @@ public class Load {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Config.sound();
|
ConfigValues.sound();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
CmdExecuter_GUI.arg1.put(String.valueOf(Config.adminSubCommand.value), Permissions.admin + ";" + Permissions.giveItemOther + ";" + Permissions.info);
|
CmdExecuter_GUI.arg1.put(String.valueOf(ConfigValues.adminSubCommand.value), Permissions.admin + ";" + Permissions.giveItemOther + ";" + Permissions.info);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ public class Load {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Boolean) Config.helpAlias.value) {
|
if ((Boolean) ConfigValues.helpAlias.value) {
|
||||||
Main.getPlugin().getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
|
Main.getPlugin().getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
|
||||||
T2Csend.debug(plugin, "CommandRegister: commandguihelp");
|
T2Csend.debug(plugin, "CommandRegister: commandguihelp");
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ public class Load {
|
|||||||
}
|
}
|
||||||
|
|
||||||
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), spigotID, discord
|
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), spigotID, discord
|
||||||
, (Boolean) Config.updateCheckOnJoin.value, (Boolean) Config.updateCheckSeePreReleaseUpdates.value, (Integer) Config.updateCheckTimeInterval.value);
|
, (Boolean) ConfigValues.updateCheckOnJoin.value, (Boolean) ConfigValues.updateCheckSeePreReleaseUpdates.value, (Integer) ConfigValues.updateCheckTimeInterval.value);
|
||||||
Metrics.Bstats();
|
Metrics.Bstats();
|
||||||
Main.addonLoad();
|
Main.addonLoad();
|
||||||
T2Ctemplate.onLoadFooter(prefix, long_);
|
T2Ctemplate.onLoadFooter(prefix, long_);
|
||||||
@ -188,9 +188,9 @@ public class Load {
|
|||||||
|
|
||||||
private static void loadStorage(String prefix) {
|
private static void loadStorage(String prefix) {
|
||||||
try {
|
try {
|
||||||
SelectDatabase.setStorage(StorageEnum.valueOf(String.valueOf(Config.storage.value)));
|
SelectDatabase.setStorage(StorageEnum.valueOf(String.valueOf(ConfigValues.storage.value)));
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
T2Csend.error(plugin, "The storage medium '" + Config.storage.value + "' is not supported!");
|
T2Csend.error(plugin, "The storage medium '" + ConfigValues.storage.value + "' is not supported!");
|
||||||
T2Csend.error(plugin, "Storage medium " + StorageEnum.SQLITE + " is used.");
|
T2Csend.error(plugin, "Storage medium " + StorageEnum.SQLITE + " is used.");
|
||||||
SelectDatabase.setStorage(StorageEnum.SQLITE);
|
SelectDatabase.setStorage(StorageEnum.SQLITE);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package net.t2code.commandguiv2.Spigot.system;
|
|||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
|
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
|
||||||
|
import net.t2code.commandguiv2.cache.Cache;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
|
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
|
||||||
import org.bukkit.permissions.PermissionDefault;
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -66,7 +67,7 @@ public class Permissions {
|
|||||||
T2Cregister.permissionDescription(admin, "All permissions from T2C-CommandGUI", plugin);
|
T2Cregister.permissionDescription(admin, "All permissions from T2C-CommandGUI", plugin);
|
||||||
|
|
||||||
|
|
||||||
for (GuiObject gui : Main.guiHashMap.values()) {
|
for (GuiObject gui : Cache.guiHashMap.values()) {
|
||||||
T2Cregister.permission(command + "." + gui.key, op, plugin);
|
T2Cregister.permission(command + "." + gui.key, op, plugin);
|
||||||
T2Cregister.permission(admin, op, command + "." + gui.key, true, plugin);
|
T2Cregister.permission(admin, op, command + "." + gui.key, true, plugin);
|
||||||
for (SlotObject slot : gui.slots) {
|
for (SlotObject slot : gui.slots) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.system;
|
package net.t2code.commandguiv2.Spigot.system;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
|
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -10,8 +10,8 @@ import java.util.List;
|
|||||||
public class Placeholder {
|
public class Placeholder {
|
||||||
public static String useitem(Player p) {
|
public static String useitem(Player p) {
|
||||||
if (Events.useItemHashMap.get(p.getName())) {
|
if (Events.useItemHashMap.get(p.getName())) {
|
||||||
return Config.placeholderTrue.name();
|
return ConfigValues.placeholderTrue.name();
|
||||||
} else return Config.placeholderFalse.name();
|
} else return ConfigValues.placeholderFalse.name();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String useitem_boolean(Player p) {
|
public static String useitem_boolean(Player p) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.api;
|
package net.t2code.commandguiv2.api;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
||||||
import net.t2code.commandguiv2.Spigot.function.useItem.ItemChange;
|
import net.t2code.commandguiv2.Spigot.function.useItem.ItemChange;
|
||||||
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
|
import net.t2code.commandguiv2.Spigot.function.useItem.Events;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
@ -29,13 +29,13 @@ public class CGuiAPI {
|
|||||||
public static boolean hasUseItemInMainHand(Player player) {
|
public static boolean hasUseItemInMainHand(Player player) {
|
||||||
ItemStack item = player.getInventory().getItemInMainHand();
|
ItemStack item = player.getInventory().getItemInMainHand();
|
||||||
return item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
return item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||||
&& item.getItemMeta().getDisplayName().equals(String.valueOf(Config.useItemName.value));
|
&& item.getItemMeta().getDisplayName().equals(String.valueOf(ConfigValues.useItemName.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasUseItemInOffHand(Player player) {
|
public static boolean hasUseItemInOffHand(Player player) {
|
||||||
ItemStack item = player.getInventory().getItemInOffHand();
|
ItemStack item = player.getInventory().getItemInOffHand();
|
||||||
return item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
return item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||||
&& item.getItemMeta().getDisplayName().equals(String.valueOf(Config.useItemName.value));
|
&& item.getItemMeta().getDisplayName().equals(String.valueOf(ConfigValues.useItemName.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void disableItemGiveOnJoin(Boolean disableItemGiveOnJoin) {
|
public static void disableItemGiveOnJoin(Boolean disableItemGiveOnJoin) {
|
||||||
|
17
CommandGUI V2/src/main/java/net/t2code/commandguiv2/cache/Cache.java
vendored
Normal file
17
CommandGUI V2/src/main/java/net/t2code/commandguiv2/cache/Cache.java
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package net.t2code.commandguiv2.cache;
|
||||||
|
|
||||||
|
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
||||||
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
||||||
|
import net.t2code.commandguiv2.Spigot.objects.UseItemObject;
|
||||||
|
import net.t2code.commandguiv2.Spigot.objects.player.PlayerObject;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class Cache {
|
||||||
|
public static HashMap<String, GuiObject> guiHashMap = new HashMap<>();
|
||||||
|
public static HashMap<String, UseItemObject> useItemHash = new HashMap<>();
|
||||||
|
public static ArrayList<String> allAliases = new ArrayList<>();
|
||||||
|
public static HashMap<String, FunctionObject> functionHashMap = new HashMap<>();
|
||||||
|
}
|
@ -1,201 +1,114 @@
|
|||||||
useItem:
|
useItem:
|
||||||
# Set here if the UseItem is to be used in use
|
# enable: Set here if the UseItem is to be used in use
|
||||||
enable: true
|
enable: false
|
||||||
# Set here if players are allowed to enable or disable the UseItem with '/gui-item <on/off>'.
|
|
||||||
# Permission 'commandgui.useitem.toggle' is additionally required
|
# openGUI: Set here which GUI should open the UseItem
|
||||||
allowToggle: true
|
|
||||||
# Set here if players are allowed to change the slot in the inventory where the UseItem is located with '/gui-item <slot>'.
|
|
||||||
# Permission 'commandgui.useitem.toggle' is additionally required
|
|
||||||
allowSetSlot: true
|
|
||||||
# Set here if the dropping of the UseItem should be blocked
|
|
||||||
blockMoveAndDrop: true
|
|
||||||
# Set here which GUI should open the UseItem
|
|
||||||
openGUI: default
|
openGUI: default
|
||||||
|
|
||||||
|
# allowToggle: Set here if players are allowed to enable or disable the UseItem with '/gui-item <useitemname> <on/off>'.
|
||||||
|
allowToggle: true
|
||||||
|
|
||||||
|
# allowSetSlot: Set here if players are allowed to change the slot in the inventory where the UseItem is located with '/gui-item <useitemname> slot <slot>'.
|
||||||
|
allowSetSlot: true
|
||||||
|
|
||||||
|
# blockMoveAndDrop: Set here if the dropping of the UseItem should be blocked
|
||||||
|
blockMoveAndDrop: true
|
||||||
|
|
||||||
permission:
|
permission:
|
||||||
# Set here if the permission 'commandgui.useitem' is required to use the UseItem
|
become:
|
||||||
neededToUse: true
|
# Here you define if and which permission is needed to get the UseItem (for Join etc.).
|
||||||
# Set here if the UseItem should stay in the inventory with the '/clear' command
|
needed: true
|
||||||
|
permission: 'commandgui.useitem.[useitemname].use'
|
||||||
|
# Specify here how the permission should be set by default. [TRUE, FALSE, OP, NOT_OP]
|
||||||
|
default: TRUE
|
||||||
|
use:
|
||||||
|
# Here you define if and which permission is needed to use the UseItem
|
||||||
|
needed: true
|
||||||
|
permission: 'commandgui.useitem.[useitemname].use'
|
||||||
|
# Specify here how the permission should be set by default. [TRUE, FALSE, OP, NOT_OP]
|
||||||
|
default: TRUE
|
||||||
|
toggle:
|
||||||
|
# Here you define if and which permission is needed to use the command '/gui-item <useitemname> <on/off>' for this UseItem
|
||||||
|
needed: true
|
||||||
|
permission: 'commandgui.useitem.[useitemname].toggle'
|
||||||
|
# Specify here how the permission should be set by default. [TRUE, FALSE, OP, NOT_OP]
|
||||||
|
default: OP
|
||||||
|
setSlot:
|
||||||
|
# Here you define if and which permission is needed to use the command '/gui-item <useitemname> slot <slot>' for this UseItem
|
||||||
|
needed: true
|
||||||
|
permission: 'commandgui.useitem.[useitemname].setslot'
|
||||||
|
# Specify here how the permission should be set by default. [TRUE, FALSE, OP, NOT_OP]
|
||||||
|
default: OP
|
||||||
|
|
||||||
|
# keepAtCommandClear: Set here if the UseItem should stay in the inventory with the '/clear' command
|
||||||
keepAtCommandClear: true
|
keepAtCommandClear: true
|
||||||
|
|
||||||
inventorySlot:
|
inventorySlot:
|
||||||
# Set here on which slot the UseItem should be located by default
|
# slot: slot: Set here on which slot the UseItem should be located by default
|
||||||
slot: 1
|
slot: 1
|
||||||
# Set here if the slot should be forced even if another item is on this slot (also the set slot of the player).
|
# slotEnforce: Set here if the slot should be forced even if another item is on this slot (also the set slot of the player).
|
||||||
# NOTE: The item that was on this slot before will be deleted.
|
# NOTE: The item that was on this slot before will be deleted.
|
||||||
slotEnforce: false
|
slotEnforce: false
|
||||||
# Set here if the UseItem should be placed on another free slot, if the selected slot (also the set slot of the player) is occupied.
|
# freeSlot: Set here if the UseItem should be placed on another free slot, if the selected slot (also the set slot of the player) is occupied.
|
||||||
freeSlot: false
|
freeSlot: false
|
||||||
|
|
||||||
# Set here the item that should be used as UseItem
|
# Set here the item that should be used as UseItem
|
||||||
item:
|
item:
|
||||||
# Set here which material should be used as UseItem
|
# material: Set here which material should be used as UseItem
|
||||||
material: paper
|
material: paper
|
||||||
playerHead:
|
playerHead:
|
||||||
# Set here if a PlayerHead should be used as UseItem
|
# enable: This specifies whether a PlayerHead is to be used as a UseItem. If this is set to true, the 'material' option is ignored.
|
||||||
enable: false
|
enable: false
|
||||||
base64:
|
base64:
|
||||||
# Set here if a Base64 PlayerHead should be used as UseItem
|
# enable: Set here if a Base64 PlayerHead should be used as UseItem
|
||||||
enable: false
|
enable: false
|
||||||
# Here you can set the Base64 Value.
|
# base64Value: Here you can set the Base64 Value.
|
||||||
# You can find the Base64 Value for example on https://minecraft-heads.com.
|
# You can find the Base64 Value for example on https://minecraft-heads.com.
|
||||||
base64Value: ''
|
base64Value: ''
|
||||||
# Here you can set whether the player head should be used as a UseItem by the player
|
# playerWhoHasOpenedTheGUI: Here you can set whether the player head should be used as a UseItem by the player
|
||||||
playerWhoHasOpenedTheGUI: false
|
playerWhoHasOpenedTheGUI: false
|
||||||
# Here you can set a player name whose head should be used as UseItem
|
# playerName: Here you can set a player name whose head should be used as UseItem
|
||||||
playerName: ''
|
playerName: ''
|
||||||
# Set the DisplayName of the UseItem here
|
# name: Set the DisplayName of the UseItem here
|
||||||
name: '&6GUI UseItem'
|
name: '&6GUI UseItem'
|
||||||
# Set the lore of the UseItem here
|
# lore: Set the lore of the UseItem here
|
||||||
lore:
|
lore:
|
||||||
- 'Lore line 1'
|
- 'Lore line 1'
|
||||||
- 'Lore line 2'
|
- 'Lore line 2'
|
||||||
|
|
||||||
join:
|
join:
|
||||||
# Set here if the UseItem should be given at every server join
|
# giveOnEveryJoin: Set here if the UseItem should be given at every server join
|
||||||
giveOnEveryJoin: true
|
giveOnEveryJoin: true
|
||||||
# Set here if the UseItem should only be given to the server at the first join of the player.
|
# giveOnlyOnFirstJoin: Set here if the UseItem should only be given to the server at the first join of the player.
|
||||||
giveOnlyOnFirstJoin: false
|
giveOnlyOnFirstJoin: false
|
||||||
|
|
||||||
quit:
|
quit:
|
||||||
|
# removeOnQuit: Set here if the UseItem should be removed from the inventory when leaving the server
|
||||||
removeOnQuit: false
|
removeOnQuit: false
|
||||||
|
|
||||||
protection:
|
protection:
|
||||||
gameMode:
|
gameMode:
|
||||||
|
# enable: Set here in which gamemode the UseItem may be used
|
||||||
enable: false
|
enable: false
|
||||||
|
# removeItemWhenItIsDisabled: Set here if the UseItem should be removed if you are in a not allowed Gamemode
|
||||||
removeItemWhenItIsDisabled: false
|
removeItemWhenItIsDisabled: false
|
||||||
|
# mode: Set here if a 'blacklist' or 'whitelist' should be used
|
||||||
mode: blacklist
|
mode: blacklist
|
||||||
|
# list: Set the GameMode list here
|
||||||
list:
|
list:
|
||||||
- CREATIVE
|
- CREATIVE
|
||||||
- Spectator
|
- SPECTATOR
|
||||||
|
|
||||||
world:
|
world:
|
||||||
|
# enable: Set here in which world the UseItem may be used
|
||||||
enable: false
|
enable: false
|
||||||
|
# removeItemWhenItIsDisabled: Here you specify whether the UseItem should be removed if you are in a world that is not permitted
|
||||||
removeItemWhenItIsDisabled: false
|
removeItemWhenItIsDisabled: false
|
||||||
|
# mode: Set here if a 'blacklist' or 'whitelist' should be used
|
||||||
mode: blacklist
|
mode: blacklist
|
||||||
|
# list: Set the worlds here
|
||||||
list:
|
list:
|
||||||
- World1
|
- World1
|
||||||
- World2
|
- World2
|
||||||
|
|
||||||
useItemSettings:
|
#/useitem <itemname> on/off/slot [slotnumber]
|
||||||
cursor:
|
|
||||||
toGUIItem:
|
|
||||||
useItem: default
|
|
||||||
onLogin:
|
|
||||||
# Here you define whether the UseItem should be selected when joining the server.
|
|
||||||
enable: true
|
|
||||||
spigot:
|
|
||||||
# Set here if the UseItem should only be selected at the first join
|
|
||||||
onOnlyFirstLogin: true
|
|
||||||
bungee:
|
|
||||||
# Set here if the UseItem should be selected even if you change the server of the bungee network.
|
|
||||||
# The option BungeeCord must be activated for this!
|
|
||||||
onServerChange: false
|
|
||||||
gameMode:
|
|
||||||
change:
|
|
||||||
enable: true
|
|
||||||
delayInTicks: 1
|
|
||||||
world:
|
|
||||||
change:
|
|
||||||
enable: true
|
|
||||||
delayInTicks: 1
|
|
||||||
disablePluginInfoBySneak: false
|
|
||||||
itemBlockBlacklist:
|
|
||||||
- CHEST
|
|
||||||
- CRAFTING_TABLE
|
|
||||||
- FURNACE
|
|
||||||
- OAK_FENCE
|
|
||||||
- SPRUCE_FENCE
|
|
||||||
- BIRCH_FENCE
|
|
||||||
- JUNGLE_FENCE
|
|
||||||
- ACACIA_FENCE
|
|
||||||
- DARK_OAK_FENCE
|
|
||||||
- MANGROVE_FENCE
|
|
||||||
- CRIMSON_FENCE
|
|
||||||
- WARPED_FENCE
|
|
||||||
- NETHER_BRICK_FENCE
|
|
||||||
- ENDER_CHEST
|
|
||||||
- BEACON
|
|
||||||
- ANVIL
|
|
||||||
- CHIPPED_ANVIL
|
|
||||||
- DAMAGED_ANVIL
|
|
||||||
- REPEATER
|
|
||||||
- COMPARATOR
|
|
||||||
- HOPPER
|
|
||||||
- DISPENSER
|
|
||||||
- DROPPER
|
|
||||||
- LEVER
|
|
||||||
- DAYLIGHT_DETECTOR
|
|
||||||
- TRAPPED_CHEST
|
|
||||||
- NOTE_BLOCK
|
|
||||||
- STONE_BUTTON
|
|
||||||
- POLISHED_BLACKSTONE_BUTTON
|
|
||||||
- OAK_BUTTON
|
|
||||||
- SPRUCE_BUTTON
|
|
||||||
- BIRCH_BUTTON
|
|
||||||
- JUNGLE_BUTTON
|
|
||||||
- ACACIA_BUTTON
|
|
||||||
- DARK_OAK_BUTTON
|
|
||||||
- MANGROVE_BUTTON
|
|
||||||
- CRIMSON_BUTTON
|
|
||||||
- WARPED_BUTTON
|
|
||||||
- IRON_DOOR
|
|
||||||
- OAK_DOOR
|
|
||||||
- SPRUCE_DOOR
|
|
||||||
- BIRCH_DOOR
|
|
||||||
- JUNGLE_DOOR
|
|
||||||
- ACACIA_DOOR
|
|
||||||
- DARK_OAK_DOOR
|
|
||||||
- MANGROVE_DOOR
|
|
||||||
- CRIMSON_DOOR
|
|
||||||
- WARPED_DOOR
|
|
||||||
- IRON_TRAPDOOR
|
|
||||||
- IRON_TRAPDOOR
|
|
||||||
- OAK_TRAPDOOR
|
|
||||||
- OAK_TRAPDOOR
|
|
||||||
- SPRUCE_TRAPDOOR
|
|
||||||
- SPRUCE_TRAPDOOR
|
|
||||||
- BIRCH_TRAPDOOR
|
|
||||||
- BIRCH_TRAPDOOR
|
|
||||||
- JUNGLE_TRAPDOOR
|
|
||||||
- JUNGLE_TRAPDOOR
|
|
||||||
- ACACIA_TRAPDOOR
|
|
||||||
- ACACIA_TRAPDOOR
|
|
||||||
- DARK_OAK_TRAPDOOR
|
|
||||||
- DARK_OAK_TRAPDOOR
|
|
||||||
- MANGROVE_TRAPDOOR
|
|
||||||
- MANGROVE_TRAPDOOR
|
|
||||||
- CRIMSON_TRAPDOOR
|
|
||||||
- CRIMSON_TRAPDOOR
|
|
||||||
- WARPED_TRAPDOOR
|
|
||||||
- WARPED_TRAPDOOR
|
|
||||||
- OAK_FENCE_GATE
|
|
||||||
- SPRUCE_FENCE_GATE
|
|
||||||
- BIRCH_FENCE_GATE
|
|
||||||
- JUNGLE_FENCE_GATE
|
|
||||||
- ACACIA_FENCE_GATE
|
|
||||||
- DARK_OAK_FENCE_GATE
|
|
||||||
- MANGROVE_FENCE_GATE
|
|
||||||
- CRIMSON_FENCE_GATE
|
|
||||||
- WARPED_FENCE_GATE
|
|
||||||
- CHEST_MINECART
|
|
||||||
- FURNACE_MINECART
|
|
||||||
- HOPPER_MINECART
|
|
||||||
- OAK_CHEST_BOAT
|
|
||||||
- SPRUCE_CHEST_BOAT
|
|
||||||
- BIRCH_CHEST_BOAT
|
|
||||||
- JUNGLE_CHEST_BOAT
|
|
||||||
- ACACIA_CHEST_BOAT
|
|
||||||
- DARK_OAK_CHEST_BOAT
|
|
||||||
- MANGROVE_CHEST_BOAT
|
|
||||||
- LEATHER_CHESTPLATE
|
|
||||||
- CHAINMAIL_CHESTPLATE
|
|
||||||
- IRON_CHESTPLATE
|
|
||||||
- DIAMOND_CHESTPLATE
|
|
||||||
- GOLDEN_CHESTPLATE
|
|
||||||
- NETHERITE_CHESTPLATE
|
|
||||||
- BREWING_STAND
|
|
||||||
- LOOM
|
|
||||||
- COMPOSTER
|
|
||||||
- BARREL
|
|
||||||
- SMOKER
|
|
||||||
- BLAST_FURNACE
|
|
||||||
- BLAST_FURNACE
|
|
||||||
- CARTOGRAPHY_TABLE
|
|
||||||
- FLETCHING_TABLE
|
|
||||||
- GRINDSTONE
|
|
||||||
- SMITHING_TABLE
|
|
||||||
- STONECUTTER
|
|
||||||
|
@ -33,133 +33,66 @@ storage:
|
|||||||
password: password
|
password: password
|
||||||
ssl: false
|
ssl: false
|
||||||
|
|
||||||
useItem:
|
toggle:
|
||||||
# Set here if the UseItem is to be used in use
|
|
||||||
enable: true
|
|
||||||
# Set here if players are allowed to enable or disable the UseItem with '/gui-item <on/off>'.
|
|
||||||
# Permission 'commandgui.useitem.toggle' is additionally required
|
|
||||||
allowToggle: true
|
|
||||||
# Set here if players are allowed to change the slot in the inventory where the UseItem is located with '/gui-item <slot>'.
|
|
||||||
# Permission 'commandgui.useitem.toggle' is additionally required
|
|
||||||
allowSetSlot: true
|
|
||||||
# Set here if the dropping of the UseItem should be blocked
|
|
||||||
blockMoveAndDrop: true
|
|
||||||
# Set here which GUI should open the UseItem
|
|
||||||
openGUI: default
|
|
||||||
permission:
|
|
||||||
# Set here if the permission 'commandgui.useitem' is required to use the UseItem
|
|
||||||
neededToUse: true
|
|
||||||
# Set here if the UseItem should stay in the inventory with the '/clear' command
|
|
||||||
keepAtCommandClear: true
|
|
||||||
inventorySlot:
|
|
||||||
# Set here on which slot the UseItem should be located by default
|
|
||||||
slot: 1
|
|
||||||
# Set here if the slot should be forced even if another item is on this slot (also the set slot of the player).
|
|
||||||
# NOTE: The item that was on this slot before will be deleted.
|
|
||||||
slotEnforce: false
|
|
||||||
# Set here if the UseItem should be placed on another free slot, if the selected slot (also the set slot of the player) is occupied.
|
|
||||||
freeSlot: false
|
|
||||||
# Set here the item that should be used as UseItem
|
|
||||||
item:
|
|
||||||
# Set here which material should be used as UseItem
|
|
||||||
Material: paper
|
|
||||||
PlayerHead:
|
|
||||||
# Set here if a PlayerHead should be used as UseItem
|
|
||||||
Enable: false
|
|
||||||
Base64:
|
|
||||||
# Set here if a Base64 PlayerHead should be used as UseItem
|
|
||||||
Enable: false
|
|
||||||
# Here you can set the Base64 Value.
|
|
||||||
# You can find the Base64 Value for example on https://minecraft-heads.com.
|
|
||||||
Base64Value: ''
|
|
||||||
# Here you can set whether the player head should be used as a UseItem by the player
|
|
||||||
PlayerWhoHasOpenedTheGUI: false
|
|
||||||
# Here you can set a player name whose head should be used as UseItem
|
|
||||||
Playername: ''
|
|
||||||
# Set the DisplayName of the UseItem here
|
|
||||||
Name: '&6GUI UseItem'
|
|
||||||
# Set the lore of the UseItem here
|
|
||||||
Lore:
|
|
||||||
- 'Lore line 1'
|
|
||||||
- 'Lore line 2'
|
|
||||||
Join:
|
|
||||||
# Set here if the UseItem should be given at every server join
|
|
||||||
GiveOnEveryJoin: true
|
|
||||||
# Set here if the UseItem should only be given to the server at the first join of the player.
|
|
||||||
GiveOnlyOnFirstJoin: false
|
|
||||||
Cursor:
|
|
||||||
ToGUIItem:
|
|
||||||
OnLogin:
|
|
||||||
# Here you define whether the UseItem should be selected when joining the server.
|
|
||||||
Enable: true
|
|
||||||
Spigot:
|
|
||||||
# Set here if the UseItem should only be selected at the first join
|
|
||||||
OnOnlyFirstLogin: true
|
|
||||||
Bungee:
|
|
||||||
# Set here if the UseItem should be selected even if you change the server of the bungee network.
|
|
||||||
# The option BungeeCord must be activated for this!
|
|
||||||
OnServerChange: false
|
|
||||||
|
|
||||||
Toggle:
|
|
||||||
# Set the items to be used with the Toggle function here
|
# Set the items to be used with the Toggle function here
|
||||||
Items:
|
items:
|
||||||
# Set here the item that should be used if you have the permission or the UseItem is active.
|
# Set here the item that should be used if you have the permission or the UseItem is active.
|
||||||
OnOrYes:
|
onOrYes:
|
||||||
Item:
|
item:
|
||||||
Base64:
|
base64:
|
||||||
# Set here if a Base64 head should be used
|
# Set here if a Base64 head should be used
|
||||||
Enable: false
|
enable: false
|
||||||
# Here you can set the Base64 Value.
|
# Here you can set the Base64 Value.
|
||||||
# You can find the Base64 Value for example on https://minecraft-heads.com.
|
# You can find the Base64 Value for example on https://minecraft-heads.com.
|
||||||
Base64Value: ''
|
base64Value: ''
|
||||||
# Set the material to be used here
|
# Set the material to be used here
|
||||||
Material: GREEN_WOOL
|
material: GREEN_WOOL
|
||||||
# Set here the item to be used if you have the permission or the UseItem is disabled
|
# Set here the item to be used if you have the permission or the UseItem is disabled
|
||||||
OffOrNo:
|
offOrNo:
|
||||||
Item:
|
item:
|
||||||
Base64:
|
base64:
|
||||||
# Set here if a Base64 head should be used
|
# Set here if a Base64 head should be used
|
||||||
Enable: false
|
enable: false
|
||||||
# Here you can set the Base64 Value.
|
# Here you can set the Base64 Value.
|
||||||
# You can find the Base64 Value for example on https://minecraft-heads.com.
|
# You can find the Base64 Value for example on https://minecraft-heads.com.
|
||||||
Base64Value: ''
|
base64Value: ''
|
||||||
# Set the material to be used here
|
# Set the material to be used here
|
||||||
Material: RED_WOOL
|
material: RED_WOOL
|
||||||
Permission:
|
permission:
|
||||||
# Set here the commands to be used for Toggle.Permission
|
# Set here the commands to be used for Toggle.Permission
|
||||||
Commands:
|
commands:
|
||||||
'True': luckperms user [player] permission set [perm] true
|
'true': luckperms user [player] permission set [perm] true
|
||||||
'False': luckperms user [player] permission set [perm] false
|
'false': luckperms user [player] permission set [perm] false
|
||||||
|
|
||||||
# Set the design of the placeholders here
|
# Set the design of the placeholders here
|
||||||
Placeholder:
|
placeholder:
|
||||||
# Placeholder for true / enabled
|
# Placeholder for true / enabled
|
||||||
'True': '&2true'
|
'true': '&2true'
|
||||||
# Placeholder for false / disabled
|
# Placeholder for false / disabled
|
||||||
'False': '&4false'
|
'false': '&4false'
|
||||||
|
|
||||||
Sound:
|
sound:
|
||||||
# Here you can disable all sounds
|
# Here you can disable all sounds
|
||||||
Enable: true
|
enable: true
|
||||||
# Set here At which action which sound should be played or none at all
|
# Set here At which action which sound should be played or none at all
|
||||||
OpenInventory:
|
openInventory:
|
||||||
Enable: true
|
enable: true
|
||||||
Sound: BLOCK_CHEST_OPEN
|
sound: BLOCK_CHEST_OPEN
|
||||||
Click:
|
click:
|
||||||
Enable: true
|
enable: true
|
||||||
Sound: BLOCK_NOTE_BLOCK_HAT
|
sound: BLOCK_NOTE_BLOCK_HAT
|
||||||
NoMoney:
|
noMoney:
|
||||||
Enable: true
|
enable: true
|
||||||
Sound: BLOCK_NOTE_BLOCK_HARP
|
sound: BLOCK_NOTE_BLOCK_HARP
|
||||||
NoInventorySpace:
|
noInventorySpace:
|
||||||
Enable: true
|
enable: true
|
||||||
Sound: BLOCK_NOTE_BLOCK_HARP
|
sound: BLOCK_NOTE_BLOCK_HARP
|
||||||
Give:
|
give:
|
||||||
Enable: true
|
enable: true
|
||||||
Sound: ENTITY_PLAYER_LEVELUP
|
sound: ENTITY_PLAYER_LEVELUP
|
||||||
PlayerNotFound:
|
playerNotFound:
|
||||||
Enable: true
|
enable: true
|
||||||
Sound: BLOCK_NOTE_BLOCK_HARP
|
sound: BLOCK_NOTE_BLOCK_HARP
|
||||||
|
|
||||||
useItemSettings:
|
useItemSettings:
|
||||||
cursor:
|
cursor:
|
||||||
@ -176,20 +109,20 @@ useItemSettings:
|
|||||||
# Set here if the UseItem should be selected even if you change the server of the bungee network.
|
# Set here if the UseItem should be selected even if you change the server of the bungee network.
|
||||||
# The option BungeeCord must be activated for this!
|
# The option BungeeCord must be activated for this!
|
||||||
onServerChange: false
|
onServerChange: false
|
||||||
GameMode:
|
gameMode:
|
||||||
Change:
|
change:
|
||||||
# Set here if the UseItem should be reset when the GameMode is changed.
|
# Set here if the UseItem should be reset when the GameMode is changed.
|
||||||
Enable: true
|
enable: true
|
||||||
# Set the delay with which the UseItem should be reset (time in Minecraft ticks. 20 is one second).
|
# Set the delay with which the UseItem should be reset (time in Minecraft ticks. 20 is one second).
|
||||||
DelayInTicks: 1
|
delayInTicks: 1
|
||||||
World:
|
world:
|
||||||
Change:
|
change:
|
||||||
# This specifies whether the UseItem should be reset when the world is changed.
|
# This specifies whether the UseItem should be reset when the world is changed.
|
||||||
Enable: true
|
enable: true
|
||||||
# Set the delay with which the UseItem should be reset (time in Minecraft ticks. 20 is one second).
|
# Set the delay with which the UseItem should be reset (time in Minecraft ticks. 20 is one second).
|
||||||
DelayInTicks: 1
|
delayInTicks: 1
|
||||||
# Set here for which blocks the UseItem is blocked and the function of the block you are looking at should be used.
|
# Set here for which blocks the UseItem is blocked and the function of the block you are looking at should be used.
|
||||||
ItemBlockBlacklist:
|
itemBlockBlacklist:
|
||||||
- CHEST
|
- CHEST
|
||||||
- CRAFTING_TABLE
|
- CRAFTING_TABLE
|
||||||
- FURNACE
|
- FURNACE
|
||||||
|
Loading…
Reference in New Issue
Block a user