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

项目:WC    文件:WorldInteract.java   
@EventHandler
public void onMobDie(EntityDeathEvent e){
    AllItems items = new AllItems();
    Location l = e.getEntity().getLocation();
    World w = l.getWorld();

    e.getDrops().clear();
    e.setDroppedExp(0);

    if (e.getEntity() instanceof Zombie){
        if (new Random().nextInt(5) >= 3){
            w.dropItemNaturally(l, new ItemMaker(Material.EMERALD).setAmount(new Random().nextInt(4) + 1).build());
            if (new Random().nextBoolean()){
                w.dropItemNaturally(l, items.weapons.get(new Random().nextInt(items.weapons.size())));
            } else {
                w.dropItemNaturally(l, items.health.get(new Random().nextInt(items.health.size())));
            }
        }
    }

    if (e.getEntity() instanceof Giant){
        if (new Random().nextInt(5) > 3){
            w.dropItemNaturally(l, new ItemMaker(Material.NETHER_STAR).setAmount(new Random().nextInt(4) + 1).build());
        }
    }
}
项目:Debuggery    文件:InputFormatterTest.java   
@Test
public void testBukkitClasses() throws InputException {
    Class[] inputTypes = {Class[].class};
    String[] input = {"Zombie,Creeper,Pig"};

    Object[] output = InputFormatter.getTypesFromInput(inputTypes, Arrays.asList(input), null);

    // First let's make sure we didn't lose anything, or get anything
    assertEquals(inputTypes.length, output.length);

    // Next let's make sure everything is the right type
    for (Object object : output) {
        assertTrue(object instanceof Class[]);
    }

    // Finally, let's make sure the values are correct
    Class[] classes = (Class[]) output[0];
    assertEquals(classes[0], Zombie.class);
    assertEquals(classes[1], Creeper.class);
    assertEquals(classes[2], Pig.class);
}
项目:Kineticraft    文件:Pinata.java   
private void spawnZombie() {
    Location center = new Location(Parties.getPartyWorld(), -74.5, 76, 30);
    Zombie z = center.getWorld().spawn(Utils.scatter(center, 4, 0, 4), Zombie.class);
    z.setCustomNameVisible(true);
    z.setCustomName(ChatColor.RED + "Piñata");

    z.getEquipment().setHelmet(ItemManager.createSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZn"
                    + "QubmV0L3RleHR1cmUvM2IyNTI2NmQ0MGNlY2Q5M2QwNTMxNTZlNGE0YTc4NDE0MGQwMzQyNTVjNzIxY2MzNzVkMWMzNjQ4MzQyYjZmZCJ9fX0",
            "Pinata Skull", "He doesn't want to party anymore."));
    z.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
    z.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
    z.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
    z.getEquipment().setItemInMainHand(ItemManager.createItem(Material.STICK, ChatColor.RED + "Pinata Bat", ChatColor.DARK_PURPLE + "Stop hitting me!"));
    z.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(40);
    z.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(.4F);
    z.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).setBaseValue(6);
    z.getAttribute(Attribute.GENERIC_KNOCKBACK_RESISTANCE).setBaseValue(1);
    z.setSilent(true);
    z.setGlowing(true);
    getScheduler().runTaskLater(z::remove, 1200L); // Remove zombie in 1 minute.
}
项目:Kineticraft    文件:Pinata.java   
@EventHandler
public void onEntityDeath(EntityDeathEvent evt) { // If a pinata is killed, have a 12% chance of dropping something extra.
    if (evt.getEntity() instanceof Zombie && getArena().contains(evt.getEntity().getLocation()) && Utils.randChance(8))
        evt.getDrops().add(Utils.randElement(
                ItemManager.createItem(Material.DIAMOND, ChatColor.AQUA + "Rock Candy", "So delicious, so rare."),
                ItemManager.createItem(Material.CAKE, ChatColor.LIGHT_PURPLE + "Birthday Cake", "Happy 3rd Anniversary, Kineticraft!"),
                ItemManager.createItem(Material.SEA_LANTERN, ChatColor.RED + "Jaw Breaker", "Suck it, Piñatas!"),
                ItemManager.createItem(Material.IRON_BLOCK, ChatColor.RED + "Hershey's Kiss", "Mmmm, so chocolatey."),
                ItemManager.createItem(Material.TNT, ChatColor.LIGHT_PURPLE + "Pop Rocks", "An explosion for your taste buds."),
                ItemManager.createItem(Material.MAGMA_CREAM, ChatColor.RED + "Atomic Fireball", "It burns so good."),
                ItemManager.createItem(Material.EXP_BOTTLE, ChatColor.AQUA + "Soda", "Refreshing and fizzy."),
                ItemManager.createItem(Material.SLIME_BALL, ChatColor.AQUA + "Taffy", "Chewy...careful not to glue your teeth together!"),
                ItemManager.createItem(Material.NETHER_STALK, ChatColor.RED + "Twizzlers", "Gimme some sugar."),
                ItemManager.createItem(Material.MYCEL, ChatColor.RED + "Fudge", "What the fudge!?"),
                ItemManager.createItem(Material.WEB, ChatColor.LIGHT_PURPLE + "Cotton Candy", "So fluffy!"),
                ItemManager.createItem(Material.RAW_FISH, (byte) 1, ChatColor.LIGHT_PURPLE + "Swedish Fish", "A yummy, gummy candy."),
                ItemManager.createItem(Material.RED_ROSE, (byte) 2, ChatColor.AQUA + "Lollipop", "I'm a sucker for puns."),
                ItemManager.createItem(Material.COOKIE, ChatColor.YELLOW + "Birthday Cookie", "You're one smart cookie!"),
                ItemManager.createItem(Material.BLAZE_ROD, ChatColor.RED + "Hot Tamale", "You're one hot Tamale!"),
                ItemManager.createItem(Material.PUMPKIN_PIE, ChatColor.GOLD + "Seasonal Treat", "Pumpkin Spice flavor ALL THE THINGS!"),
                ItemManager.createItem(Material.EMERALD, ChatColor.GREEN + "Gumball", "I chews you! <3"),
                ItemManager.createItem(Material.GOLDEN_APPLE, ChatColor.GOLD + "Caramel Apple", "...and we lived apple-y ever after <3"),
                ItemManager.createItem(Material.HUGE_MUSHROOM_2, ChatColor.RED + "Strawberry Bon Bon", "You're the berry best."),
                evt.getEntity().getEquipment().getHelmet(),
                evt.getEntity().getEquipment().getItemInMainHand()));
}
项目:UHC    文件:JoinQuitHandlers.java   
@EventHandler
public void leave(final PlayerQuitEvent event) {
    if(GameState.current() != GameState.LOBBY && event.getPlayer().getGameMode() != GameMode.SPECTATOR){
        event.setQuitMessage(colour("&6" + event.getPlayer().getName() + " has quit! " +
                "They have " + UHC.getInstance().getMainConfig().getDisconnectGracePeriodSeconds() + "s to reconnect."));

        bukkitRunnable(() -> disqualified(event.getPlayer().getUniqueId(), event.getPlayer().getName(),
                event.getPlayer().getLocation(), event.getPlayer().getInventory())).runTaskLater(UHC.getInstance(),
                TimeUnit.MILLISECONDS.convert(UHC.getInstance().getMainConfig().getDisconnectGracePeriodSeconds(), TimeUnit.SECONDS));

        //Zombie Spawning
        Zombie zombie = (Zombie) event.getPlayer().getWorld().spawnEntity(event.getPlayer().getLocation(), EntityType.ZOMBIE);
        zombie.setCustomName(event.getPlayer().getName());
        zombie.setCustomNameVisible(true);
        //TODO Make no AI and invulnerable cough cough Proxi cough cough
        deadRepresentatives.put(event.getPlayer().getUniqueId(), zombie);
    }
}
项目: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);
}
项目:Skellett    文件:EffBabyAdult.java   
@Override
protected void execute(Event e) {
    if (entity != null) {
        if (marker == 1) {
            if (Ageable.class.isAssignableFrom(entity.getSingle(e).getClass())) {
                ((Ageable)entity.getSingle(e)).setBaby();
            } else if (Zombie.class.isAssignableFrom(entity.getSingle(e).getClass())) {
                ((Zombie)entity.getSingle(e)).setBaby(true);
            }
        } else {
            if (Ageable.class.isAssignableFrom(entity.getSingle(e).getClass())) {
                ((Ageable)entity.getSingle(e)).setAdult();
            } else if (Zombie.class.isAssignableFrom(entity.getSingle(e).getClass())) {
                ((Zombie)entity.getSingle(e)).setBaby(false);
            }
        }
    }
}
项目:Skellett    文件:CondIsAdult.java   
public boolean check(Event e) {
    if (entity.getSingle(e) instanceof Ageable) {
        if (((Ageable)entity.getSingle(e)).isAdult()) {
            return isNegated();
        } else {
            return !isNegated();
        }
    } else if (entity.getSingle(e) instanceof Zombie) {
        if (((Zombie)entity.getSingle(e)).isBaby()) {
            return !isNegated();
        } else {
            return isNegated();
        }
    }
    return false;
}
项目:buildinggame    文件:BabyMenu.java   
/**
 * {@inheritDoc}
 */
