Ejemplo n.º 1
0
 private void logInvocationError(Exception e, MethodWrapper mwrapper, Arguments newArgs) {
   System.err.println(
       "["
           + BattleArena.getNameAndVersion()
           + " Error] "
           + mwrapper.method
           + " : "
           + mwrapper.obj
           + "  : "
           + newArgs);
   if (newArgs != null && newArgs.args != null) {
     for (Object o : newArgs.args) System.err.println("[Error] object=" + o);
   }
   System.err.println("[Error] Cause=" + e.getCause());
   if (e.getCause() != null) {
     e.getCause().printStackTrace();
     Log.printStackTrace(e.getCause());
   }
   System.err.println("[Error] Trace Continued ");
   Log.printStackTrace(e);
 }
  public static void teleportOut(
      PlayerHolder am,
      ArenaTeam team,
      ArenaPlayer player,
      TransitionOptions mo,
      int teamIndex,
      boolean insideArena,
      boolean onlyInMatch,
      boolean wipeInventory) {
    MatchParams mp = am.getParams();
    Location loc = null;
    ArenaLocation src = player.getCurLocation();
    final LocationType type;
    if (mo.hasOption(TransitionOption.TELEPORTTO)) {
      loc = mo.getTeleportToLoc();
      type = LocationType.CUSTOM;
    } else {
      type = LocationType.HOME;
      loc = player.getOldLocation();
      /// TODO
      /// This is a bit of a kludge, sometimes we are "teleporting them out"
      /// when they are already out... so need to rethink how this can happen and should it
      if (loc == null && src.getType() == LocationType.HOME) {
        loc = src.getLocation();
      }
    }
    player.clearOldLocation();
    if (loc == null) {
      Log.err(
          BattleArena.getNameAndVersion()
              + " Teleporting to a null location!  teleportTo="
              + mo.hasOption(TransitionOption.TELEPORTTO));
    }

    ArenaLocation dest = new ArenaLocation(AbstractAreaContainer.HOMECONTAINER, loc, type);
    ArenaPlayerTeleportEvent apte =
        new ArenaPlayerTeleportEvent(
            am.getParams().getType(), player, team, src, dest, TeleportDirection.OUT);
    movePlayer(player, apte, mp);
  }