@EventHandler(priority = EventPriority.HIGHEST)
 public void teleportHandler(PlayerTeleportEvent e) {
   int game = GameManager.getInstance().getPlayerGameId(e.getPlayer());
   if (game != -1) {
     Game g = GameManager.getInstance().getGame(game);
     if (g.getState() == State.LOBBY) {
       e.setCancelled(true);
     }
   }
 }
 @EventHandler
 public void onEntityDeath(EntityShootBowEvent e) {
   if (e.getEntity() instanceof Player) {
     Player p = (Player) e.getEntity();
     int game = GameManager.getInstance().getPlayerGameId(p);
     if (game != -1) {
       gm.getGame(game).getPlayerClass(p).PlayerShootArrow(e.getProjectile());
     }
   }
 }
  @EventHandler
  public void onEntityDamaged(EntityDamageEvent e) {
    if (e.getEntity() instanceof Player) {
      Player p = (Player) e.getEntity();
      int game = GameManager.getInstance().getPlayerGameId(p);
      if (game != -1) {
        Game g = gm.getGame(game);
        if (g.getState() == Game.State.INGAME) {

          g.getPlayerClass(p).PlayerDamaged();
        }
      }
    }
  }
 @EventHandler(priority = EventPriority.LOWEST)
 public void blockFire(BlockIgniteEvent e) {
   System.out.println("lighing");
   final Block b = e.getBlock();
   Bukkit.getScheduler()
       .scheduleSyncDelayedTask(
           GameManager.getInstance().getPlugin(),
           new Runnable() {
             public void run() {
               b.setTypeId(0);
               b.getState().update();
             }
           },
           60);
 }
 @EventHandler
 public void onEntityRespawn(PlayerRespawnEvent e) {
   final Player p = e.getPlayer();
   Bukkit.getScheduler()
       .scheduleSyncDelayedTask(
           GameManager.getInstance().getPlugin(),
           new Runnable() {
             public void run() {
               int id = gm.getPlayerGameId(p);
               if (id != -1) {
                 gm.getGame(id).spawnPlayer(p);
                 gm.getPlayerClass(p).PlayerSpawn();
               } else {
                 p.teleport(SettingsManager.getInstance().getLobbySpawn());
               }
             }
           },
           1);
 }
 public PlayerClassEvents() {
   gm = GameManager.getInstance();
 }