Example #1
0
  @EventHandler
  public void onPlayerStopFlying(PlayerToggleFlightEvent e) {

    Player p = e.getPlayer();

    if (ArenaManager.isPlayerPlaying(p)
        && ArenaManager.getPlayersArena(p).getState() == Arena.ArenaState.INGAME) {
      if (!e.isFlying()) {
        e.setCancelled(true);
        p.setFlying(true);
      }
    }
  }
Example #2
0
  @EventHandler
  public void onPlayerLeave(PlayerQuitEvent e) {

    Player p = e.getPlayer();

    if (ArenaManager.isPlayerPlaying(p)) {

      e.setQuitMessage("");

      Arena arena = ArenaManager.getPlayersArena(p);
      ArenaManager.leave(arena, p, true);
    }
  }
Example #3
0
  @EventHandler
  public void onPlayerBreakBlock(BlockBreakEvent e) {

    Player p = e.getPlayer();

    if (ArenaManager.isPlayerPlaying(p)) {
      e.setCancelled(true);
    }
  }
Example #4
0
  @EventHandler
  public void onPlayerShoot(PlayerInteractEvent e) {

    Player p = e.getPlayer();

    if (ArenaManager.isPlayerPlaying(p)) {
      if (e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR) {
        if ((e.getItem() != null) && (p.getItemInHand() != null)) {
          if (Objects.equals(
              e.getItem().getItemMeta().getDisplayName(), WeaponManager.WEAPON_NAME)) {
            if (NexusGame.isParticleEffectLibInstalled()) {
              Effect line = new ShootEffect(NexusGame.effects.getEffectManager());
              line.color = Color.PURPLE;
              line.setEntity(p);
              line.setTargetLocation(
                  p.getTargetBlock(Sets.<Material>newHashSet(), 100).getLocation());

              NexusGame.effects.playEffect(line);
            }
          }
        }
      }
    }
  }