@Override public boolean effect(Event event, Player player) { // List<String> lore = e.getBow().getItemMeta().getLore(); // if(!lore.contains(placeHolder)) { // for(int i = descriptionSize; i != 0; i--) // lore.remove(i); // e.getProjectile().setMetadata("ce." + this.getOriginalName(), new FixedMetadataValue(main, writeType(lore))); // player.setMetadata("ce.CanUnleashBeasts", null); // } else // e.getProjectile().setMetadata("ce." + this.getOriginalName(), null); if(event instanceof EntityDamageByEntityEvent) { EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event; if(e.getDamager() != player) return false; Entity ent = e.getEntity(); Location loc = ent.getLocation(); World w = ent.getWorld(); if(ent instanceof Silverfish || ent instanceof EnderDragon || ent instanceof Spider || ent instanceof Slime || ent instanceof Ghast || ent instanceof MagmaCube || ent instanceof CaveSpider || (ent instanceof Wolf && ((Wolf) ent).isAngry()) || ent instanceof PigZombie) { e.setDamage(e.getDamage()*DamageMultiplication); w.playEffect(loc, Effect.SMOKE, 50); w.playEffect(loc, Effect.MOBSPAWNER_FLAMES, 50); EffectManager.playSound(loc, "BLOCK_PISTON_RETRACT", 1.3f, 3f); return true; } else if (ent instanceof Player) { for(int i = 0; i < MaximumMobs; i++) { if(rand.nextInt(100) < MobAppearanceChance) { w.spawnEntity(loc, rand.nextInt(2) == 1 ? EntityType.SPIDER : EntityType.SLIME); w.playEffect(loc, Effect.MOBSPAWNER_FLAMES, 30); w.playEffect(loc, Effect.SMOKE, 30); EffectManager.playSound(loc, "BLOCK_ANVIL_BREAK", 0.3f, 0.1f); } } } } return false; }
public CanaryCaveSpider(net.canarymod.api.entity.living.monster.CaveSpider entity) { super(entity); }
/** 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; }
public RemoteCaveSpider(int inID, RemoteCaveSpiderEntity inEntity, EntityManager inManager) { super(inID, RemoteEntityType.CaveSpider, inManager); this.m_entity = inEntity; }