forked from espidev/ProtectionStones
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPSBreakProtectBlockEvent.java
More file actions
75 lines (61 loc) · 1.73 KB
/
PSBreakProtectBlockEvent.java
File metadata and controls
75 lines (61 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package dev.espi.protectionstones.event;
import dev.espi.protectionstones.PSRegion;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Event that is called when a protection stones block is removed
*/
public class PSBreakProtectBlockEvent extends Event implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
private PSRegion region;
private Player player;
private boolean isCancelled = false;
public PSBreakProtectBlockEvent(PSRegion psr, Player player) {
this.region = checkNotNull(psr);
this.player = player;
}
/**
* Gets the player who triggered the event.
*
* @return The player.
*/
public Player getPlayer() {
return player;
}
/**
* Gets the ProtectionStones item associated with the region.
*
* @return The ProtectionStones item.
*/
public ItemStack getPSItem() {
return Objects.requireNonNull(region.getTypeOptions()).createItem();
}
/**
* Gets the ProtectionStones region associated with the event.
*
* @return The ProtectionStones region.
*/
public PSRegion getRegion() {
return region;
}
@Override
public boolean isCancelled() {
return isCancelled;
}
@Override
public void setCancelled(boolean cancel) {
isCancelled = cancel;
}
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}