File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
core/src/main/java/com/nisovin/magicspells/spells/targeted Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .nisovin .magicspells .spells .targeted ;
2+
3+ import org .bukkit .entity .Player ;
4+ import org .bukkit .entity .LivingEntity ;
5+
6+ import com .nisovin .magicspells .util .*;
7+ import com .nisovin .magicspells .spells .TargetedSpell ;
8+ import com .nisovin .magicspells .spells .TargetedEntitySpell ;
9+
10+ public class EntityRemoveSpell extends TargetedSpell implements TargetedEntitySpell {
11+
12+ public EntityRemoveSpell (MagicConfig config , String spellName ) {
13+ super (config , spellName );
14+ }
15+
16+ @ Override
17+ public CastResult cast (SpellData data ) {
18+ TargetInfo <LivingEntity > info = getTargetedEntity (data );
19+ if (info .noTarget ()) return noTarget (info );
20+
21+ return castAtEntity (info .spellData ());
22+ }
23+
24+ @ Override
25+ public CastResult castAtEntity (SpellData data ) {
26+ if (!data .hasTarget () || data .target () instanceof Player ) return noTarget (data );
27+
28+ data .target ().remove ();
29+
30+ playSpellEffects (data );
31+ return new CastResult (PostCastAction .HANDLE_NORMALLY , data );
32+ }
33+
34+ }
You can’t perform that action at this time.
0 commit comments