public BabyMenu(Plot plot, Entity entity) {
    super(plot, entity);

    ItemStack baby = new ItemStack(Material.EGG);
    ItemMeta babyMeta = baby.getItemMeta();
    babyMeta.setDisplayName(ChatColor.GREEN + "Change to baby/adult");
    baby.setItemMeta(babyMeta);

    insertItem(baby, event -> {
        if (entity instanceof Ageable) {
            Ageable ageable = (Ageable) entity;
            if (ageable.isAdult())
                ageable.setBaby();
            else
                ageable.setAdult();
        } else if (entity instanceof Zombie) {
            Zombie zombie = (Zombie) entity;
            zombie.setBaby(!zombie.isBaby());
        }

        event.setCancelled(true);
    }, 0);
}
项目:defend-the-village    文件:Main.java   
@EventHandler(priority=EventPriority.HIGHEST)
public void onDeath(PlayerDeathEvent ev) {
    // Is the player in game?
    if (this.am.isInGame((Player)ev.getEntity())) {
        // Dont' drop anything
        ev.getDrops().clear();
        ev.setDeathMessage(null);

        // Find the arena were the player is playing
        for (Arena a : this.am.arenas) {
            if (a.players.contains(ev.getEntity().getName())) {
                for (Zombie z : a.zombies) {
                    // Send all the killer zombies to kill the villagers
                    if (z.getTarget().equals(ev.getEntity())) {
                        CraftZombie z2 = (CraftZombie) z;
                        z2.getHandle().setGoalTarget(((CraftLivingEntity) a.villagers.get(0)).getHandle());
                    }
                }
            }
        }
    }
}
项目:NSHC    文件:RandomEvents.java   
public void ZombieApoc() {
    for (Player pl : Bukkit.getOnlinePlayers()) {
        Bukkit.broadcastMessage(ChatColor.BOLD+""+ChatColor.RED+"The Zombie Appocolypse Has Begun!");
        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "time night");
        Location loc = pl.getLocation();
        Zombie zombie = (Zombie) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.ZOMBIE);
        Zombie zombie1 = (Zombie) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.ZOMBIE);
        Zombie zombie2 = (Zombie) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.ZOMBIE);
        Zombie zombie3 = (Zombie) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.ZOMBIE);
        Zombie zombie4 = (Zombie) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.ZOMBIE);
        Zombie zombie5 = (Zombie) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.ZOMBIE);
        Zombie zombie6 = (Zombie) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.ZOMBIE);
        Zombie zombie7 = (Zombie) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.ZOMBIE);
        Zombie zombie8 = (Zombie) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.ZOMBIE);
        Zombie zombie9 = (Zombie) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.ZOMBIE);
        Zombie zombie0 = (Zombie) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.ZOMBIE);         
    }

}
项目:killBaby    文件:KillBaby.java   
@EventHandler
public void onSpawn(CreatureSpawnEvent event) {
    if(event.isCancelled())
        return;
    LivingEntity c = event.getEntity();
    if(c instanceof Zombie)
    {
        Zombie a = (Zombie) c;

        if(a.isBaby())
        {
            a.setBaby(false);
            //a.remove();
        }

    }

    // Some code here
}
项目:ZvP    文件:DeathMatch.java   
@Override
   public void onDeath(ZvPPlayer player, PlayerDeathEvent event) {
super.onDeath(player, event);

this.playerDrops.put(player, new ArrayList<ItemStack>(event.getDrops()));
event.getDrops().clear();

Entity entitiy = getArena().getWorld().spawnEntity(player.getLocation(), EntityType.ZOMBIE);
if (entitiy != null) {
    getArena().getDifficultyTool().customizeEntity(entitiy);
}

ItemStack playerSkull = new ItemStack(Material.SKULL_ITEM);
playerSkull.setDurability((short) 3);
SkullMeta meta = (SkullMeta) playerSkull.getItemMeta();
meta.setOwner(player.getName());
playerSkull.setItemMeta(meta);

Zombie z = (Zombie) entitiy;
z.setBaby(false);
z.getEquipment().setHelmet(playerSkull);
z.setMaxHealth(2 * 20);
getArena().updatePlayerBoards();
   }
