This commit is contained in:
Chiss 2013-11-23 09:28:27 +11:00
parent a5a80378f7
commit 42cab3a39c
2 changed files with 28 additions and 35 deletions

View File

@ -1131,17 +1131,4 @@ public class HungerGames extends SoloGame
{
event.SetDamageToLevel(false);
}
@EventHandler
public void Firework(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() != UpdateType.SEC)
return;
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.YELLOW).with(Type.BALL).trail(false).build();
UtilFirework.playFirework(GetSpectatorLocation(), effect);
}
}

View File

@ -34,6 +34,7 @@ public class PerkSkeletons extends Perk
private HashMap<Player, ArrayList<Skeleton>> _minions = new HashMap<Player, ArrayList<Skeleton>>();
private boolean _name;
private int _maxDist = 8;
public PerkSkeletons(boolean name)
{
@ -112,6 +113,20 @@ public class PerkSkeletons extends Perk
if (_minions.get(event.getTarget()).contains(event.getEntity()))
event.setCancelled(true);
for (Player player : _minions.keySet())
{
for (Skeleton skel : _minions.get(player))
{
if (event.getEntity().equals(skel))
{
if (UtilMath.offset(skel, player) > _maxDist)
{
}
}
}
}
}
@EventHandler
@ -137,19 +152,11 @@ public class PerkSkeletons extends Perk
//Return to Owner
double range = 4;
if (skel.getTarget() != null)
if (skel.getTarget() != null || ((CraftSkeleton)skel).getHandle().getGoalTarget() != null)
{
range = 8;
System.out.println("A: " + UtilEnt.getName(skel.getTarget()));
range = _maxDist;
}
if (((CraftSkeleton)skel).getHandle().getGoalTarget() != null)
{
range = 8;
System.out.println("B: " + ((CraftSkeleton)skel).getHandle().getGoalTarget());
}
if (UtilMath.offset(skel, player) > range)
{
float speed = 1f;
@ -157,15 +164,14 @@ public class PerkSkeletons extends Perk
speed = 1.4f;
//Move
Location target = skel.getLocation().add(UtilAlg.getTrajectory(skel, player).multiply(3));
EntityCreature ec = ((CraftCreature)skel).getHandle();
Navigation nav = ec.getNavigation();
Location target = player.getLocation().add(UtilAlg.getTrajectory(player, skel));
nav.a(target.getX(), target.getY(), target.getZ(), speed);
skel.setTarget(null);
((CraftSkeleton)skel).getHandle().setGoalTarget(null);
System.out.println("OUT OF RANGE! RETURN HOME MY FRIEND");
}
}
}