Skip to content

Commit

Permalink
Fix issue with conditional items and rewards in VoteGUI
Browse files Browse the repository at this point in the history
  • Loading branch information
BenCodez committed Apr 13, 2024
1 parent 8b17e43 commit 4f2caf6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VotingPlugin/Resources/GUI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ CHEST:
Name: '&4Vote Shop'
Lore:
- '&aYou currently have %points% points'
# 'ExtraName' below is an identifier, can be whatever
# 'ExtraItem' below is an identifier, can be whatever
# ExtraItem:
# Item:
# Material: 'DIRT'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,19 @@ public void run() {
} else {
plugin.getCommandLoader().processSlotClick(player, user, slot);
}
String prefix = "";
if (event.getButton().getBuilder().isConditional()) {
prefix = "Item.";
}

if (plugin.getRewardHandler().hasRewards(plugin.getGui().getData(), plugin.getGui()
.getChestVoteGUISlotRewardsPath(slot, event.getButton().getLastRewardsPath(player)))) {
plugin.getRewardHandler().giveReward(plugin.getVotingPluginUserManager().getVotingPluginUser(player),
if (plugin.getRewardHandler().hasRewards(plugin.getGui().getData(),
plugin.getGui().getChestVoteGUISlotRewardsPath(slot,
prefix + event.getButton().getLastRewardsPath(player)))) {
plugin.getRewardHandler().giveReward(
plugin.getVotingPluginUserManager().getVotingPluginUser(player),
plugin.getGui().getData(),
plugin.getGui().getChestVoteGUISlotRewardsPath(slot,
event.getButton().getLastRewardsPath(player)),
prefix + event.getButton().getLastRewardsPath(player)),
new RewardOptions().addPlaceholder("identifier", slot));
}
}
Expand Down

0 comments on commit 4f2caf6

Please sign in to comment.