项目:ZvP    文件:DeathMatch.java   
@Override
   public void onZombieKill(ZvPPlayer attacker, Entity zombie, EntityDeathEvent event) {
super.onZombieKill(attacker, zombie, event);

Zombie z = (Zombie) zombie;
if (z.getEquipment().getHelmet().getType() == Material.SKULL_ITEM) {
    if (z.getEquipment().getHelmet().hasItemMeta() && z.getEquipment().getHelmet().getItemMeta() instanceof SkullMeta) {
    SkullMeta meta = (SkullMeta) z.getEquipment().getHelmet().getItemMeta();

    if (meta.hasOwner()) {
        ZvPPlayer player = GameManager.getManager().getPlayer(meta.getOwner());

        if (player != null) {
        if (this.playerDrops.containsKey(player)) {
            event.getDrops().clear();
            event.getDrops().addAll(this.playerDrops.get(player));
            this.playerDrops.remove(player);
        }
        }
    }
    }
}
   }
项目:EntityAPI    文件:ControllableVillagerBase.java   
@Override
public BehaviourItem[] getDefaultMovementBehaviours() {
    return new BehaviourItem[]{
            new BehaviourItem(0, new BehaviourFloat(this)),
            new BehaviourItem(1, new BehaviourAvoidEntity(this, Zombie.class, 8.0F, 0.6D, 0.6D)),
            new BehaviourItem(1, new BehaviourTradeWithPlayer(this)),
            new BehaviourItem(1, new BehaviourLookAtTradingPlayer(this)),
            new BehaviourItem(2, new BehaviourMoveIndoors(this)),
            new BehaviourItem(3, new BehaviourRestrictOpenDoor(this)),
            new BehaviourItem(4, new BehaviourOpenDoor(this, true)),
            new BehaviourItem(5, new BehaviourMoveTowardsRestriction(this, 0.6D)),
            new BehaviourItem(6, new BehaviourMakeLove(this)),
            new BehaviourItem(7, new BehaviourTakeFlower(this)),
            new BehaviourItem(8, new BehaviourVillagerPlay(this, 0.32D)),
            new BehaviourItem(9, new BehaviourInteract(this, HumanEntity.class, 3.0F, 1.0F)),
            new BehaviourItem(9, new BehaviourInteract(this, Villager.class, 3.0F, 1.0F)),
            new BehaviourItem(9, new BehaviourRandomStroll(this, 0.6D)),
            new BehaviourItem(10, new BehaviourLookAtNearestEntity(this, InsentientEntity.class, 8.0F))
    };
}
项目:RoyalSurvivors    文件:ZombieSpawner.java   
private static Zombie spawnZombieBase(Location l, int level) {
    synchronized (spawnLock) {
        World w = l.getWorld();
        if (getNumberMobs(w) > Config.maxMobs && Config.maxMobs > -1) {
            if (!Config.removeIfMax) return null;
            for (Entity e : w.getEntities()) {
                if (!(e instanceof Zombie) || e instanceof Player) continue;
                e.remove();
                break;
            }
        }
        net.minecraft.server.v1_7_R3.World world = ((CraftWorld) w).getHandle();
        SurvivorsZombie cz = new SurvivorsZombie(world, level);
        cz.setLocation(l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch());
        world.addEntity(cz, CreatureSpawnEvent.SpawnReason.CUSTOM);
        return new CraftZombie(world.getServer(), cz);
    }
}
项目:RoyalSurvivors    文件:ZombieSpawner.java   
public static void applyNameplate(Zombie z, double currentHealth, double maxHealth) {
    if (!Config.useNameplates) return;
    if (!RUtils.isInInfectedWorld(z)) return;
    final SurvivorsZombie cz = getSurvivorsZombie(z);
    if (cz == null) return;
    int level = cz.getLevel();
    if (level < 1) level = 1;
    if (level > 7) level = 7;
    String format = Config.nameplateFormat;
    format = format.replace("{currenthealth}", df.format(currentHealth));
    format = format.replace("{maxhealth}", df.format(maxHealth));
    format = format.replace("{currenthearts}", df.format(currentHealth / 2D));
    format = format.replace("{maxhearts}", df.format(maxHealth / 2D));
    format = format.replace("{level}", String.valueOf(level));
    if (format.length() > 32) format = format.substring(0, 32);
    z.setCustomName(format);
    z.setCustomNameVisible(Config.nameplateAlwaysVisible);
}
项目:RoyalSurvivors    文件:ZombieSpawner.java   
public static void applyZombieCharacteristics(Zombie z) {
    final SurvivorsZombie cz = getSurvivorsZombie(z);
    if (cz == null) return;
    int level = cz.getLevel();
    if (level < 1) level = 1;
    if (level > 7) level = 7;
    cz.setLevel(level);
    /*if (Config.useBabies && nextInt(1, Config.babyZombieChance) == Config.babyZombieChance - 1) {
        if (Config.babiesAlwaysFast)
            z.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, Config.babySpeedLevel));
        z.setBaby(true);
    }*/
    /*z.setMaxHealth(r.nextInt(20) + (nextInt(10, 20) * level));
    z.setHealth(z.getMaxHealth());*/
    setEntityEquipment(z.getEquipment(), level);
    /*if (level >= Config.minLevelPotion && Config.usePotions)
        if (nextInt(1, Config.potionChance) == Config.potionChance - 1) applyPotionEffects(z);
    if (Config.useSpeed)
        z.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, Config.speedBoostLevel));*/
    if (Config.useNameplates) applyNameplate(z);
}
项目:RoyalSurvivors    文件:SurvivorsListener.java   
@EventHandler
public void zombify(PlayerDeathEvent e) {
    Player p = e.getEntity();
    if (!RUtils.isInInfectedWorld(p)) return;
    if (!Config.spawnZombie) return;
    Zombie z = ZombieSpawner.spawnLeveledZombie(p.getLocation());
    if (z == null) return;
    EntityEquipment ze = z.getEquipment();
    EntityEquipment pe = p.getEquipment();
    if (ze == null || pe == null) return;
    ze.setArmorContents(pe.getArmorContents());
    ze.setHelmetDropChance(0F);
    ze.setChestplateDropChance(0F);
    ze.setLeggingsDropChance(0F);
    ze.setBootsDropChance(0F);
}
项目:RoyalSurvivors    文件:ZombieSpray.java   
@Override
public void run() {
    if (!Config.toxicEnabled) return;
    World w = plugin.getServer().getWorld(Config.worldToUse);
    if (w == null) return;
    for (Player p : w.getPlayers()) {
        PConfManager pcm = PConfManager.getPConfManager(p);
        if (!pcm.getBoolean("toxicspray_on", false)) continue;
        if (pcm.getLong("toxicspray_expire", 0L) <= System.currentTimeMillis()) {
            pcm.set("toxicspray_on", false);
            pcm.set("toxicspray_expire", null);
            p.sendMessage(ChatColor.BLUE + "The toxic fumes wear off.");
            continue;
        }
        List<Entity> ents = p.getNearbyEntities(Config.toxicRadius, Config.toxicRadius, Config.toxicRadius);
        for (Entity e : ents) {
            if (e.getType() != EntityType.ZOMBIE) continue;
            Zombie z = (Zombie) e;
            z.damage(z.getMaxHealth() / 2);
        }
    }
}
项目:mczone    文件:PetInstance.java   
public void update() {
    if (entity != null) {
        //((CraftEntity) entity).getHandle().setEquipment(4, new net.minecraft.server.v1_5_R2.ItemStack(Item.DIAMOND_HELMET));
        //Chat.server(((CraftEntity) entity).getHandle().getEquipment().toString());
        Player owner = Bukkit.getPlayerExact(this.owner);
        if (owner == null)
            return;
        entity.setCustomName(nameColor + name);
        entity.setCustomNameVisible(true);
        if (entity instanceof Tameable) {
            tamed = true;
            ((Tameable) entity).setTamed(true);
            ((Tameable) entity).setOwner(owner);
        }
        if (entity instanceof Ageable && age != null) {
            if (getAge() == Age.BABY)
                ((Ageable) entity).setBaby();
            ((Ageable) entity).setAgeLock(true);
        }
        if (entity instanceof Zombie && age != null) {
            if (getAge() == Age.BABY)
                ((Zombie) entity).setBaby(true);
        }
        if (entity instanceof Sheep && color != null) {
            ((Sheep) entity).setColor(getColor());
        }
    }
}
项目:SurvivalAPI    文件:ZombiesModule.java   
/**
 * When a player is dead, spawn a zombie
 *
 * @param event Event
 */
