@Override
  protected void runImpl() {
    if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(_arena)) return;
    Player activeChar = getClient().getActiveChar();
    if (activeChar == null || activeChar.isDead()) return;

    switch (_team) {
      case 0:
      case 1:
        // Change Player Team
        HandysBlockCheckerManager.getInstance().changePlayerToTeam(activeChar, _arena, _team);
        break;
      case -1:
        {
          int team =
              HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(activeChar);
          // client sends two times this packet if click on exit
          // client did not send this packet on restart
          if (team > -1)
            HandysBlockCheckerManager.getInstance().removePlayer(activeChar, _arena, team);
          break;
        }
      default:
        _log.warn("Wrong Team ID: " + _team);
        break;
    }
  }
Beispiel #2
0
  public static boolean checkPlayer(Player player) {
    if (player.isDead()) {
      show(new CustomMessage("scripts.events.Hitman.CancelledDead", player), player);
      return false;
    }

    if (player.getTeam() != TeamType.NONE) {
      show(new CustomMessage("scripts.events.Hitman.CancelledOtherEvent", player), player);
      return false;
    }

    if (player.isMounted()) {
      show(new CustomMessage("scripts.events.Hitman.Cancelled", player), player);
      return false;
    }

    if (player.isCursedWeaponEquipped()) {
      show(new CustomMessage("scripts.events.Hitman.Cancelled", player), player);
      return false;
    }

    if (player.isInDuel()) {
      show(new CustomMessage("scripts.events.Hitman.CancelledDuel", player), player);
      return false;
    }

    if (player.getOlympiadGame() != null || Olympiad.isRegistered(player)) {
      show(new CustomMessage("scripts.events.Hitman.CancelledOlympiad", player), player);
      return false;
    }

    if (player.isInParty() && player.getParty().isInDimensionalRift()) {
      show(new CustomMessage("scripts.events.Hitman.CancelledOtherEvent", player), player);
      return false;
    }

    if (player.isInObserverMode()) {
      show(new CustomMessage("scripts.events.Hitman.CancelledObserver", player), player);
      return false;
    }

    if (player.isTeleporting()) {
      show(new CustomMessage("scripts.events.Hitman.CancelledTeleport", player), player);
      return false;
    }

    return true;
  }