If you didn't have the permission to see an item, you could still click on it and get the message that you don't have the permission. This has now been changed so that you only get the message if you can see the item.
This commit is contained in:
JaTiTV 2022-04-06 20:21:19 +02:00
parent 1c6e6d6660
commit 17b1a0568e
3 changed files with 14 additions and 12 deletions

View File

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

View File

@ -46,13 +46,13 @@ public class GUI_Listener implements Listener {
e.setCancelled(true);
for (Slot slot : gui.GUI_Slots) {
if (e.getSlot() != slot.Slot) continue;
if (!slot.Perm
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1))
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1) + ".use")
|| player.hasPermission("commandgui.admin")) {
if (!slot.Enable) continue;
if (!e.getCurrentItem().getItemMeta().getDisplayName().equals(Replace.replace(prefix, slot.Name))) continue;
if (e.getCurrentItem().getType() == ItemVersion.getHead() || e.getCurrentItem().getType() == Material.valueOf(slot.Item.toUpperCase().replace(".", "_"))) {
if (e.getCurrentItem().getType() == ItemVersion.getHead() || e.getCurrentItem().getType() == Material.valueOf(slot.Item.toUpperCase().replace(".", "_"))) {
if (!slot.Perm
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1))
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1) + ".use")
|| player.hasPermission("commandgui.admin")) {
if (!slot.Enable) continue;
if (!e.getCurrentItem().getItemMeta().getDisplayName().equals(Replace.replace(prefix, slot.Name))) continue;
if (slot.Cost_Enable) {
if (slot.Command_Enable || slot.Message_Enable || slot.OpenGUI_Enable || slot.ServerChange) {
if (!Vault.buy(prefix, player, slot.Price)) {
@ -63,7 +63,8 @@ public class GUI_Listener implements Listener {
}
}.runTaskLater(plugin, 1L);
player.sendMessage(SelectMessages.No_money);
if (SelectConfig.Sound_NoMoney_Enable && SelectConfig.Sound_Enable) player.playSound(player.getLocation(), SelectConfig.Sound_NoMoney, 3, 1);
if (SelectConfig.Sound_NoMoney_Enable && SelectConfig.Sound_Enable)
player.playSound(player.getLocation(), SelectConfig.Sound_NoMoney, 3, 1);
} else {
player.sendMessage(SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, slot.Name))
.replace("[price]", slot.Price + " " + SelectConfig.Currency));
@ -71,9 +72,9 @@ public class GUI_Listener implements Listener {
}
}
} else execute(slot, player, e, gui);
}
} else player.sendMessage(SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, slot.Name))
} else player.sendMessage(SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, slot.Name))
.replace("[perm]", "commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1)));
}
}
}
}

View File

@ -69,7 +69,8 @@ public final class Main extends JavaPlugin {
if (PluginCheck.plotSquaredGUI()) {
PlotSquaredGUI = true;
addonEnable(Bukkit.getPluginManager().getPlugin("PlotSquaredGUI"));
}if (PluginCheck.luckyBox()) {
}
if (PluginCheck.luckyBox()) {
LuckyBox = true;
addonEnable(Bukkit.getPluginManager().getPlugin("T2C-LuckyBox"));
}