From 02cf238cd2eca6417ccc88078c3b2004e9913888 Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Wed, 29 Dec 2021 06:34:29 +0100 Subject: [PATCH 1/8] Fix UseItem.InventorySlot.SlotEnforce --- .../commandguiv2/Spigot/Listener/ItemChange.java | 11 +++++++++-- .../commandguiv2/Spigot/cmdManagement/Commands.java | 8 ++++++-- .../commandguiv2/Spigot/system/Give_UseItem.java | 8 ++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java index ecae016..55b463c 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java @@ -14,11 +14,16 @@ import org.bukkit.scheduler.BukkitRunnable; public class ItemChange { public static void itemChange(Player player) { Integer slot; - if (Select_Database.selectSlot(player) == null) { + if (SelectConfig.UseItem_InventorySlotEnforce){ slot = SelectConfig.UseItem_InventorySlot; } else { - slot = Select_Database.selectSlot(player); + if (Select_Database.selectSlot(player) == null) { + slot = SelectConfig.UseItem_InventorySlot; + } else { + slot = Select_Database.selectSlot(player); + } } + if (!SelectConfig.UseItem_Enable) { return; } @@ -55,7 +60,9 @@ public class ItemChange { } } if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) { + send.debugmsg(Main.plugin, "1"); if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(slot - 1) == null) { + send.debugmsg(Main.plugin, "2"); Give_UseItem.onGive(player); if (SelectConfig.Cursor_ToGUIItem_OnLogin) { if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin) { diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Commands.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Commands.java index 0c90f14..7717a0b 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Commands.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Commands.java @@ -128,10 +128,14 @@ public class Commands { } } Integer slot = null; - if (Select_Database.selectSlot(player) == null) { + if (SelectConfig.UseItem_InventorySlotEnforce){ slot = SelectConfig.UseItem_InventorySlot; } else { - slot = Select_Database.selectSlot(player); + if (Select_Database.selectSlot(player) == null) { + slot = SelectConfig.UseItem_InventorySlot; + } else { + slot = Select_Database.selectSlot(player); + } } send.debug(plugin,String.valueOf(slot)); if (player.getInventory().getItem(slot - 1) == null) { diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Give_UseItem.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Give_UseItem.java index aba390a..52d42db 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Give_UseItem.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Give_UseItem.java @@ -26,10 +26,14 @@ public class Give_UseItem { public static void onGive(Player player) { Integer slot; - if (Select_Database.selectSlot(player) == null) { + if (SelectConfig.UseItem_InventorySlotEnforce){ slot = SelectConfig.UseItem_InventorySlot; } else { - slot = Select_Database.selectSlot(player); + if (Select_Database.selectSlot(player) == null) { + slot = SelectConfig.UseItem_InventorySlot; + } else { + slot = Select_Database.selectSlot(player); + } } if (SelectConfig.UseItem_InventorySlot_FreeSlot) { player.getInventory().addItem(itemStack(player)); -- 2.34.1 From ff5c559f9380b5bf38c45f0d3a4f078f255273b2 Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Wed, 29 Dec 2021 06:44:04 +0100 Subject: [PATCH 2/8] Commented files (e.g. gui.ymlX) are no longer recognized as gui. --- .../de/jatitv/commandguiv2/Spigot/Objekte/Obj_Select.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Obj_Select.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Obj_Select.java index 59e1739..6a39f0c 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Obj_Select.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Obj_Select.java @@ -2,6 +2,7 @@ package de.jatitv.commandguiv2.Spigot.Objekte; import de.jatitv.commandguiv2.Spigot.Main; import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI; +import net.t2code.lib.Spigot.Lib.messages.send; import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion; import org.bukkit.configuration.file.YamlConfiguration; @@ -17,10 +18,9 @@ public class Obj_Select { File[] fileArray = f.listFiles(); for (File config_gui : fileArray) { - - Main.allAliases.add(config_gui.getName().replace(".yml", "")); String sub = config_gui.getName().substring(config_gui.getName().length() - 4); if (sub.equals(".yml")) { + Main.allAliases.add(config_gui.getName().replace(".yml", "")); YamlConfiguration yamlConfiguration_gui = YamlConfiguration.loadConfiguration(config_gui); Boolean GUI_Enable = yamlConfiguration_gui.getBoolean("GUI.Enable"); -- 2.34.1 From 6c53d936a04a492c69e2f4d688c0d36c154aeb9d Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Wed, 29 Dec 2021 06:47:33 +0100 Subject: [PATCH 3/8] clean code --- .../de/jatitv/commandguiv2/Spigot/Objekte/Obj_Select.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Obj_Select.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Obj_Select.java index 6a39f0c..55a3761 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Obj_Select.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Obj_Select.java @@ -38,7 +38,6 @@ public class Obj_Select { GUI_FillItem_Item = yamlConfiguration_gui.getString("GUI.FillItem.GlassPaneCollor"); } else GUI_FillItem_Item = yamlConfiguration_gui.getString("GUI.FillItem.Item"); - Boolean Command_Alias_Enable = yamlConfiguration_gui.getBoolean("Command.Alias"); Boolean Command_Permission = yamlConfiguration_gui.getBoolean("Command.Permission.Required"); @@ -46,7 +45,7 @@ public class Obj_Select { for (String key : yamlConfiguration_gui.getConfigurationSection("Slots").getKeys(false)) { Slot slot = new Slot(yamlConfiguration_gui.getInt("Slots." + key + ".Slot") - 1, yamlConfiguration_gui.getBoolean("Slots." + key + ".Enable"), - // yamlConfiguration_gui.getBoolean("Slots." + key + ".Item.Removable"), + // yamlConfiguration_gui.getBoolean("Slots." + key + ".Item.Removable"), yamlConfiguration_gui.getBoolean("Slots." + key + ".Item.Empty"), yamlConfiguration_gui.getInt("Slots." + key + ".Item.Amount"), yamlConfiguration_gui.getBoolean("Slots." + key + ".Item.PlayerHead.Enable"), @@ -77,7 +76,7 @@ public class Obj_Select { yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.File.Path"), yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.Option.Path"), yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.Option.Premat"), - // yamlConfiguration_gui.getBoolean("Slots." + key + ".SetConfig.Value.ChatInput"), + // yamlConfiguration_gui.getBoolean("Slots." + key + ".SetConfig.Value.ChatInput"), yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.Value.LeftClick.String"), yamlConfiguration_gui.getBoolean("Slots." + key + ".SetConfig.Value.LeftClick.Boolean"), -- 2.34.1 From a80d0d3e435fcb38c8bf70977ccd78017459c4d2 Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Wed, 29 Dec 2021 06:54:30 +0100 Subject: [PATCH 4/8] Remove Debugmessages --- .../java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java index 55b463c..d832a36 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java @@ -60,9 +60,7 @@ public class ItemChange { } } if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) { - send.debugmsg(Main.plugin, "1"); if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(slot - 1) == null) { - send.debugmsg(Main.plugin, "2"); Give_UseItem.onGive(player); if (SelectConfig.Cursor_ToGUIItem_OnLogin) { if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin) { -- 2.34.1 From f734748df8c495d2db4b459dc55f4b5e4050b91c Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Wed, 29 Dec 2021 06:55:36 +0100 Subject: [PATCH 5/8] Message added to the '/gui-item' command if this function is disabled --- .../Spigot/cmdManagement/CmdExecuter_GUIItem.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUIItem.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUIItem.java index e97b010..ba8b6b3 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUIItem.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUIItem.java @@ -23,7 +23,9 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter { Player player = (Player) sender; if (sender.hasPermission("commandgui.useitem.toggle")) { if (args.length == 0) { - Help.sendGUIItemHelp(sender, prefix); + if (SelectConfig.UseItem_AllowToggle) { + Help.sendGUIItemHelp(sender, prefix); + } else send.sender(sender, "§4UseItem toggle is disabled!");// todo } else { if (args.length == 1 || args.length == 2) { if (sender instanceof Player) { @@ -50,7 +52,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter { Help.sendHelp(player, prefix); } - } + } else send.sender(sender, "§4UseItem toggle is disabled!");// todo } else sender.sendMessage(SelectMessages.OnlyForPlayer); } } -- 2.34.1 From b5553c770d6f46dd1ebea8eeb9922ed9c6c83b66 Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Wed, 29 Dec 2021 06:57:11 +0100 Subject: [PATCH 6/8] 2.5.16_Snapshot_1 --- CommandGUI V2/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommandGUI V2/pom.xml b/CommandGUI V2/pom.xml index 3a40e81..92f8271 100644 --- a/CommandGUI V2/pom.xml +++ b/CommandGUI V2/pom.xml @@ -6,7 +6,7 @@ net.t2code CommandGUI_V2 - 2.5.15 + 2.5.16_Snapshot_1 jar CommandGUI -- 2.34.1 From 5d8188b68414c92f0c45f1c8b96f5f8ff03c0407 Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Fri, 31 Dec 2021 04:17:11 +0100 Subject: [PATCH 7/8] Added more subcommands for '/cgui admin info' --- .../commandguiv2/Spigot/cmdManagement/CmdExecuter_GUI.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUI.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUI.java index 7a5aa4c..27db4b0 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUI.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUI.java @@ -39,6 +39,10 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter { switch (args[1].toLowerCase()) { case "info": + case "plugin": + case "pl": + case "version": + case "ver": if (sender.hasPermission("commandgui.command.info")) { Commands.info(sender); } else sender.sendMessage(SelectMessages.NoPermissionForCommand -- 2.34.1 From 7b0d8952ecb986b327264d88215a2c787f1f9916 Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Fri, 31 Dec 2021 04:19:00 +0100 Subject: [PATCH 8/8] add ISSUE_TEMPLATE --- .gitea/ISSUE_TEMPLATE/bug_report.md | 37 ++++++++++++++++++++++++ .gitea/ISSUE_TEMPLATE/feature_request.md | 21 ++++++++++++++ .gitea/ISSUE_TEMPLATE/question.md | 22 ++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 .gitea/ISSUE_TEMPLATE/bug_report.md create mode 100644 .gitea/ISSUE_TEMPLATE/feature_request.md create mode 100644 .gitea/ISSUE_TEMPLATE/question.md diff --git a/.gitea/ISSUE_TEMPLATE/bug_report.md b/.gitea/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..cf167e5 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,37 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: +- "bug report" + +--- + +**Description of issue:** + + +--- + +**Plugin Version (using`/cgui admin info`):** + +**Server Type (Spigot/Paperspigot/etc):** + +**Server Version (using `/ver`):** + +**Relevant plugins (Delete if this isn't needed):** + +--- + +**ERROR (DELETE IF YOU HAVE NO ERROR):** +``` +###################### +## REPLACE WITH ERROR ## +###################### +``` + +**CONFIG SECTION (DELETE IF NOT RELEVANT):** +``` +####################################### +## REPLACE WITH RELEVANT CONFIG SECTION ## +####################################### +``` \ No newline at end of file diff --git a/.gitea/ISSUE_TEMPLATE/feature_request.md b/.gitea/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..8d0d166 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,21 @@ +--- +name: Feature request +about: Suggest an idea/improvement +title: '' +labels: +- " feature request" + +--- + +**Description of feature request:** + + +--- + +**Plugin Version (using`/cgui admin info`):** + +**Server Type (Spigot/Paperspigot/etc):** + +**Server Version (using `/ver`):** + +**Relevant plugins (Delete if this isn't needed):** \ No newline at end of file diff --git a/.gitea/ISSUE_TEMPLATE/question.md b/.gitea/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000..badd45c --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/question.md @@ -0,0 +1,22 @@ +--- +name: Question +about: Ask a question or get advice +title: '' +labels: question +assignees: '' + +--- + +**Share your question here:** + +--- + +**Plugin Version (using`/cgui admin info`):** + +**Server Type (Spigot/Paperspigot/etc):** + +**Server Version (using `/ver`):** + +**Relevant plugins (Delete if this isn't needed):** + +--- \ No newline at end of file -- 2.34.1