ChestShop-3/src/main/java/com/Acrobot/ChestShop/Events/AccountAccessEvent.java
Phoenix616 3bed1261aa Move account access check to an event
This should be the final addition that allows other plugins to implement
multi-owner/group shops like requested in #119 and #133 by listening to
all the transaction events to handle money flow and shop/account access
events to enable access to the actual shop.
2020-05-02 15:32:48 +01:00

58 lines
1.3 KiB
Java

package com.Acrobot.ChestShop.Events;
import com.Acrobot.ChestShop.Database.Account;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
/**
* Represents an access request for a specific account.
*/
public class AccountAccessEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private final Account account;
private boolean canAccess = false;
public AccountAccessEvent(Player player, Account account) {
super(player);
this.account = account;
}
/**
* The account to check the access for
*
* @return The account
*/
public Account getAccount() {
return account;
}
/**
* Whether or not the player can access the account.
*
* @return Whether or not the player can access the account
*/
public boolean canAccess() {
return canAccess;
}
/**
* Set whether or not the player can access the account.
*
* @param canAccess Whether or not the player can access the account
*/
public void setAccess(boolean canAccess) {
this.canAccess = canAccess;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}