From 8e90aee0ca2f4a2025f94cc9c5048eb4263e90dd Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Tue, 19 Apr 2022 08:32:07 +0200 Subject: [PATCH] 2.7.0_Snapshot-2 | small change Fix: the sound was not played when CostumSound was off in the function Change: placeholder in slot permissions changed from '[guiname]' to '[function]'. --- CommandGUI V2/pom.xml | 2 +- .../jatitv/commandguiv2/Spigot/Listener/GUI_Listener.java | 2 +- .../Spigot/Listener/UseItem_Listener/Events.java | 3 --- .../commandguiv2/Spigot/cmdManagement/Commands.java | 6 ------ .../Spigot/cmdManagement/register/RegisterCommand.java | 3 --- .../config/configConverter/ConfigConverterUnderV5.java | 4 ++-- .../jatitv/commandguiv2/Spigot/config/gui/CreateGUI.java | 8 ++++---- .../java/de/jatitv/commandguiv2/Spigot/gui/OpenGUI.java | 3 +++ .../de/jatitv/commandguiv2/Spigot/objects/Obj_Select.java | 6 ++++-- 9 files changed, 15 insertions(+), 22 deletions(-) diff --git a/CommandGUI V2/pom.xml b/CommandGUI V2/pom.xml index dac2e8e..cc1b140 100644 --- a/CommandGUI V2/pom.xml +++ b/CommandGUI V2/pom.xml @@ -6,7 +6,7 @@ net.t2code CommandGUI_V2 - 2.7.0_Snapshot-1 + 2.7.0_Snapshot-2 jar CommandGUI diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUI_Listener.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUI_Listener.java index d0d0dc0..419a162 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUI_Listener.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUI_Listener.java @@ -234,7 +234,7 @@ public class GUI_Listener implements Listener { player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1); } } - } + } else player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1); } private static void togglePerm(Function slot, Player player) { diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events.java index 7906ce2..0a3b85f 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events.java @@ -202,9 +202,6 @@ public class Events implements Listener { } if (!SelectConfig.UseItem_Permission || p.hasPermission("commandgui.useitem")) { OpenGUI.openGUI(p, SelectConfig.UseItem_OpenGUI); - if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) { - p.playSound(p.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1); - } } else { p.sendMessage(SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem") .replace("[gui]", SelectConfig.UseItem_OpenGUI)); 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 0dc832a..751538b 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 @@ -219,9 +219,6 @@ public class Commands { if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) { if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) { OpenGUI.openGUI(player, SelectConfig.DefaultGUI); - if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) { - player.playSound(player.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1); - } } else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui") .replace("[perm]", "commandgui.command")); } else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.GUI_Name)); @@ -234,9 +231,6 @@ public class Commands { if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) { if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command." + gui.Command_Command) || player.hasPermission("commandgui.bypass")) { OpenGUI.openGUI(player, arg); - if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) { - player.playSound(player.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1); - } } else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + gui.Command_Command) .replace("[perm]", "commandgui.command." + arg.toLowerCase())); } else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.Command_Command)); diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/register/RegisterCommand.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/register/RegisterCommand.java index 9f5cb9b..e66bb03 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/register/RegisterCommand.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/register/RegisterCommand.java @@ -27,9 +27,6 @@ public class RegisterCommand extends Command { if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) { if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) { OpenGUI.openGUI(player, alias); - if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) { - player.playSound(player.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1); - } } else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + alias) .replace("[perm]", "commandgui.command." + alias)); } else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.GUI_Name)); diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/configConverter/ConfigConverterUnderV5.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/configConverter/ConfigConverterUnderV5.java index f8f5375..14f3988 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/configConverter/ConfigConverterUnderV5.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/configConverter/ConfigConverterUnderV5.java @@ -152,8 +152,8 @@ public class ConfigConverterUnderV5 { set("Slots." + key + ".Enable", slotEnable, yamlConfiguration); set("Slots." + key + ".Function", function, yamlConfiguration); set("Slots." + key + ".Permission.Required", permRequired, yamlConfiguration); - set("Slots." + key + ".Permission.See", "commandgui.gui.[guiname].slot.[slot].see", yamlConfiguration); - set("Slots." + key + ".Permission.Use", "commandgui.gui.[guiname].slot.[slot].use", yamlConfiguration); + set("Slots." + key + ".Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration); + set("Slots." + key + ".Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration); } private static void set(String path, String value, YamlConfiguration config) { diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/gui/CreateGUI.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/gui/CreateGUI.java index 4832a79..78fcf7c 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/gui/CreateGUI.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/gui/CreateGUI.java @@ -33,15 +33,15 @@ public class CreateGUI { set("Slots.SupportDiscord.Enable", true, yamlConfiguration); set("Slots.SupportDiscord.Function", "SupportDiscord", yamlConfiguration); set("Slots.SupportDiscord.Permission.Required", false, yamlConfiguration); - set("Slots.SupportDiscord.Permission.See", "commandgui.gui.[guiname].slot.[slot].see", yamlConfiguration); - set("Slots.SupportDiscord.Permission.Use", "commandgui.gui.[guiname].slot.[slot].use", yamlConfiguration); + set("Slots.SupportDiscord.Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration); + set("Slots.SupportDiscord.Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration); set("Slots.UseItem.Slot", 6, yamlConfiguration); set("Slots.UseItem.Enable", true, yamlConfiguration); set("Slots.UseItem.Function", "UseItem", yamlConfiguration); set("Slots.UseItem.Permission.Required", false, yamlConfiguration); - set("Slots.UseItem.Permission.See", "commandgui.gui.[guiname].slot.[slot].see", yamlConfiguration); - set("Slots.UseItem.Permission.Use", "commandgui.gui.[guiname].slot.[slot].use", yamlConfiguration); + set("Slots.UseItem.Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration); + set("Slots.UseItem.Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration); try { diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/OpenGUI.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/OpenGUI.java index d3679d5..b7d444d 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/OpenGUI.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/OpenGUI.java @@ -121,6 +121,9 @@ public class OpenGUI { } } + if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) { + player.playSound(player.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1); + } player.openInventory(inventory); send.debug(plugin, "§6" + player.getName() + " §5Open §6" + Replace.replace(prefix, gui.GUI_Name) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); } else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", Replace.replace(prefix, gui.GUI_Name))); diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/objects/Obj_Select.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/objects/Obj_Select.java index 8cddb0d..14be303 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/objects/Obj_Select.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/objects/Obj_Select.java @@ -62,8 +62,10 @@ public class Obj_Select { String permUse = yamlConfiguration_gui.getString("Slots." + key + ".Permission.Use"); Slot slot = new Slot(slotNumber, enable, function, permRequired, - Objects.requireNonNull(permSee).replace("[guiname]", guiFileName).replace("[slot]", String.valueOf(slotNumber)) - .replace("[slotname]", key), permUse); + Objects.requireNonNull(permSee).replace("[function]", guiFileName).replace("[slot]", String.valueOf(slotNumber)) + .replace("[slotname]", key.toLowerCase()), + Objects.requireNonNull(permUse).replace("[function]", guiFileName).replace("[slot]", String.valueOf(slotNumber)) + .replace("[slotname]", key.toLowerCase())); slots.add(slot); } Gui gui = new Gui(guiEnable, guiLines, guiName, guiFillItemEnable, guiFillItemItem,