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]'.
This commit is contained in:
JaTiTV 2022-04-19 08:32:07 +02:00
parent b0ff520847
commit 8e90aee0ca
9 changed files with 15 additions and 22 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>CommandGUI_V2</artifactId> <artifactId>CommandGUI_V2</artifactId>
<version>2.7.0_Snapshot-1</version> <version>2.7.0_Snapshot-2</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>CommandGUI</name> <name>CommandGUI</name>

View File

@ -234,7 +234,7 @@ public class GUI_Listener implements Listener {
player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1); 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) { private static void togglePerm(Function slot, Player player) {

View File

@ -202,9 +202,6 @@ public class Events implements Listener {
} }
if (!SelectConfig.UseItem_Permission || p.hasPermission("commandgui.useitem")) { if (!SelectConfig.UseItem_Permission || p.hasPermission("commandgui.useitem")) {
OpenGUI.openGUI(p, SelectConfig.UseItem_OpenGUI); OpenGUI.openGUI(p, SelectConfig.UseItem_OpenGUI);
if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
p.playSound(p.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
}
} else { } else {
p.sendMessage(SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem") p.sendMessage(SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
.replace("[gui]", SelectConfig.UseItem_OpenGUI)); .replace("[gui]", SelectConfig.UseItem_OpenGUI));

View File

@ -219,9 +219,6 @@ public class Commands {
if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) { if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) {
if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) { if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) {
OpenGUI.openGUI(player, SelectConfig.DefaultGUI); 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") } else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui")
.replace("[perm]", "commandgui.command")); .replace("[perm]", "commandgui.command"));
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.GUI_Name)); } 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.GUI_Enable || player.hasPermission("commandgui.bypass")) {
if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command." + gui.Command_Command) || player.hasPermission("commandgui.bypass")) { if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command." + gui.Command_Command) || player.hasPermission("commandgui.bypass")) {
OpenGUI.openGUI(player, arg); 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) } else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + gui.Command_Command)
.replace("[perm]", "commandgui.command." + arg.toLowerCase())); .replace("[perm]", "commandgui.command." + arg.toLowerCase()));
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.Command_Command)); } else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.Command_Command));

View File

@ -27,9 +27,6 @@ public class RegisterCommand extends Command {
if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) { if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) {
if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) { if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) {
OpenGUI.openGUI(player, alias); 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) } else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + alias)
.replace("[perm]", "commandgui.command." + alias)); .replace("[perm]", "commandgui.command." + alias));
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.GUI_Name)); } else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.GUI_Name));

View File

@ -152,8 +152,8 @@ public class ConfigConverterUnderV5 {
set("Slots." + key + ".Enable", slotEnable, yamlConfiguration); set("Slots." + key + ".Enable", slotEnable, yamlConfiguration);
set("Slots." + key + ".Function", function, yamlConfiguration); set("Slots." + key + ".Function", function, yamlConfiguration);
set("Slots." + key + ".Permission.Required", permRequired, yamlConfiguration); set("Slots." + key + ".Permission.Required", permRequired, yamlConfiguration);
set("Slots." + key + ".Permission.See", "commandgui.gui.[guiname].slot.[slot].see", yamlConfiguration); set("Slots." + key + ".Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration);
set("Slots." + key + ".Permission.Use", "commandgui.gui.[guiname].slot.[slot].use", yamlConfiguration); set("Slots." + key + ".Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration);
} }
private static void set(String path, String value, YamlConfiguration config) { private static void set(String path, String value, YamlConfiguration config) {

View File

@ -33,15 +33,15 @@ public class CreateGUI {
set("Slots.SupportDiscord.Enable", true, yamlConfiguration); set("Slots.SupportDiscord.Enable", true, yamlConfiguration);
set("Slots.SupportDiscord.Function", "SupportDiscord", yamlConfiguration); set("Slots.SupportDiscord.Function", "SupportDiscord", yamlConfiguration);
set("Slots.SupportDiscord.Permission.Required", false, yamlConfiguration); set("Slots.SupportDiscord.Permission.Required", false, yamlConfiguration);
set("Slots.SupportDiscord.Permission.See", "commandgui.gui.[guiname].slot.[slot].see", yamlConfiguration); set("Slots.SupportDiscord.Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration);
set("Slots.SupportDiscord.Permission.Use", "commandgui.gui.[guiname].slot.[slot].use", yamlConfiguration); set("Slots.SupportDiscord.Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration);
set("Slots.UseItem.Slot", 6, yamlConfiguration); set("Slots.UseItem.Slot", 6, yamlConfiguration);
set("Slots.UseItem.Enable", true, yamlConfiguration); set("Slots.UseItem.Enable", true, yamlConfiguration);
set("Slots.UseItem.Function", "UseItem", yamlConfiguration); set("Slots.UseItem.Function", "UseItem", yamlConfiguration);
set("Slots.UseItem.Permission.Required", false, yamlConfiguration); set("Slots.UseItem.Permission.Required", false, yamlConfiguration);
set("Slots.UseItem.Permission.See", "commandgui.gui.[guiname].slot.[slot].see", yamlConfiguration); set("Slots.UseItem.Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration);
set("Slots.UseItem.Permission.Use", "commandgui.gui.[guiname].slot.[slot].use", yamlConfiguration); set("Slots.UseItem.Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration);
try { try {

View File

@ -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); 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"); 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))); } else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", Replace.replace(prefix, gui.GUI_Name)));

View File

@ -62,8 +62,10 @@ public class Obj_Select {
String permUse = yamlConfiguration_gui.getString("Slots." + key + ".Permission.Use"); String permUse = yamlConfiguration_gui.getString("Slots." + key + ".Permission.Use");
Slot slot = new Slot(slotNumber, enable, function, permRequired, Slot slot = new Slot(slotNumber, enable, function, permRequired,
Objects.requireNonNull(permSee).replace("[guiname]", guiFileName).replace("[slot]", String.valueOf(slotNumber)) Objects.requireNonNull(permSee).replace("[function]", guiFileName).replace("[slot]", String.valueOf(slotNumber))
.replace("[slotname]", key), permUse); .replace("[slotname]", key.toLowerCase()),
Objects.requireNonNull(permUse).replace("[function]", guiFileName).replace("[slot]", String.valueOf(slotNumber))
.replace("[slotname]", key.toLowerCase()));
slots.add(slot); slots.add(slot);
} }
Gui gui = new Gui(guiEnable, guiLines, guiName, guiFillItemEnable, guiFillItemItem, Gui gui = new Gui(guiEnable, guiLines, guiName, guiFillItemEnable, guiFillItemItem,