Java Code Examples for org.bukkit.block.BlockState.getBlock()

The following are Jave code examples for showing how to use getBlock() of the org.bukkit.block.BlockState class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ProjectAres   File:   Source Code and License Vote up 6 votes
private void disturb(long pos, BlockState blockState, @Nullable ParticipantState disturber) {
    FallingBlocksRule rule = this.ruleWithShortestDelay(blockState);
    if(rule != null) {
        long tick = this.getMatch().getClock().now().tick + rule.delay;
        TLongObjectMap<ParticipantState> blockDisturbers = this.blockDisturbersByTick.get(tick);

        if(blockDisturbers == null) {
            blockDisturbers = new TLongObjectHashMap<>();
            this.blockDisturbersByTick.put(tick, blockDisturbers);

        Block block = blockState.getBlock();
        if(!blockDisturbers.containsKey(pos)) {
            blockDisturbers.put(pos, disturber);
Example 2
Project: ProjectAres   File:   Source Code and License Vote up 6 votes
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockChange(BlockTransformEvent event) {
    BlockState newState = event.getNewState();
    Block block = newState.getBlock();
    long pos = encodePos(block);

    // Only breaks are credited. Making a bridge fall by updating a block
    // does not credit you with breaking the bridge.
    ParticipantState breaker = event.isBreak() ? ParticipantBlockTransformEvent.getPlayerState(event) : null;

    if(!(event.getCause() instanceof BlockFallEvent)) {
        this.disturb(pos, newState, breaker);

    for(BlockFace face : NEIGHBORS) {
        this.disturb(neighborPos(pos, face), block.getRelative(face).getState(), breaker);
Example 3
Project: ProjectAres   File:   Source Code and License Vote up 4 votes
public BlockTransformEvent(Event cause, BlockState oldState, BlockState newState) {
    this(cause, oldState.getBlock(), oldState, newState);