Make events cancellable

This commit is contained in:
Acrobot 2013-05-30 16:58:22 +02:00
parent c86ffb623a
commit 2620b56555
2 changed files with 45 additions and 0 deletions

View File

@ -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
*/

View File

@ -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;
}