Added creeper

This commit is contained in:
LCastr0 2017-04-30 11:47:57 -03:00
parent 08150b2c0f
commit 95e4170cc1

View File

@ -1,14 +1,20 @@
package mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.LivingEntity;
import mineplex.core.common.Rank;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.wineffect.rankrooms.WinEffectRankBased;
public class WinEffectRankUltra extends WinEffectRankBased
{
private DisguisePlayer _npc;
private Creeper _creeper;
public WinEffectRankUltra(GadgetManager manager)
{
super(manager, Rank.ULTRA, WinEffectType.RANK_WIN_EFFECT);
@ -17,13 +23,21 @@ public class WinEffectRankUltra extends WinEffectRankBased
@Override
public void play()
{
Bukkit.broadcastMessage("Playing effect win effect ultra: " + getName());
Location loc = getBaseLocation();
loc.setDirection(_player.getLocation().subtract(loc).toVector());
_npc = getNPC(getPlayer(), loc);
_creeper = loc.getWorld().spawn(loc.add(loc.getDirection().multiply(-3)), Creeper.class);
_creeper.setPowered(true);
_creeper.setTarget((LivingEntity) _npc.getEntity().getBukkitEntity());
}
@Override
public void finish()
{
Bukkit.broadcastMessage("Playing effect win effect ultra: " + getName());
if (!_creeper.isDead())
_creeper.remove();
}
}