@EventHandler
public void onEntityDeath(PlayerDeathEvent event)
{
    Zombie zombie = (Zombie)event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), EntityType.ZOMBIE);
    zombie.setCustomNameVisible(true);
    zombie.setCustomName(event.getEntity().getCustomName());

    event.getEntity().getActivePotionEffects().forEach(zombie::addPotionEffect);
}
项目:MT_Core    文件:MobListener.java   
@EventHandler
public void onEntitySpawn(CreatureSpawnEvent e) {
    if (e.getEntityType().isAlive() && e.getEntityType() != EntityType.PLAYER
               && e.getEntityType() != EntityType.ZOMBIE && e.getEntityType() != EntityType.ENDERMAN
               && e.getEntityType() != EntityType.PIG && e.getEntityType() != EntityType.COW
               && e.getEntityType() != EntityType.SHEEP && e.getEntityType() != EntityType.HORSE
               && e.getEntityType() != EntityType.SQUID) {
        e.setCancelled(true);
        e.getLocation().getWorld().spawn(e.getLocation(), Zombie.class);
    }

}
项目:Skript    文件:ExprSkull.java   
@Override
@Nullable
public ItemType convert(final Object o) {
    final SkullType type;
    if (o instanceof Skeleton || o instanceof SkeletonData) {
        if (o instanceof SkeletonData ? ((SkeletonData) o).isWither() : ((Skeleton) o).getSkeletonType() == SkeletonType.WITHER) {
            type = SkullType.WITHER;
        } else {
            type = SkullType.SKELETON;
        }
    } else if (o instanceof Zombie || o instanceof EntityData && Zombie.class.isAssignableFrom(((EntityData<?>) o).getType())) {
        type = SkullType.ZOMBIE;
    } else if (o instanceof OfflinePlayer || o instanceof PlayerData) {
        type = SkullType.PLAYER;
    } else if (o instanceof Creeper || o instanceof CreeperData) {
        type = SkullType.CREEPER;
    } else {
        return null;
    }
    @SuppressWarnings("deprecation")
    final ItemType i = new ItemType(Material.SKULL_ITEM.getId(), (short) type.ordinal());
    if (o instanceof OfflinePlayer) {
        final SkullMeta s = (SkullMeta) Bukkit.getItemFactory().getItemMeta(Material.SKULL_ITEM);
        s.setOwner(((OfflinePlayer) o).getName());
        i.setItemMeta(s);
    }
    return i;
}
项目:SwornAPI    文件:SpecialEntities.java   
@Override
public LivingEntity spawnZombieVillager(Location loc, Profession profession)
{
    Zombie zombie = (Zombie) loc.getWorld().spawnEntity(loc, EntityType.ZOMBIE);
    zombie.setVillagerProfession(profession);
    return zombie;
}
项目:defend-the-village    文件:ArenaManager.java   
public boolean isInGame(Zombie z) {
    for (Arena a : this.arenas) {
        if (a.getZombies().contains(z))
            return true;
    }
    return false;
}
项目:defend-the-village    文件:Main.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntityCombust(EntityCombustEvent event) {
    if ((event.getEntity() instanceof Zombie))
        // Only apply if the zombie is in an arena world
        if (this.am.isInGame((Zombie) event.getEntity())) {
            event.setCancelled(true);
    }
}
项目:MonoMods    文件:MonoMobs.java   
public static int countZed(String world) {
    List<LivingEntity> entities;
    int zed;
    zed = 0;
    entities = Bukkit.getWorld(world).getLivingEntities();
    for (LivingEntity mob : entities) {
        if (mob instanceof Zombie) zed++;
    }

    return zed;

}
项目:ce    文件:Headless.java   
@Override
public void effect(Event e, ItemStack item, int level) {
    EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) e;
    final Player player = (Player) event.getDamager();
    final LivingEntity ent = (LivingEntity) event.getEntity();

    new BukkitRunnable() {
        @Override
        public void run() {

            if (ent.getHealth() <= 0) {
                byte type = 3;

                if (ent instanceof Skeleton) {
                    type = 0;
                    if (((Skeleton) ent).getSkeletonType().equals(SkeletonType.WITHER))
                        type = 1;
                } else if (ent instanceof Zombie)
                    type = 2;
                else if (ent instanceof Creeper)
                    type = 4;

                ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, type);
                if (type == 3) {
                    SkullMeta sm = (SkullMeta) skull.getItemMeta();
                    sm.setOwner(ent.getName());
                    skull.setItemMeta(sm);
                }
                ent.getWorld().dropItem(ent.getLocation(), skull);
                EffectManager.playSound(player.getLocation(), "BLOCK_ANVIL_LAND", 0.1f, 1.5f);
            }
        }
    }.runTaskLater(getPlugin(), 5l);

}
项目:tregmine    文件:BlessedBlockListener.java   
@EventHandler
public void onDoorBreak(EntityBreakDoorEvent event)
{
    Location l = event.getBlock().getLocation();
    Entity e = event.getEntity();

    Map<Location, Integer> b = plugin.getBlessedBlocks();

    if (b.containsKey(l)) {
        if (e instanceof Zombie) {
            event.setCancelled(true);
        }
    }
}
项目:xEssentials-deprecated-bukkit    文件:CustomZombieAggroRangeEvent.java   
@EventHandler
public void getZombieTarget(EntityTargetLivingEntityEvent e) {
    if(e.getEntity() instanceof Zombie) {
        if(e.getTarget() instanceof Player) {
            if(e.getEntity().getLocation().distance(e.getTarget().getLocation()) > pl.getConfiguration().getEntityConfig().getCustomZombieAggroRange()) {
                e.setCancelled(true);
            }
        }
    }
}
项目:xEssentials-deprecated-bukkit    文件:EntityUseHeadOnPlayerDeathEvent.java   
@EventHandler
public void onDamage(EntityDamageByEntityEvent e) {
    if(e.getEntity() instanceof Player) {
        Player p = (Player) e.getEntity();
        if(e.getDamager() instanceof Zombie) {
            entitys.put(p.getName(), e.getDamager().getUniqueId());
        } else if(e.getDamager() instanceof Arrow) {
            Arrow arrow = (Arrow) e.getDamager();
            if(arrow.getShooter() instanceof Skeleton) {
                Skeleton skel = (Skeleton) arrow.getShooter();
                entitys.put(p.getName(), skel.getUniqueId());
            }
        }
    }
}
项目:xEssentials_old_Source    文件:zombieTarget.java   
@EventHandler
public void getZombieTarget(EntityTargetLivingEntityEvent e) {
    if(e.getEntity() instanceof Zombie) {
        if(e.getTarget() instanceof Player) {
            if(e.getEntity().getLocation().distance(e.getTarget().getLocation()) > xEssentialsMemory.zombieRange) {
                e.setCancelled(true);
            }
        }
    }
}
项目:xEssentials_old_Source    文件:deathHeadEvent.java   
@EventHandler
public void getMobTypeEvent(EntityDamageByEntityEvent e) {
    if(e.getEntity() instanceof Player) {
        Player p = (Player) e.getEntity();
        if(e.getDamager() instanceof Zombie) {
            entityList.put(p.getName(), e.getDamager());
        } else if(e.getDamager() instanceof Arrow) {
            Arrow arrow = (Arrow) e.getDamager();
            if(arrow.getShooter() instanceof Skeleton) {
                entityList.put(p.getName(), arrow.getShooter());
            }
        }
    }
}
项目:Demigods3    文件:Swarm.java   
public static boolean spawnZombie(DemigodsCharacter character, LivingEntity target) {
    Location spawnLocation = character.getCurrentLocation().clone();
    if (DemigodsServer.isRunningSpigot())
        Spigots.playParticle(spawnLocation, Effect.EXPLOSION_HUGE, 1, 1, 1, 1F, 5, 300);
    Zombie zombie = (Zombie) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.ZOMBIE);
    zombie.addPotionEffects(Sets.newHashSet(new PotionEffect(PotionEffectType.SPEED, 999, 5, false), new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 999, 5, false), new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999, 1, false), new PotionEffect(PotionEffectType.JUMP, 999, 5, false), new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999, 2, false)));
    zombie.setCustomName(character.getName() + "'s Minion");
    zombie.setCustomNameVisible(true);
    zombie.setTarget(target);
    return true;
}
项目:ZombieResurrection    文件:EntityDeathListener.java   
@EventHandler
   public void onEntityDeath(EntityDeathEvent event)
   {
    if(event.getEntity() instanceof Player)
    {
        Player player = (Player) event.getEntity();
        DamageCause damageCause = player.getLastDamageCause().getCause();

        if(this.IsPvPKill(damageCause, player))
        {
            this.HandlePlayerDeath(player, event.getDrops());
            return;
        }
        else if(this.IsPvEKill(damageCause))
        {
            this.HandlePlayerDeath(player, event.getDrops());
            return;
        }
        else if(this.IsEnviromentKill(damageCause))
        {
            this.HandlePlayerDeath(player, event.getDrops());
            return;
        }
    }
    else if(event.getEntity() instanceof Zombie)
    {
        Zombie zombie = (Zombie) event.getEntity();
        this.HandleZombieDeath(zombie, event.getDrops());
    }
}
项目:ZombieResurrection    文件:EntityDeathListener.java   
private void HandleZombieDeath(Zombie zombie, List<ItemStack> droppedItems)
{
    if(this.model.getZombiesWithInventory().contains(zombie.getUniqueId()))
    {
        if(this.model.getConfig().getCanPickupInventory())
        {
            for(ItemStack item : this.model.getPlayerInventory().get(zombie.getUniqueId()))
            {
                droppedItems.add(item);
            };
        }
        this.model.getZombiesWithInventory().remove(zombie.getUniqueId());
        this.model.getZombieChunks().remove(zombie);
    }
}
项目:ZvP    文件:DeathMatch.java   
@Override
   public void onRespawn(ZvPPlayer player, PlayerRespawnEvent event) {
event.setRespawnLocation(getArena().getArea().getNewRandomLocation(true));
player.getPlayer().setGameMode(GameMode.SPECTATOR);
player.getPlayer().getInventory().clear();

speedToolEnable = new ItemStack(Material.LEATHER_BOOTS);
ItemMeta meta = speedToolEnable.getItemMeta();
meta.setDisplayName(ChatColor.GREEN + "Enable Speed");
meta.setLore(Arrays.asList(MessageManager.getMessage(game.speedTool_description)));
meta.addItemFlags(ItemFlag.values());
meta.addEnchant(Enchantment.DURABILITY, 1, true);
speedToolEnable.setItemMeta(meta);

speedToolDisable = speedToolEnable.clone();
meta = speedToolDisable.getItemMeta();
meta.setDisplayName(ChatColor.RED + "Disable Speed");
speedToolDisable.setItemMeta(meta);

playerCompass = new ItemStack(Material.COMPASS);
meta = playerCompass.getItemMeta();
meta.setDisplayName("Teleport Tool");
meta.setLore(Arrays.asList(MessageManager.getMessage(game.teleportTool_description)));
meta.addItemFlags(ItemFlag.values());
meta.addEnchant(Enchantment.DURABILITY, 1, true);
playerCompass.setItemMeta(meta);

if (getLivingPlayers().length > 0) {

    for (Zombie z : getArena().getLivingZombies()) {
    z.setTarget(getArena().getRandomPlayer().getPlayer());
    }

    player.getPlayer().getInventory().addItem(speedToolEnable, playerCompass);
    player.sendMessage(MessageManager.getMessage(game.spectator_mode));
}
   }
