org.bukkit.entity.MagmaCube Java Examples

The following examples show how to use org.bukkit.entity.MagmaCube. 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: BeastmastersBow.java    From ce with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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;
	}