use of org.bukkit.event.entity.EnderDragonChangePhaseEvent in project Arclight by IzzelAliz.
the class PhaseManagerMixin method setPhase.
// @formatter:on
/**
* @author IzzelAliz
* @reason
*/
@Overwrite
public void setPhase(PhaseType<?> phaseIn) {
if (this.phase == null || phaseIn != this.phase.getType()) {
if (this.phase != null) {
this.phase.removeAreaEffect();
}
EnderDragonChangePhaseEvent event = new EnderDragonChangePhaseEvent((CraftEnderDragon) ((EntityBridge) this.dragon).bridge$getBukkitEntity(), (this.phase == null) ? null : CraftEnderDragon.getBukkitPhase(this.phase.getType()), CraftEnderDragon.getBukkitPhase(phaseIn));
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
phaseIn = CraftEnderDragon.getMinecraftPhase(event.getNewPhase());
this.phase = this.getPhase(phaseIn);
if (!this.dragon.world.isRemote) {
this.dragon.getDataManager().set(EnderDragonEntity.PHASE, phaseIn.getId());
}
LOGGER.debug("Dragon is now in phase {} on the {}", phaseIn, this.dragon.world.isRemote ? "client" : "server");
this.phase.initPhase();
}
}
Aggregations