mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-12-24 17:17:49 +01:00
Make events cancellable
This commit is contained in:
parent
c86ffb623a
commit
2620b56555
@ -12,6 +12,8 @@ import org.bukkit.event.HandlerList;
|
||||
public class AccountCheckEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
boolean outcome;
|
||||
|
||||
private String account;
|
||||
private World world;
|
||||
|
||||
@ -24,6 +26,22 @@ public class AccountCheckEvent extends Event {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Event's outcome (does the account exist?)
|
||||
*/
|
||||
public boolean getOutcome() {
|
||||
return outcome;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the event's outcome
|
||||
*
|
||||
* @param outcome Outcome of the check
|
||||
*/
|
||||
public void setOutcome(boolean outcome) {
|
||||
this.outcome = outcome;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Account which is being checked
|
||||
*/
|
||||
|
@ -14,6 +14,8 @@ import java.math.BigDecimal;
|
||||
public class CurrencyCheckEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
boolean outcome;
|
||||
|
||||
private BigDecimal amount;
|
||||
private String account;
|
||||
private World world;
|
||||
@ -24,6 +26,22 @@ public class CurrencyCheckEvent extends Event {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Does the account have enough currency available?
|
||||
*/
|
||||
public boolean getOutcome() {
|
||||
return outcome;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if the account holds enough currency
|
||||
*
|
||||
* @param outcome Outcome of the currency check
|
||||
*/
|
||||
public void hasEnough(boolean outcome) {
|
||||
this.outcome = outcome;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Amount of currency
|
||||
*/
|
||||
@ -72,6 +90,15 @@ public class CurrencyCheckEvent extends Event {
|
||||
return account;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the account name
|
||||
*
|
||||
* @param account Account name
|
||||
*/
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user