2012-06-08 15:28:36 +02:00
|
|
|
package com.Acrobot.ChestShop.Events.Protection;
|
2012-05-10 16:32:25 +02:00
|
|
|
|
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.event.Event;
|
|
|
|
import org.bukkit.event.HandlerList;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Acrobot
|
|
|
|
*/
|
|
|
|
public class BuildPermissionEvent extends Event {
|
|
|
|
private static final HandlerList handlers = new HandlerList();
|
|
|
|
|
|
|
|
private Player player;
|
|
|
|
private Location chest, sign;
|
|
|
|
|
|
|
|
private int disallowed = 0;
|
|
|
|
private int received = 0;
|
|
|
|
|
|
|
|
public BuildPermissionEvent(Player player, Location chest, Location sign) {
|
|
|
|
this.player = player;
|
|
|
|
this.chest = chest;
|
|
|
|
this.sign = sign;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Player getPlayer() {
|
|
|
|
return player;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Location getChest() {
|
|
|
|
return chest;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Location getSign() {
|
|
|
|
return sign;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void allow() {
|
|
|
|
received++;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isAllowed() {
|
|
|
|
return disallowed != received || received == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void allow(boolean yesOrNot) {
|
|
|
|
if (yesOrNot) {
|
|
|
|
allow();
|
|
|
|
} else {
|
|
|
|
disallow();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void disallow() {
|
|
|
|
received++;
|
|
|
|
disallowed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
public HandlerList getHandlers() {
|
|
|
|
return handlers;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static HandlerList getHandlerList() {
|
|
|
|
return handlers;
|
|
|
|
}
|
|
|
|
}
|