Skip to content

Commit

Permalink
Add option to not hide voteshop item with no permission
Browse files Browse the repository at this point in the history
  • Loading branch information
BenCodez committed Dec 17, 2023
1 parent 0340f45 commit 8257b4f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions VotingPlugin/Resources/GUI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ CHEST:
Cost: 3
# Permission required, leave blank for no permission
Permission: ''
# Hide if player doesn't have permission (only if permission is set)
HideOnNoPermission: true
# Whether or not to keep GUI open after purchase
CloseGUI: true
# Require confirmation on purchase, overrides global option above
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public void onChest(Player player) {
}

if (!plugin.getGui().getChestVoteShopNotBuyable(identifier)) {
if (hasPerm && (limitPass || !plugin.getGui().isChestVoteShopHideLimitedReached())) {
if ((hasPerm || !plugin.getGui().getChestVoteShopHideOnNoPermission(identifier))
&& (limitPass || !plugin.getGui().isChestVoteShopHideLimitedReached())) {
ItemBuilder builder = new ItemBuilder(plugin.getGui().getChestShopIdentifierSection(identifier));

inv.addButton(new BInventoryButton(builder) {
Expand Down Expand Up @@ -147,13 +148,13 @@ public void onClick(ClickEvent event) {
}
} else {
plugin.getBukkitScheduler().runTask(plugin, new Runnable() {

@Override
public void run() {
new VoteShopConfirm(plugin, player, user, identifier).open(GUIMethod.CHEST);
new VoteShopConfirm(plugin, player, user, identifier)
.open(GUIMethod.CHEST);
}
});


}
} else {
Expand Down
4 changes: 4 additions & 0 deletions VotingPlugin/src/com/bencodez/votingplugin/config/GUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ public String getChestVoteNextCustomSiteNamesDisplays(String site) {
public boolean getChestVoteShopCloseGUI(String shop) {
return getData().getBoolean("CHEST.Shop." + shop + ".CloseGUI", true);
}

public boolean getChestVoteShopHideOnNoPermission(String shop) {
return getData().getBoolean("CHEST.Shop." + shop + ".HideOnNoPermission", true);
}

@ConfigDataBoolean(path = "CHEST.VoteShopEnabled")
@Getter
Expand Down

0 comments on commit 8257b4f

Please sign in to comment.