@EventHandler
  public void onWorldSpawn(CreatureSpawnEvent event) {
    YamlConfiguration config = (YamlConfiguration) plugin.getConfig();
    if (event.getEntity() instanceof Creeper) {
      if (config.getBoolean("PortalCreated", false)) {
        if (plugin.gen.nextInt(50) == 0) {
          event.getLocation().getWorld().spawn(event.getLocation(), PigZombie.class);
        }
      }
      event.getEntity().remove();
      event.setCancelled(true);
    }
    if (event.getEntity() instanceof Enderman
        || event.getEntity() instanceof Squid
        || event.getEntity() instanceof Skeleton
        || event.getEntity() instanceof Spider
        || event.getEntity() instanceof Slime
        || event.getEntity() instanceof Ocelot
        || event.getEntity() instanceof Wolf) {
      event.getEntity().remove();
      event.setCancelled(true);
    }

    // Nether
    if (event.getEntity() instanceof Ghast) {
      event.getEntity().remove();
      event.getLocation().getWorld().spawn(event.getLocation(), Giant.class);
    }
    if (event.getEntity() instanceof Blaze || event.getEntity() instanceof MagmaCube) {
      event.getEntity().remove();
      event.setCancelled(true);
    }
    if (event.getEntity() instanceof PigZombie) {
      if (event.getLocation().getWorld().equals(plugin.getServer().getWorld("world_nether"))) {
        event.getLocation().getWorld().spawn(event.getLocation(), Zombie.class);
      }
    }

    if (event.getEntity() instanceof Zombie) {
      if (plugin.gen.nextInt(50) == 0) {
        Zombie zom = (Zombie) event.getEntity();
        try {
          speedUpZombie(zom);
        } catch (SecurityException e) {
          e.printStackTrace();
        } catch (IllegalArgumentException e) {
          e.printStackTrace();
        } catch (NoSuchFieldException e) {
          e.printStackTrace();
        } catch (IllegalAccessException e) {
          e.printStackTrace();
        }
      }
    }
  }
 @EventHandler
 public void onEntityStruckbyLight(LightningStrikeEvent event) {
   for (Entity entity : event.getLightning().getNearbyEntities(1, 1, 1)) {
     if (entity instanceof Zombie) {
       plugin.getServer().broadcastMessage(ChatColor.RED + "Lightning Struck a Zombie!");
       event
           .getLightning()
           .getLocation()
           .getWorld()
           .spawn(event.getLightning().getLocation(), Giant.class);
       event.setCancelled(true);
     }
     if (entity instanceof Player || entity instanceof Chicken) {
       event
           .getLightning()
           .getLocation()
           .getWorld()
           .createExplosion(event.getLightning().getLocation(), 4.0F);
     }
   }
 }
 @EventHandler
 public void onPortalCreate(PortalCreateEvent event) {
   YamlConfiguration config = (YamlConfiguration) plugin.getConfig();
   config.set("PortalCreated", (Boolean) true);
   plugin.getServer().broadcastMessage(ChatColor.LIGHT_PURPLE + "A portal was created!");
 }
  @EventHandler
  public void onEntityDeath(final EntityDeathEvent event) {
    int modifier = 1;
    event.setDroppedExp(0);
    String world = event.getEntity().getLocation().getWorld().getName();
    if (world.equalsIgnoreCase("oilrig")) modifier = 3;
    if (world.equalsIgnoreCase("city")) modifier = 2;
    if (!(event.getEntity() instanceof Player)) {
      List<ItemStack> list = event.getDrops();
      if (event.getEntity() instanceof Zombie || event.getEntity() instanceof PigZombie) {
        list.clear();
        if (plugin.gen.nextInt(50) == 0) {
          Material random =
              drop.selector(
                  plugin.gen.nextInt(2) + 1,
                  plugin.gen.nextInt(5) + 1,
                  plugin.gen.nextInt(4) + 1,
                  plugin.gen.nextInt(5) + 1);
          ItemStack item = new ItemStack(random, 1);
          Integer enchamt = plugin.gen.nextInt(10);
          for (int i = 0; i < enchamt; i++) {
            int rand = plugin.gen.nextInt(21) + 1;
            Enchantment enchantment = drop.enchant(rand);
            int power = plugin.gen.nextInt(enchantment.getMaxLevel()) + 1;
            item.addUnsafeEnchantment(enchantment, power);
          }
          list.add(item);
        }
        if (plugin.gen.nextInt(25) == 0) {
          int[] iteml = {296, 297, 263, 264, 265, 266, 260, 289, 352, 287, 368};
          Integer random = plugin.gen.nextInt(iteml.length);
          ItemStack item = new ItemStack(iteml[random], plugin.gen.nextInt(5) + 1);
          list.add(item);
        }
        if (plugin.gen.nextInt(30) == 0) {
          int[] iteml = {372, 376, 375, 377, 370, 378, 369, 262, 341, 367};
          Integer random = plugin.gen.nextInt(iteml.length);
          ItemStack item = new ItemStack(iteml[random], 1);
          list.add(item);
        }
        if (event.getEntity() instanceof Zombie) {
          ArrayList<Player> l = new ArrayList<Player>();
          for (Entity entity : event.getEntity().getNearbyEntities(10, 10, 10)) {
            if (entity instanceof Player) {
              Player killer = (Player) entity;
              killer.setLevel(killer.getLevel() + (1 * modifier));
              l.add(killer);
            }
          }
          EntityDamageEvent e = event.getEntity().getLastDamageCause();
          if (e instanceof EntityDamageByEntityEvent) {
            EntityDamageByEntityEvent ev = (EntityDamageByEntityEvent) e;
            if (ev.getDamager() instanceof Arrow) {
              Arrow a = (Arrow) ev.getDamager();
              if (a.getShooter() instanceof Player) {
                Player killer = (Player) a.getShooter();
                if (!l.contains(killer)) {
                  killer.setLevel(killer.getLevel() + (1 * modifier));
                }
              }
            }
          }
          l.clear();
        }

        if (event.getEntity() instanceof PigZombie) {

          ArrayList<Player> l = new ArrayList<Player>();
          for (Entity entity : event.getEntity().getNearbyEntities(10, 10, 10)) {
            if (entity instanceof Player) {
              Player killer = (Player) entity;
              killer.setLevel(killer.getLevel() + (5 * modifier));
              l.add(killer);
            }
          }
          EntityDamageEvent e = event.getEntity().getLastDamageCause();
          if (e instanceof EntityDamageByEntityEvent) {
            EntityDamageByEntityEvent ev = (EntityDamageByEntityEvent) e;
            if (ev.getDamager() instanceof Arrow) {
              Arrow a = (Arrow) ev.getDamager();
              if (a.getShooter() instanceof Player) {
                Player killer = (Player) a.getShooter();
                if (!l.contains(killer)) {
                  killer.setLevel(killer.getLevel() + (5 * modifier));
                }
              }
            }
          }
          l.clear();
        }
      }

      if (event.getEntity() instanceof Giant) {
        ItemStack item = new ItemStack(57, 10);
        list.add(item);
        StringBuilder sb = new StringBuilder();
        for (Entity entity : event.getEntity().getNearbyEntities(15, 15, 15)) {
          if (entity instanceof Player) {
            Player killer = (Player) entity;
            String name = killer.getName();
            if (name.equalsIgnoreCase("deathmarin")) {
              name = "Deathmarine";
            }
            sb.append(name + ", ");
            killer.setLevel(killer.getLevel() + (50 * modifier));
          }
        }

        plugin.getServer().broadcastMessage(ChatColor.AQUA + sb.toString() + "killed the giant.");

        for (int i = 0; i < 50; i++) {
          event
              .getEntity()
              .getLocation()
              .getWorld()
              .spawn(event.getEntity().getLocation(), Zombie.class);
        }
      }
      if (plugin.gen.nextInt(16) == 0) {
        ItemStack item = new ItemStack(90, 1);
        list.add(item);
      }
    }
  }