Java 类org.bukkit.entity.Witch 实例源码

项目:SurvivalAPI    文件:NaturalListener.java   
/**
 * Patching witch's potions
 *
 * @param event Event
 */
@EventHandler
public void onPotionSplash(PotionSplashEvent event)
{
    ThrownPotion potion = event.getPotion();

    if (potion.getShooter() instanceof Witch)
    {
        event.setCancelled(true);

        List<PotionEffectType> potionEffects = new ArrayList<>();
        potionEffects.add(PotionEffectType.SLOW_DIGGING);
        potionEffects.add(PotionEffectType.CONFUSION);
        potionEffects.add(PotionEffectType.NIGHT_VISION);
        potionEffects.add(PotionEffectType.HUNGER);
        potionEffects.add(PotionEffectType.BLINDNESS);

        PotionEffect selected = new PotionEffect(potionEffects.get(new Random().nextInt(potionEffects.size())), 20 * 15, 1);

        for (LivingEntity ent : event.getAffectedEntities())
            ent.addPotionEffect(selected);
    }
}
项目:BendingExp    文件:DeathByBendingListener.java   
@EventHandler
public void onEntityBendingDeath(EntityBendingDeathEvent event) {
    Entity v = event.getVictim();
    Element e = CoreAbility.getAbility(event.getAbility()).getElement();
    int xp;

    if(v == null || e == null)
        return;

    if(v instanceof Player) {
        xp = 25 + (int)(Math.random() * ((35 - 25) + 1));
    }
    else if(v instanceof Zombie || v instanceof Creeper || v instanceof Witch || v instanceof Skeleton || v instanceof Guardian || v instanceof Spider) {
        xp = 13 + (int)(Math.random() * ((22 - 13) + 1));
    }
    else {
        xp = 3 + (int)(Math.random() * ((8 - 3) + 1));
    }
    BendingExp.addExp(event.getAttacker(), e, xp);
}
项目:tregmine    文件:GrinchSpawnSpeech.java   
public static void speech(final Player p, final Witch witch, final Location loc){
       BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
       scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
        @Override
        public void run() {
            p.sendMessage(string1);
            speechPt2(p, witch, loc);
        }
       }, 60L);
}
项目:tregmine    文件:GrinchSpawnSpeech.java   
public static void speechPt2(final Player p, final Witch witch, final Location loc){
       BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
       scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
        @Override
        public void run() {
            p.sendMessage(string2);
            speechPt3(p, witch, loc);
        }
       }, 60L);
}
项目:tregmine    文件:GrinchSpawnSpeech.java   
public static void speechPt3(final Player p, final Witch witch, final Location loc){
       BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
       scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
        @Override
        public void run() {
            p.sendMessage(string3);
            speechPt4(p, witch, loc);
        }
       }, 60L);
}
项目:tregmine    文件:GrinchSpawnSpeech.java   
public static void speechPt4(final Player p, final Witch witch, final Location loc){
       BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
       scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
        @Override
        public void run() {
            p.sendMessage(string4);
            speechPt5(p, witch, loc);
        }
       }, 60L);
}
项目:tregmine    文件:GrinchSpawnSpeech.java   
public static void speechPt5(final Player p, final Witch witch, final Location loc){
       BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
       scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
        @Override
        public void run() {
            p.sendMessage(string5);
            speechPt6(p, witch, loc);
        }
       }, 60L);
}
项目:tregmine    文件:GrinchSpawnSpeech.java   
public static void speechPt6(final Player p, final Witch witch, final Location loc){
       BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
       scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
        @Override
        public void run() {
            p.sendMessage(string6);
            speechPt7(p, witch, loc);
        }
       }, 60L);
}
项目:tregmine    文件:GrinchSpawnSpeech.java   
public static void speechPt7(final Player p, final Witch witch, final Location loc){
       BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
       scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
        @Override
        public void run() {
            p.sendMessage(string7);
            speechPt8(p, witch, loc);
        }
       }, 60L);
}
项目:tregmine    文件:GrinchSpawnSpeech.java   
public static void speechPt8(final Player p, final Witch witch, final Location loc){
       BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
       scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
        @Override
        public void run() {
            p.sendMessage(string8);
            speechPt9(p, witch, loc);
        }
       }, 60L);
}
项目:tregmine    文件:GrinchSpawnSpeech.java   
public static void speechPt9(final Player p, final Witch witch, final Location loc){
       BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
       scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
        @Override
        public void run() {
            p.sendMessage(string9);
            witch.remove();
            GrinchListener.createTornado(loc.subtract(0,1,0), p);
        }
       }, 60L);
}
项目:tregmine    文件:GrinchListener.java   
public static void spawnGrinchWitch(final Player p, final Block b){
    final Location bLoc = b.getLocation().add(0,1,0);
    final World w = p.getWorld();

    final Witch witch = (Witch)w.spawnEntity(bLoc, EntityType.WITCH);
    witch.setCanPickupItems(false);
    witch.setCustomName(ChatColor.GREEN + "The Grinch!");
    witch.setRemoveWhenFarAway(false);
    witch.setMaxHealth(200.0);
    witch.setHealth(200.0);
    witch.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100000, 100000));

    GrinchSpawnSpeech.speech(p, witch, bLoc);
}
项目:CanaryBukkit    文件:CanaryWitch.java   
public CanaryWitch(net.canarymod.api.entity.living.monster.Witch entity) {
    super(entity);
}
项目:PvPTeleport    文件:WorldCommand.java   
/** Checks that player is not trying to combatlog/is allowed to teleport
 * Returns an error message to be displayed if the player is not allowed
 * to teleport
 * Returns null if the player is allowed to teleport
 */
private static String teleportCheck(Player player) {

    Location pLoc = player.getLocation();

    World world = player.getWorld();

    /* Check if there are any players within 50 blocks */
    for (Player p : world.getPlayers()) {

        if (!p.equals(player)
                && p.getLocation().distance(pLoc) < 50
                && player.canSee(p)
                && !p.isDead()) {
            return ChatColor.RED + "You cannot use this command while within 50 blocks of any other players.";
        }

    }

    /* Check if there are any hostile mobs within 5 blocks */
    for (Entity entity : world.getEntitiesByClasses(
                Blaze.class,
                CaveSpider.class,
                Creeper.class,
                Enderman.class,
                Ghast.class,
                MagmaCube.class,
                PigZombie.class,
                Skeleton.class,
                Silverfish.class,
                Slime.class,
                Spider.class,
                Witch.class,
                Zombie.class)) {

        if (entity.getLocation().distance(pLoc) < 5) {
            return ChatColor.RED + "You cannot use this command while within 5 blocks of any hostile mobs.";
        }

    }

    /* Check if the player is falling */
    if (player.getVelocity().getY() < -0.079
            || player.getVelocity().getY() > 0.08) {
        return ChatColor.RED + "You cannot use this command while falling.";
    }

    /* Check if the player is burning */
    if (player.getFireTicks() > 0
            && !player.hasPotionEffect(
                PotionEffectType.FIRE_RESISTANCE)) {
        return ChatColor.RED + "You cannot use this command while on fire.";
    }

    /* Default to allow teleport */
    return null;

}
项目:EndHQ-Libraries    文件:RemoteWitch.java   
public RemoteWitch(int inID, EntityManager inManager)
{
    super(inID, RemoteEntityType.Witch, inManager);
}