Commits

md_5 authored dde0ff02083
SPIGOT-8001: Add BlockBrushEvent
No tags

src/main/java/org/bukkit/event/block/BlockBrushEvent.java

Added
1 +package org.bukkit.event.block;
2 +
3 +import org.bukkit.block.Block;
4 +import org.bukkit.block.BlockState;
5 +import org.bukkit.entity.Player;
6 +import org.bukkit.event.Cancellable;
7 +import org.bukkit.event.HandlerList;
8 +import org.jetbrains.annotations.ApiStatus;
9 +import org.jetbrains.annotations.NotNull;
10 +
11 +/**
12 + * Called when a block is brushed by a player.
13 + */
14 +@ApiStatus.Experimental
15 +public class BlockBrushEvent extends BlockEvent implements Cancellable {
16 +
17 + private static final HandlerList handlers = new HandlerList();
18 + private final Player player;
19 + private final BlockState newState;
20 + private boolean cancel;
21 +
22 + public BlockBrushEvent(@NotNull final Block theBlock, @NotNull final BlockState newState, @NotNull final Player player) {
23 + super(theBlock);
24 +
25 + this.newState = newState;
26 + this.player = player;
27 + }
28 +
29 + /**
30 + * Gets the Player that is brushing the block involved in this event.
31 + *
32 + * @return The Player that is brushing the block involved in this event
33 + */
34 + @NotNull
35 + public Player getPlayer() {
36 + return player;
37 + }
38 +
39 + /**
40 + * Gets the state of the block that this block will turn into.
41 + *
42 + * @return The block state that the block will become
43 + */
44 + @NotNull
45 + public BlockState getNewState() {
46 + return newState;
47 + }
48 +
49 + @Override
50 + public boolean isCancelled() {
51 + return cancel;
52 + }
53 +
54 + @Override
55 + public void setCancelled(boolean cancel) {
56 + this.cancel = cancel;
57 + }
58 +
59 + @Override
60 + @NotNull
61 + public HandlerList getHandlers() {
62 + return handlers;
63 + }
64 +
65 + @NotNull
66 + public static HandlerList getHandlerList() {
67 + return handlers;
68 + }
69 +}

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut