Search in sources :

Example 1 with BlockTransformEvent

use of pl.themolka.arcade.event.BlockTransformEvent in project Arcade2 by ShootGame.

the class BlockTransformListeners method post.

private boolean post(Event cause, Block block, BlockState oldState, BlockState newState, Player bukkit, boolean cancel) {
    ArcadePlayer player = null;
    if (bukkit != null) {
        player = this.plugin.getPlayer(bukkit);
    }
    BlockTransformEvent event = new BlockTransformEvent(this.plugin, block, cause, newState, oldState, player);
    this.plugin.getEventBus().publish(event);
    boolean canceled = cancel && event.isCanceled() && cause instanceof Cancellable;
    if (canceled) {
        ((Cancellable) cause).setCancelled(true);
    }
    return event.isCanceled();
}
Also used : ArcadePlayer(pl.themolka.arcade.session.ArcadePlayer) Cancellable(org.bukkit.event.Cancellable) BlockTransformEvent(pl.themolka.arcade.event.BlockTransformEvent)

Aggregations

Cancellable (org.bukkit.event.Cancellable)1 BlockTransformEvent (pl.themolka.arcade.event.BlockTransformEvent)1 ArcadePlayer (pl.themolka.arcade.session.ArcadePlayer)1