Commits
md_5 authored dde0ff02083
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 + | 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( final Block theBlock, final BlockState newState, 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 + | |
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 + | |
45 + | public BlockState getNewState() { |
46 + | return newState; |
47 + | } |
48 + | |
49 + | |
50 + | public boolean isCancelled() { |
51 + | return cancel; |
52 + | } |
53 + | |
54 + | |
55 + | public void setCancelled(boolean cancel) { |
56 + | this.cancel = cancel; |
57 + | } |
58 + | |
59 + | |
60 + | |
61 + | public HandlerList getHandlers() { |
62 + | return handlers; |
63 + | } |
64 + | |
65 + | |
66 + | public static HandlerList getHandlerList() { |
67 + | return handlers; |
68 + | } |
69 + | } |