项目:ZvP    文件:Arena.java   
public Zombie[] getLivingZombies() {
List<Zombie> zombieList = new ArrayList<Zombie>();
for (Entity e : getArea().getEntities()) {
    if (e instanceof Zombie) {
    zombieList.add((Zombie) e);
    }
}

Zombie[] zombies = new Zombie[zombieList.size()];
for (Zombie z : zombieList) {
    zombies[zombieList.indexOf(z)] = z;
}

return zombies;
   }
项目:RoyalSurvivors    文件:ZombieSpawner.java   
/**
 * Applies 0 - 2 potion effects on a zombie.
 * <p/>
 * These effects last for Integer.MAX_VALUE ticks (~3.4 years).
 *
 * @param z Zombie to apply effects to.
 */
private static void applyPotionEffects(Zombie z) {
    /*for (int i = 0; i < nextInt(0, 2); i++) {
        RoyalSurvivors.debugStatic("effect applied, bro!");
        RoyalSurvivors.debugStatic("Location: " + z.getLocation());
        PotionEffectType pet = allowedEffects[r.nextInt(allowedEffects.length)];
        int amplifier = r.nextInt(3);
        RoyalSurvivors.debugStatic("pet: " + pet);
        RoyalSurvivors.debugStatic("amplifier: " + amplifier);
        z.addPotionEffect(new PotionEffect(pet, Integer.MAX_VALUE, amplifier));
    }*/
}