Christmas hub snowman target cancel

This commit is contained in:
Chiss 2013-12-18 19:58:39 +11:00
parent de99a642d3
commit 54f2cb3467
2 changed files with 15 additions and 3 deletions

View File

@ -516,18 +516,20 @@ public class UtilEnt
} }
} }
public static void CreatureMoveFast(Entity ent, Location target, float speed) public static boolean CreatureMoveFast(Entity ent, Location target, float speed)
{ {
if (!(ent instanceof Creature)) if (!(ent instanceof Creature))
return; return false;
if (UtilMath.offset(ent.getLocation(), target) < 0.1) if (UtilMath.offset(ent.getLocation(), target) < 0.1)
return; return false;
if (UtilMath.offset(ent.getLocation(), target) < 2) if (UtilMath.offset(ent.getLocation(), target) < 2)
speed = Math.min(speed, 1f); speed = Math.min(speed, 1f);
EntityCreature ec = ((CraftCreature)ent).getHandle(); EntityCreature ec = ((CraftCreature)ent).getHandle();
ec.getControllerMove().a(target.getX(), target.getY(), target.getZ(), speed); ec.getControllerMove().a(target.getX(), target.getY(), target.getZ(), speed);
return true;
} }
} }

View File

@ -37,6 +37,7 @@ import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.LeavesDecayEvent; import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
@ -272,4 +273,13 @@ public class WorldManager extends MiniPlugin
{ {
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler
public void CreatureTarget(EntityTargetEvent event)
{
if (Manager.Mode.equals("Christmas"))
{
event.setCancelled(true);
}
}
} }