Skip to content

Commit

Permalink
Fix issue when complete wipe did not work, even when selected.
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Sep 5, 2019
1 parent a5022be commit 28d6187
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/main/java/world/bentobox/challenges/panel/admin/AdminGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public class AdminGUI extends CommonGUI
*/
private boolean resetAllMode;

/**
* This indicate if wipe button should clear all data, or only challenges.
*/
private boolean wipeAll;


// ---------------------------------------------------------------------
// Section: Enums
Expand Down Expand Up @@ -154,7 +159,15 @@ public void build()
panelBuilder.item(16, this.createButton(Button.EDIT_SETTINGS));

// Button that deletes everything from challenges addon
panelBuilder.item(34, this.createButton(Button.CHALLENGE_WIPE));

if (this.wipeAll)
{
panelBuilder.item(34, this.createButton(Button.COMPLETE_WIPE));
}
else
{
panelBuilder.item(34, this.createButton(Button.CHALLENGE_WIPE));
}

panelBuilder.item(44, this.returnButton);

Expand Down Expand Up @@ -451,11 +464,11 @@ private PanelItem createButton(Button button)

if (clickType.isRightClick())
{
panel.getInventory().setItem(slot, this.createButton(Button.CHALLENGE_WIPE).getItem());
}
this.wipeAll = false;
this.build();
}
else
{

new ConfirmationGUI(this.user, value -> {
if (value)
{
Expand Down Expand Up @@ -484,7 +497,8 @@ private PanelItem createButton(Button button)

if (clickType.isRightClick())
{
panel.getInventory().setItem(slot, this.createButton(Button.COMPLETE_WIPE).getItem());
this.wipeAll = true;
this.build();
}
else
{
Expand Down

0 comments on commit 28d6187

Please sign in to comment.