package com.laytonsmith.abstraction.bukkit.entities;

import com.laytonsmith.abstraction.AbstractionObject;
import com.laytonsmith.abstraction.entities.MCEnderDragon;
import com.laytonsmith.abstraction.enums.MCEnderDragonPhase;
import com.laytonsmith.abstraction.enums.bukkit.BukkitMCEnderDragonPhase;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;

public class BukkitMCEnderDragon extends BukkitMCComplexLivingEntity implements MCEnderDragon {

	EnderDragon ed;

	public BukkitMCEnderDragon(Entity ent) {
		super(ent);
		ed = (EnderDragon) ent;
	}

	public BukkitMCEnderDragon(AbstractionObject ao) {
		this((EnderDragon) ao.getHandle());
	}

	@Override
	public EnderDragon getHandle() {
		return ed;
	}

	@Override
	public MCEnderDragonPhase getPhase() {
		return BukkitMCEnderDragonPhase.getConvertor().getAbstractedEnum(ed.getPhase());
	}

	@Override
	public void setPhase(MCEnderDragonPhase phase) {
		try {
			ed.setPhase(BukkitMCEnderDragonPhase.getConvertor().getConcreteEnum(phase));
		} catch(NoSuchMethodError ex) {
			// probably prior to 1.9.2
		}
	}
}
@@ -784,22 +784,16 @@
 %09return 
-Bukkit
 MCEnderD
@@ -807,40 +807,15 @@
 ase.
-getConvertor().getAbstractedEnum
+valueOf
 (ed.
@@ -824,16 +824,23 @@
 tPhase()
+.name()
 );%0A%09%7D%0A%0A%09

Fix support for versions prior to 1.9