Commits
Parker Hawke authored and md_5 committed 61303b478cf
1 + | package org.bukkit.event.entity; |
2 + | |
3 + | import org.bukkit.entity.Spellcaster; |
4 + | import org.bukkit.event.Cancellable; |
5 + | import org.bukkit.event.HandlerList; |
6 + | import org.jetbrains.annotations.NotNull; |
7 + | |
8 + | /** |
9 + | * Called when a {@link Spellcaster} casts a spell. |
10 + | */ |
11 + | public class EntitySpellCastEvent extends EntityEvent implements Cancellable { |
12 + | |
13 + | private static final HandlerList handlers = new HandlerList(); |
14 + | // |
15 + | private boolean cancelled = false; |
16 + | private final Spellcaster.Spell spell; |
17 + | |
18 + | public EntitySpellCastEvent( Spellcaster what, Spellcaster.Spell spell) { |
19 + | super(what); |
20 + | this.spell = spell; |
21 + | } |
22 + | |
23 + | |
24 + | |
25 + | public Spellcaster getEntity() { |
26 + | return (Spellcaster) entity; |
27 + | } |
28 + | |
29 + | /** |
30 + | * Get the spell to be cast in this event. |
31 + | * |
32 + | * This is a convenience method equivalent to |
33 + | * {@link Spellcaster#getSpell()}. |
34 + | * |
35 + | * @return the spell to cast |
36 + | */ |
37 + | |
38 + | public Spellcaster.Spell getSpell() { |
39 + | return spell; |
40 + | } |
41 + | |
42 + | |
43 + | public void setCancelled(boolean cancelled) { |
44 + | this.cancelled = cancelled; |
45 + | } |
46 + | |
47 + | |
48 + | public boolean isCancelled() { |
49 + | return cancelled; |
50 + | } |
51 + | |
52 + | |
53 + | |
54 + | public HandlerList getHandlers() { |
55 + | return handlers; |
56 + | } |
57 + | |
58 + | |
59 + | public static HandlerList getHandlerList() { |
60 + | return handlers; |
61 + | } |
62 + | } |