@EventHandler
 public void onBlockInteractEvent(PlayerInteractEvent event) {
   if (!(event.getAction().equals(Action.RIGHT_CLICK_AIR))
       || !(event.getAction().equals(Action.RIGHT_CLICK_AIR))) {
     return;
   }
   if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
     if (event.getClickedBlock().getType().equals(Material.SIGN)
         || event.getClickedBlock().getType().equals(Material.SIGN_POST)
         || event.getClickedBlock().getType().equals(Material.WALL_SIGN)) {
       return;
     }
   }
   Player player = event.getPlayer();
   if (plugin.manager.isPlayerInGame(player)) {
     Game game = plugin.manager.getGame(player);
     if (!(game.mode == ArenaStatus.INGAME)) {
       return;
     }
     if (game.getPlayersGun(player) != null) {
       GunManager gunManager = game.getPlayersGun(player);
       if (gunManager.isGun()) {
         Gun gun = gunManager.getGun(player.getInventory().getHeldItemSlot());
         if (gun.isReloading()) {
           player.getLocation().getWorld().playSound(player.getLocation(), Sound.CLICK, 1, 1);
           return;
         }
         gun.wasShot();
       }
     }
   }
 }
  @SuppressWarnings("deprecation")
  public void loadAllBarriersToGame() {
    CustomConfig conf = plugin.configManager.getConfig("ArenaConfig");
    barriers.clear();
    try {
      for (String key : conf.getConfigurationSection(game.getName() + ".Barriers").getKeys(false)) {
        double x = conf.getDouble(game.getName() + ".Barriers." + key + ".x");
        double y = conf.getDouble(game.getName() + ".Barriers." + key + ".y");
        double z = conf.getDouble(game.getName() + ".Barriers." + key + ".z");
        Location loc = new Location(game.getWorld(), x, y, z);
        int number = Integer.parseInt(key);
        Barrier barrier = new Barrier(loc, loc.getWorld().getBlockAt(loc), number, game);

        loc.getBlock().setTypeId(conf.getInt(game.getName() + ".Barriers." + key + ".bb"));

        double rx = conf.getDouble(game.getName() + ".Barriers." + key + ".rx");
        double ry = conf.getDouble(game.getName() + ".Barriers." + key + ".ry");
        double rz = conf.getDouble(game.getName() + ".Barriers." + key + ".rz");
        barrier.setRepairLoc(new Location(game.getWorld(), rx, ry, rz));

        SpawnPoint point =
            game.spawnManager.getSpawnPoint(
                conf.getString(game.getName() + ".Barriers." + key + ".sp"));
        barrier.assingSpawnPoint(point);

        barrier.setReward(conf.getInt(game.getName() + ".Barriers." + key + ".reward"));

        barriers.add(barrier);
      }
    } catch (NullPointerException e) {
    }
  }
 @SuppressWarnings("deprecation")
 public void UpdateBarrier(Barrier barrier) {
   CustomConfig conf = plugin.configManager.getConfig("ArenaConfig");
   if (game.mode == ArenaStatus.DISABLED || game.mode == ArenaStatus.WAITING) {
     boolean same = false;
     for (Barrier b : barriers) {
       if (b.getLocation().equals(b.getLocation())) {
         same = true;
       }
     }
     if (!same) {
       Location loc = barrier.getLocation();
       Location loc2 = barrier.getRepairLoc();
       SpawnPoint sp = barrier.getSpawnPoint();
       int name = barrier.getNum();
       conf.set(game.getName() + ".Barriers." + name + ".x", loc.getBlockX());
       conf.set(game.getName() + ".Barriers." + name + ".y", loc.getBlockY());
       conf.set(game.getName() + ".Barriers." + name + ".z", loc.getBlockZ());
       conf.set(game.getName() + ".Barriers." + name + ".rx", loc2.getBlockX());
       conf.set(game.getName() + ".Barriers." + name + ".ry", loc2.getBlockY());
       conf.set(game.getName() + ".Barriers." + name + ".rz", loc2.getBlockZ());
       conf.set(game.getName() + ".Barriers." + name + ".sp", sp.getNumber());
       conf.set(game.getName() + ".Barriers." + name + ".bb", barrier.getBlock().getTypeId());
       conf.set(game.getName() + ".Barriers." + name + ".reward", barrier.getReward());
       conf.saveConfig();
       barriers.add(barrier);
     }
   }
 }
 public void removeBarrier(Player player, Barrier barrier) {
   if (barriers.contains(barrier)) {
     CustomConfig conf = plugin.configManager.getConfig("ArenaConfig");
     conf.set(game.getName() + ".Barriers." + barrier.getNum(), null);
     conf.saveConfig();
     loadAllBarriersToGame();
     player.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "Barrier removed!");
     game.getWorld().getBlockAt(barrier.getRepairLoc()).setType(Material.AIR);
     barriers.remove(barrier);
   }
 }
 @EventHandler
 public void onGunReload(PlayerInteractEvent e) {
   if (e.getAction().equals(Action.LEFT_CLICK_AIR)
       || e.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
     Player player = e.getPlayer();
     if (plugin.manager.isPlayerInGame(player)) {
       Game game = plugin.manager.getGame(player);
       if (!(game.mode == ArenaStatus.INGAME)) {
         return;
       }
       if (game.getPlayersGun(player) != null) {
         GunManager gunManager = game.getPlayersGun(player);
         if (gunManager.isGun()) {
           Gun gun = gunManager.getGun(player.getInventory().getHeldItemSlot());
           gun.reload();
           gun.updateGun();
         }
       }
     }
   }
 }
  @EventHandler
  public void onZombieHitEvent(EntityDamageByEntityEvent event) throws Exception {
    if (event.getDamager() instanceof Snowball) {
      Snowball snowball = (Snowball) event.getDamager();
      if (snowball.getShooter() instanceof Player) {
        Player player = (Player) snowball.getShooter();
        if (plugin.manager.isPlayerInGame(player)) {
          Game game = plugin.manager.getGame(player);
          GunManager manager = game.getPlayersGun(player);
          if (manager.isGun()) {
            Gun gun = manager.getGun(player.getInventory().getHeldItemSlot());
            int damage = 0;
            if (gun.isPackOfPunched()) damage = gun.getType().packAPunchDamage;
            else damage = gun.getType().damage;
            if (event.getEntity() instanceof Zombie) {
              Zombie zomb = (Zombie) event.getEntity();
              int totalHealth;
              if (gun.getType().name.equalsIgnoreCase("Zombie BFF")) {
                ParticleEffects eff = ParticleEffects.HEART;
                for (int i = 0; i < 30; i++) {
                  float x = (float) (Math.random());
                  float y = (float) (Math.random());
                  float z = (float) (Math.random());
                  eff.sendToPlayer(player, zomb.getLocation(), x, y, z, 1, 1);
                }
              }
              for (Player pl : game.players) {
                pl.playSound(pl.getLocation(), Sound.LAVA_POP, 1.0F, 0.0F);
              }
              if (game.spawnManager.totalHealth().containsKey(event.getEntity())) {
                totalHealth = game.spawnManager.totalHealth().get(event.getEntity());
              } else {
                game.spawnManager.setTotalHealth(event.getEntity(), 20);
                totalHealth = 20;
              }
              if (totalHealth >= 20) {
                zomb.setHealth(20);
                if (game.isDoublePoints()) {
                  plugin.pointManager.addPoints(player, plugin.config.pointsOnHit * 2);
                } else {
                  plugin.pointManager.addPoints(player, plugin.config.pointsOnHit);
                }
                if (game.spawnManager.totalHealth().get(event.getEntity()) <= 20) {
                  zomb.setHealth(game.spawnManager.totalHealth().get(event.getEntity()));
                } else {
                  game.spawnManager.setTotalHealth(event.getEntity(), totalHealth - damage);
                }
                plugin.pointManager.notifyPlayer(player);
              } else if (zomb.getHealth() - damage < 1) {
                OnZombiePerkDrop perkdrop = new OnZombiePerkDrop(plugin);
                perkdrop.perkDrop(zomb, player);
                zomb.remove();
                boolean doublePoints = game.isDoublePoints();
                if (doublePoints) {
                  plugin.pointManager.addPoints(player, plugin.config.pointsOnKill * 2);
                } else {
                  plugin.pointManager.addPoints(player, plugin.config.pointsOnKill);
                }

                zomb.playEffect(EntityEffect.DEATH);
                plugin.pointManager.notifyPlayer(player);
                game.spawnManager.removeEntity((Entity) zomb);
                game.zombieKilled(player);
                if (game.spawnManager.getEntities().size() <= 0) {
                  game.nextWave();
                }
              } else {
                event.setDamage(damage);
                boolean doublePoints = game.isDoublePoints();
                if (doublePoints) {
                  plugin.pointManager.addPoints(player, plugin.config.pointsOnHit * 2);
                } else {
                  plugin.pointManager.addPoints(player, plugin.config.pointsOnHit);
                }
                plugin.pointManager.notifyPlayer(player);
              }
              if (game.isInstaKill()) {
                zomb.remove();
              }
            }
          }
        }
      }
    }
  }