#723: Implement EntitySpellCastEvent for spellcaster illager

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
CraftBukkit/Spigot
2020-08-15 09:12:20 +10:00
parent c9673f0556
commit d44eec6c38
3 changed files with 34 additions and 2 deletions

View File

@@ -23,13 +23,21 @@ public class CraftSpellcaster extends CraftIllager implements Spellcaster {
@Override
public Spell getSpell() {
return Spell.valueOf(getHandle().getSpell().name());
return toBukkitSpell(getHandle().getSpell());
}
@Override
public void setSpell(Spell spell) {
Preconditions.checkArgument(spell != null, "Use Spell.NONE");
getHandle().setSpell(EntityIllagerWizard.Spell.a(spell.ordinal()));
getHandle().setSpell(toNMSSpell(spell));
}
public static Spell toBukkitSpell(EntityIllagerWizard.Spell spell) {
return Spell.valueOf(spell.name());
}
public static EntityIllagerWizard.Spell toNMSSpell(Spell spell) {
return EntityIllagerWizard.Spell.a(spell.ordinal());
}
}