/
NPCSpawnEvent.java
61 lines (50 loc) · 1.33 KB
/
NPCSpawnEvent.java
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
package net.citizensnpcs.api.event;
import org.bukkit.Location;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import net.citizensnpcs.api.npc.NPC;
/**
* Called when an NPC spawns.
*/
public class NPCSpawnEvent extends NPCEvent implements Cancellable {
private boolean cancelled = false;
private final Location location;
private final SpawnReason reason;
public NPCSpawnEvent(NPC npc, Location location, SpawnReason reason) {
super(npc);
this.location = location;
this.reason = reason;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
/**
* Gets the location where the NPC was spawned.
*
* @return Location where the NPC was spawned
*/
public Location getLocation() {
return location;
}
/**
* Gets the reason for spawning the NPC.
*
* @return Reason for spawning the NPC
*/
public SpawnReason getReason() {
return reason;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
public static HandlerList getHandlerList() {
return handlers;
}
private static final HandlerList handlers = new HandlerList();
}