New general Barrel open perms checker + Towny

This commit is contained in:
Sn0wStorm
2020-11-03 21:28:50 +01:00
parent d77d511dae
commit 4228bbc02c
18 changed files with 176 additions and 6 deletions
@@ -2,6 +2,7 @@ package com.dre.brewery.api.events.barrel;
import com.dre.brewery.Barrel;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
@@ -16,12 +17,18 @@ public class BarrelAccessEvent extends BarrelEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Player player;
private final Block clickedBlock;
private final BlockFace clickedBlockFace;
private boolean isCancelled;
public BarrelAccessEvent(Barrel barrel, Player player, Block clickedBlock) {
this(barrel, player, clickedBlock, BlockFace.UP);
}
public BarrelAccessEvent(Barrel barrel, Player player, Block clickedBlock, BlockFace clickedBlockFace) {
super(barrel);
this.player = player;
this.clickedBlock = clickedBlock;
this.clickedBlockFace = clickedBlockFace;
}
/**
@@ -32,6 +39,13 @@ public class BarrelAccessEvent extends BarrelEvent implements Cancellable {
return clickedBlock;
}
/**
* Get the clicked Block Face when clicking on the Barrel Block
*/
public BlockFace getClickedBlockFace() {
return clickedBlockFace;
}
@Override
public boolean isCancelled() {
return isCancelled;