Skip to content

Commit

Permalink
Implement bypass mode for confirmation command.
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Aug 20, 2021
1 parent 7b9b6cb commit a0636a5
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public boolean canExecute(User user, String label, List<String> args)
// Open panel. No checks required.
return true;
}
else if (args.size() == 1)
else if (args.size() == 1 || args.size() == 2 && Objects.equals(args.get(1), "bypass"))
{
UUID targetUUID = Util.getUUID(args.get(0));

Expand Down Expand Up @@ -177,11 +177,13 @@ else if (args.size() == 1)
@Override
public boolean execute(User user, String label, List<String> args)
{
boolean bypass = args.size() == 2 && Objects.equals(args.get(1), "bypass");

if (args.isEmpty())
{
VisitPanel.openPanel(this.getAddon(), this.getWorld(), user, this.getTopLabel());
}
else if (args.size() == 1)
else if (args.size() == 1 || bypass)
{
double tax;
double earnings;
Expand All @@ -207,7 +209,7 @@ else if (args.size() == 1)
Constants.PARAMETER_OWNER, this.getPlayers().getName(this.island.getOwner()),
Constants.PARAMETER_RECEIVER, String.valueOf(earnings));

if (this.<VisitAddon>getAddon().getSettings().isPaymentConfirmation() && (tax + earnings) > 0)
if (this.<VisitAddon>getAddon().getSettings().isPaymentConfirmation() && (tax + earnings) > 0 && !bypass)
{
// If there is associated cost, then ask confirmation from user.
this.askConfirmation(user,
Expand Down

0 comments on commit a0636a5

Please sign in to comment.