org.bukkit.event.block.BlockEvent Java Examples

The following examples show how to use org.bukkit.event.block.BlockEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlockEventHandler.java    From GriefDefender with MIT License 6 votes vote down vote up
private boolean handleBlockBreak(BlockEvent event, Location location, GDClaim claim, Object source, Object target, GDPermissionUser user, boolean sendDenyMessage) {
    // check overrides
    final Tristate result = GDPermissionManager.getInstance().getFinalPermission(event, location, claim, Flags.BLOCK_BREAK, source, target, user, TrustTypes.BUILDER, true);
    if (result == Tristate.FALSE) {
        if (sendDenyMessage && user != null) {
            final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PERMISSION_BUILD,
                    ImmutableMap.of(
                    "player", claim.getOwnerDisplayName()
            ));
            final Player player = Bukkit.getPlayer(user.getUniqueId());
            if (player != null && player.isOnline()) {
                GriefDefenderPlugin.sendClaimDenyMessage(claim, (Player) player, message);
            }
        }

        return true;
    }

    return false;
}