From f436b0358438ffc1cfb26dec72b4d4f7087268da Mon Sep 17 00:00:00 2001 From: BenCodez Date: Sun, 16 Jun 2024 12:23:34 -0400 Subject: [PATCH] Support left clicking on GUI to show all votesites even without perms --- .../votingplugin/commands/gui/player/VoteURL.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/VotingPlugin/src/com/bencodez/votingplugin/commands/gui/player/VoteURL.java b/VotingPlugin/src/com/bencodez/votingplugin/commands/gui/player/VoteURL.java index 2c5282a8b..ad76a46c4 100644 --- a/VotingPlugin/src/com/bencodez/votingplugin/commands/gui/player/VoteURL.java +++ b/VotingPlugin/src/com/bencodez/votingplugin/commands/gui/player/VoteURL.java @@ -7,6 +7,7 @@ import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; import com.bencodez.advancedcore.api.bookgui.BookWrapper; import com.bencodez.advancedcore.api.bookgui.Layout; @@ -51,6 +52,10 @@ public VoteURL(VotingPluginMain plugin, CommandSender player, VotingPluginUser u @Override public ArrayList getChat(CommandSender sender) { + return getChat(sender, false); + } + + public ArrayList getChat(CommandSender sender, boolean bypassPermissionCheck) { ArrayList sites = new ArrayList(); List title = plugin.getConfigFile().getFormatCommandsVoteText(); @@ -61,7 +66,7 @@ public ArrayList getChat(CommandSender sender) { int counter = 0; for (VoteSite voteSite : plugin.getVoteSitesEnabled()) { if (!voteSite.isHidden()) { - if (voteSite.getPermissionToView().isEmpty() + if (voteSite.getPermissionToView().isEmpty() || bypassPermissionCheck || sender.hasPermission(voteSite.getPermissionToView())) { if (!plugin.getConfigFile().isFormatCommandsVoteOnlyShowSitesToVote() || user.canVoteSite(voteSite)) { @@ -192,7 +197,11 @@ public void onChest(Player player) { public void onClick(ClickEvent event) { VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(event.getPlayer()); json = true; - user.sendMessage(getChat(player)); + if (event.getClick().equals(ClickType.LEFT)) { + user.sendMessage(getChat(player, true)); + } else { + user.sendMessage(getChat(player, false)); + } } @Override