Java Code Examples for org.bukkit.entity.EntityType#ZOMBIE
The following examples show how to use
org.bukkit.entity.EntityType#ZOMBIE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SentinelVersionCompat.java From Sentinel with MIT License | 6 votes |
static EntityType[] v1_16_monsters() { return new EntityType[]{ // 1.8 minus PigZombie EntityType.GUARDIAN, EntityType.CREEPER, EntityType.SKELETON, EntityType.ZOMBIE, EntityType.MAGMA_CUBE, EntityType.SILVERFISH, EntityType.BAT, EntityType.BLAZE, EntityType.GHAST, EntityType.GIANT, EntityType.SLIME, EntityType.SPIDER, EntityType.CAVE_SPIDER, EntityType.ENDERMAN, EntityType.ENDERMITE, EntityType.WITHER, EntityType.ENDER_DRAGON, EntityType.WITCH, // 1.9 EntityType.SHULKER, // 1.11 EntityType.VEX, EntityType.HUSK, EntityType.ELDER_GUARDIAN, EntityType.EVOKER, EntityType.STRAY, EntityType.ZOMBIE_VILLAGER, EntityType.WITHER_SKELETON, EntityType.VINDICATOR, // 1.12 EntityType.ILLUSIONER, // 1.13 EntityType.DROWNED, EntityType.PHANTOM, // 1.14 EntityType.RAVAGER, EntityType.PILLAGER, // 1.15 EntityType.BEE, // 1.16 EntityType.HOGLIN, EntityType.PIGLIN, EntityType.ZOGLIN, EntityType.ZOMBIFIED_PIGLIN }; }
Example 2
Source File: EliteZombie.java From EliteMobs with GNU General Public License v3.0 | 6 votes |
public EliteZombie() { this.name = ConfigValues.translationConfig.getString(TranslationConfig.NAME_ZOMBIE); this.entityType = EntityType.ZOMBIE; this.defaultMaxHealth = 20; ZombieBloat zombieBloat = new ZombieBloat(); ZombieFriends zombieFriends = new ZombieFriends(); ZombieNecronomicon zombieNecronomicon = new ZombieNecronomicon(); ZombieParents zombieParents = new ZombieParents(); ZombieTeamRocket zombieTeamRocket = new ZombieTeamRocket(); this.validMajorPowers = new HashSet<>(Arrays.asList(zombieBloat, zombieFriends, zombieNecronomicon, zombieParents, zombieTeamRocket)); this.validDefensivePowers.addAll(super.getAllDefensivePowers()); this.validOffensivePowers.addAll(super.getAllOffensivePowers()); this.validMiscellaneousPowers.addAll(super.getAllMiscellaneousPowers()); this.isEnabled = ConfigValues.validMobsConfig.getBoolean(ValidMobsConfig.VALID_AGGRESSIVE_ELITEMOBS + getEntityType().toString()) && ConfigValues.validMobsConfig.getBoolean(ValidMobsConfig.ALLOW_AGGRESSIVE_ELITEMOBS); if (this.isEnabled) eliteMobData.add(this); }
Example 3
Source File: EntityDeathListener.java From UhcCore with GNU General Public License v3.0 | 5 votes |
private void handleOfflineZombieDeath(EntityDeathEvent event){ if (event.getEntityType() != EntityType.ZOMBIE){ return; } Zombie zombie = (Zombie) event.getEntity(); GameManager gm = GameManager.getGameManager(); if (zombie.getCustomName() == null){ return; } UhcPlayer uhcPlayer = null; for (UhcPlayer player : gm.getPlayersManager().getPlayersList()){ if (player.getOfflineZombie() != null && player.getOfflineZombie().equals(zombie)){ // found player uhcPlayer = player; break; } } if (uhcPlayer == null){ return; } event.getDrops().clear(); uhcPlayer.setOfflineZombie(null); gm.getPlayersManager().killOfflineUhcPlayer(uhcPlayer, zombie.getLocation(), new HashSet<>(uhcPlayer.getStoredItems()), zombie.getKiller()); }
Example 4
Source File: EffCitizenHold.java From skRayFall with GNU General Public License v3.0 | 5 votes |
@Override protected void execute(Event evt) { NPCRegistry registry = CitizensAPI.getNPCRegistry(); NPC getter = registry.getById(id.getSingle(evt).intValue()); if (getter.getEntity().getType().equals(EntityType.PLAYER) || getter.getEntity().getType() == EntityType.ENDERMAN || getter.getEntity().getType() == EntityType.ZOMBIE || getter.getEntity().getType() == EntityType.SKELETON) { Equipment equ = getter.getTrait(Equipment.class); equ.set(EquipmentSlot.HAND, item.getSingle(evt)); } else { Skript.error("Entity must be equipable!"); } }
Example 5
Source File: PowerUps.java From HolographicDisplays with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onEntityDeath(EntityDeathEvent event) { if (event.getEntityType() == EntityType.ZOMBIE) { // Remove normal drops and exp. event.getDrops().clear(); event.setDroppedExp(0); // Spawn the floating item with a label. final Hologram hologram = HologramsAPI.createHologram(this, event.getEntity().getLocation().add(0.0, 0.9, 0.0)); hologram.appendTextLine(ChatColor.AQUA + "" + ChatColor.BOLD + "Speed PowerUp"); ItemLine icon = hologram.appendItemLine(new ItemStack(Material.SUGAR)); icon.setPickupHandler(new PickupHandler() { @Override public void onPickup(Player player) { // Play an effect. player.playEffect(hologram.getLocation(), Effect.MOBSPAWNER_FLAMES, null); // 30 seconds of speed II. player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 30 * 20, 1), true); // Delete the hologram. hologram.delete(); } }); } }
Example 6
Source File: CraftZombie.java From Kettle with GNU General Public License v3.0 | 4 votes |
public EntityType getType() { return EntityType.ZOMBIE; }
Example 7
Source File: EntityDamageListener.java From UhcCore with GNU General Public License v3.0 | 4 votes |
private void handleOfflinePlayers(EntityDamageByEntityEvent e){ if (e.getEntityType() != EntityType.ZOMBIE || !(e.getDamager() instanceof Player)){ return; } GameManager gm = GameManager.getGameManager(); MainConfiguration cfg = gm.getConfiguration(); PlayersManager pm = gm.getPlayersManager(); // Offline players are disabled if (!cfg.getSpawnOfflinePlayers()){ return; } Zombie zombie = (Zombie) e.getEntity(); UhcPlayer damager = pm.getUhcPlayer((Player) e.getDamager()); UhcPlayer owner = null; // Find zombie owner for (UhcPlayer uhcPlayer : pm.getPlayersList()){ if (uhcPlayer.getOfflineZombie() != null && uhcPlayer.getOfflineZombie() == zombie){ owner = uhcPlayer; break; } } // Not a offline player if (owner == null){ return; } boolean pvp = gm.getPvp(); boolean isTeamMember = owner.isInTeamWith(damager); boolean friendlyFire = gm.getConfiguration().getEnableFriendlyFire(); // If PvP is false or is team member & friendly fire is off if (!pvp || (isTeamMember && !friendlyFire)){ e.setCancelled(true); // Canceled due to friendly fire, so send message if (pvp){ damager.sendMessage(Lang.PLAYERS_FF_OFF); } } }
Example 8
Source File: SentinelVersionCompat.java From Sentinel with MIT License | 4 votes |
static EntityType[] v1_8_monsters() { return new EntityType[]{EntityType.GUARDIAN, EntityType.CREEPER, EntityType.SKELETON, EntityType.ZOMBIE, EntityType.MAGMA_CUBE, EntityType.valueOf("PIG_ZOMBIE"), EntityType.SILVERFISH, EntityType.BAT, EntityType.BLAZE, EntityType.GHAST, EntityType.GIANT, EntityType.SLIME, EntityType.SPIDER, EntityType.CAVE_SPIDER, EntityType.ENDERMAN, EntityType.ENDERMITE, EntityType.WITHER, EntityType.ENDER_DRAGON, EntityType.WITCH}; }
Example 9
Source File: CraftZombie.java From Thermos with GNU General Public License v3.0 | 4 votes |
public EntityType getType() { return EntityType.ZOMBIE; }
Example 10
Source File: EffEquipCitizen.java From skRayFall with GNU General Public License v3.0 | 4 votes |
@Override protected void execute(Event evt) { NPCRegistry registry = CitizensAPI.getNPCRegistry(); NPC getter = registry.getById(id.getSingle(evt).intValue()); EquipmentSlot slot = EquipmentSlot.HAND; switch (item.getSingle(evt).getType()) { case LEATHER_BOOTS: case IRON_BOOTS: case GOLD_BOOTS: case CHAINMAIL_BOOTS: case DIAMOND_BOOTS: slot = EquipmentSlot.BOOTS; break; case LEATHER_LEGGINGS: case IRON_LEGGINGS: case GOLD_LEGGINGS: case CHAINMAIL_LEGGINGS: case DIAMOND_LEGGINGS: slot = EquipmentSlot.LEGGINGS; break; case LEATHER_CHESTPLATE: case IRON_CHESTPLATE: case GOLD_CHESTPLATE: case CHAINMAIL_CHESTPLATE: case DIAMOND_CHESTPLATE: slot = EquipmentSlot.CHESTPLATE; break; case LEATHER_HELMET: case IRON_HELMET: case GOLD_HELMET: case CHAINMAIL_HELMET: case DIAMOND_HELMET: slot = EquipmentSlot.HELMET; break; default: break; } if (getter.getEntity().getType().equals(EntityType.PLAYER) || getter.getEntity().getType() == EntityType.ENDERMAN || getter.getEntity().getType() == EntityType.ZOMBIE || getter.getEntity().getType() == EntityType.SKELETON) { Equipment equ = getter.getTrait(Equipment.class); equ.set(slot, item.getSingle(evt)); } else { Skript.error("Entity must be equipable!"); } }
Example 11
Source File: ScrubEntityType.java From skRayFall with GNU General Public License v3.0 | 4 votes |
/** * Convert a string to a bukkit entity type. * * @param exprs The string to be converted. */ public static EntityType getType(String exprs) { switch (exprs.replace("\"", "").toLowerCase().replace("_", " ").replaceFirst("the ", "")) { case "player": case "the player": return EntityType.PLAYER; case "pig": return EntityType.PIG; case "blaze": return EntityType.BLAZE; case "bat": return EntityType.BAT; case "chicken": return EntityType.CHICKEN; case "creeper": return EntityType.CREEPER; case "cow": return EntityType.COW; case "enderman": return EntityType.ENDERMAN; case "ender dragon": return EntityType.ENDER_DRAGON; case "ghast": return EntityType.GHAST; case "giant": return EntityType.GIANT; case "iron golem": return EntityType.IRON_GOLEM; case "magma cube": return EntityType.MAGMA_CUBE; case "mushroom cow": return EntityType.MUSHROOM_COW; case "ocelot": return EntityType.OCELOT; case "pig zombie": return EntityType.PIG_ZOMBIE; case "sheep": return EntityType.SHEEP; case "silverfish": return EntityType.SILVERFISH; case "squid": return EntityType.SQUID; case "snowman": return EntityType.SNOWMAN; case "wolf": return EntityType.WOLF; case "skeleton": return EntityType.SKELETON; case "slime": return EntityType.SLIME; case "spider": return EntityType.SPIDER; case "witch": return EntityType.WITCH; case "wither": return EntityType.WITHER; case "villager": return EntityType.VILLAGER; case "zombie": return EntityType.ZOMBIE; case "armor stand": return EntityType.ARMOR_STAND; case "guardian": return EntityType.GUARDIAN; default: return EntityType.PLAYER; } }
Example 12
Source File: EntityNBTBase.java From NBTEditor with GNU General Public License v3.0 | 4 votes |
public static EntityNBT fromEntityData(NBTTagCompound data) { EntityType entityType = EntityTypeMap.getByName(data.getString("id")); EntityType entityTypeNew = entityType; // Backward compatibility with pre-1.11. if (entityType == EntityType.GUARDIAN) { if (data.hasKey("Elder")) { if (data.getByte("Elder") != 0) { entityTypeNew = EntityType.ELDER_GUARDIAN; } data.remove("Elder"); } } else if (entityType == EntityType.SKELETON) { if (data.hasKey("SkeletonType")) { switch (data.getByte("SkeletonType")) { case 1: entityTypeNew = EntityType.WITHER_SKELETON; break; case 2: entityTypeNew = EntityType.STRAY; break; } data.remove("SkeletonType"); } } else if (entityType == EntityType.ZOMBIE) { // pre-1.10 if (data.hasKey("IsVillager")) { if (data.getByte("IsVillager") != 0) { entityTypeNew = EntityType.ZOMBIE_VILLAGER; if (data.hasKey("VillagerProfession")) { data.setInt("Profession", data.getInt("VillagerProfession")); data.remove("VillagerProfession"); } } data.remove("IsVillager"); } // pre-1.11 if (data.hasKey("ZombieType")) { int zombieType = data.getInt("ZombieType"); if (zombieType == 0) { entityTypeNew = EntityType.ZOMBIE; } else if (zombieType >= 1 && zombieType <= 5) { entityTypeNew = EntityType.ZOMBIE_VILLAGER; data.setInt("Profession", zombieType - 1); } else if (zombieType == 6) { entityTypeNew = EntityType.HUSK; } data.remove("ZombieType"); } } else if (entityType == EntityType.HORSE) { if (data.hasKey("Type")) { switch (data.getInt("Type")) { case 1: entityTypeNew = EntityType.DONKEY; break; case 2: entityTypeNew = EntityType.MULE; break; case 3: entityTypeNew = EntityType.ZOMBIE_HORSE; break; case 4: entityTypeNew = EntityType.SKELETON_HORSE; break; } data.remove("Type"); } if (entityTypeNew != EntityType.DONKEY && entityTypeNew != EntityType.MULE) { data.remove("ChestedHorse"); } } data.setString("id", EntityTypeMap.getName(entityTypeNew)); entityType = entityTypeNew; // Convert custom names to JSON (1.13). refreshEntityName(data); if (entityType != null) { return EntityNBT.newInstance(entityType, data); } return null; }
Example 13
Source File: ZombieFriends.java From EliteMobs with GNU General Public License v3.0 | 2 votes |
@EventHandler public void onHit(EntityDamageEvent event) { EliteMobEntity eliteMobEntity = EventValidator.getEventEliteMob(this, event); if (eliteMobEntity == null) return; if (ThreadLocalRandom.current().nextDouble() > 0.01) return; if (activatedZombies.contains(eliteMobEntity)) return; activatedZombies.add(eliteMobEntity); ReinforcementMobEntity reinforcement1 = new ReinforcementMobEntity(EntityType.ZOMBIE, eliteMobEntity.getLivingEntity().getLocation(), eliteMobEntity.getLevel(), ConfigValues.translationConfig.getString("ZombieFriends.Friend 1"), CreatureSpawnEvent.SpawnReason.CUSTOM); ReinforcementMobEntity reinforcement2 = new ReinforcementMobEntity(EntityType.ZOMBIE, eliteMobEntity.getLivingEntity().getLocation(), eliteMobEntity.getLevel(), ConfigValues.translationConfig.getString("ZombieFriends.Friend 2"), CreatureSpawnEvent.SpawnReason.CUSTOM); new BukkitRunnable() { @Override public void run() { if (!eliteMobEntity.getLivingEntity().isValid() || !reinforcement1.getLivingEntity().isValid() && !reinforcement2.getLivingEntity().isValid()) { if (reinforcement1.getLivingEntity().isValid()) { nameClearer(reinforcement1); reinforcement1.getLivingEntity().setCustomName(convert(ConfigValues.translationConfig.getStringList("ZombieFriends.DeathMessage"). get(ThreadLocalRandom.current().nextInt(ConfigValues.translationConfig.getStringList("ZombieFriends.DeathMessage") .size())))); } if (reinforcement2.getLivingEntity().isValid()) { nameClearer(reinforcement2); reinforcement2.getLivingEntity().setCustomName(convert(ConfigValues.translationConfig.getStringList("ZombieFriends.DeathMessage"). get(ThreadLocalRandom.current().nextInt(ConfigValues.translationConfig.getStringList("ZombieFriends.DeathMessage") .size())))); } cancel(); return; } else { if (ThreadLocalRandom.current().nextDouble() < 0.5) { nameClearer(eliteMobEntity); eliteMobEntity.getLivingEntity().setCustomName(convert(ConfigValues.translationConfig.getStringList("ZombieFriends.ZombieDialog"). get(ThreadLocalRandom.current().nextInt(ConfigValues.translationConfig.getStringList("ZombieFriends.ZombieDialog") .size())))); } if (ThreadLocalRandom.current().nextDouble() < 0.5 && reinforcement1.getLivingEntity().isValid()) { nameClearer(reinforcement1); reinforcement1.getLivingEntity().setCustomName(convert(ConfigValues.translationConfig.getStringList("ZombieFriends.FriendDialog"). get(ThreadLocalRandom.current().nextInt(ConfigValues.translationConfig.getStringList("ZombieFriends.FriendDialog") .size())))); } if (ThreadLocalRandom.current().nextDouble() < 0.5 && reinforcement2.getLivingEntity().isValid()) { nameClearer(reinforcement2); reinforcement2.getLivingEntity().setCustomName(convert(ConfigValues.translationConfig.getStringList("ZombieFriends.FriendDialog"). get(ThreadLocalRandom.current().nextInt(ConfigValues.translationConfig.getStringList("ZombieFriends.FriendDialog") .size())))); } } } }.runTaskTimer(MetadataHandler.PLUGIN, 20, 20 * 8); }
Example 14
Source File: ZombieParents.java From EliteMobs with GNU General Public License v3.0 | 2 votes |
@EventHandler public void onHit(EntityDamageEvent event) { EliteMobEntity eliteMobEntity = EventValidator.getEventEliteMob(this, event); if (eliteMobEntity == null) return; if (ThreadLocalRandom.current().nextDouble() > 0.01) return; if (activatedZombies.contains(eliteMobEntity)) return; ReinforcementMobEntity reinforcementMom = new ReinforcementMobEntity(EntityType.ZOMBIE, eliteMobEntity.getLivingEntity().getLocation(), eliteMobEntity.getLevel(), ConfigValues.translationConfig.getString("ZombieParents.Mom Name"), CreatureSpawnEvent.SpawnReason.CUSTOM); LivingEntity zombieMom = reinforcementMom.getLivingEntity(); ReinforcementMobEntity reinforcementDad = new ReinforcementMobEntity(EntityType.ZOMBIE, eliteMobEntity.getLivingEntity().getLocation(), eliteMobEntity.getLevel(), ConfigValues.translationConfig.getString("ZombieParents.Dad Name"), CreatureSpawnEvent.SpawnReason.CUSTOM); LivingEntity zombieDad = reinforcementDad.getLivingEntity(); new BukkitRunnable() { @Override public void run() { if (!eliteMobEntity.getLivingEntity().isValid()) { if (zombieDad.isValid()) { nameClearer(reinforcementDad); zombieDad.setCustomName(convert(ConfigValues.translationConfig.getStringList("ZombieParents.DeathMessage"). get(ThreadLocalRandom.current().nextInt(ConfigValues.translationConfig.getStringList("ZombieParents.DeathMessage") .size())))); } if (zombieMom.isValid()) { nameClearer(reinforcementMom); zombieMom.setCustomName(convert(ConfigValues.translationConfig.getStringList("ZombieParents.DeathMessage"). get(ThreadLocalRandom.current().nextInt(ConfigValues.translationConfig.getStringList("ZombieParents.DeathMessage") .size())))); } cancel(); } else { if (ThreadLocalRandom.current().nextDouble() < 0.5) { nameClearer(eliteMobEntity); eliteMobEntity.getLivingEntity().setCustomName(convert(ConfigValues.translationConfig.getStringList("ZombieParents.ZombieDialog"). get(ThreadLocalRandom.current().nextInt(ConfigValues.translationConfig.getStringList("ZombieParents.ZombieDialog") .size())))); } if (ThreadLocalRandom.current().nextDouble() < 0.5 && zombieDad.isValid()) { nameClearer(reinforcementDad); zombieDad.setCustomName(convert(ConfigValues.translationConfig.getStringList("ZombieParents.ZombieDadDialog"). get(ThreadLocalRandom.current().nextInt(ConfigValues.translationConfig.getStringList("ZombieParents.ZombieDadDialog") .size())))); } if (ThreadLocalRandom.current().nextDouble() < 0.5 && zombieMom.isValid()) { nameClearer(reinforcementMom); zombieMom.setCustomName(convert(ConfigValues.translationConfig.getStringList("ZombieParents.ZombieMomDialog"). get(ThreadLocalRandom.current().nextInt(ConfigValues.translationConfig.getStringList("ZombieParents.ZombieMomDialog") .size())))); } } } }.runTaskTimer(MetadataHandler.PLUGIN, 20, 20 * 8); }