Ejemplo n.º 1
0
  // /town list [faction]
  public static void list(Player player, String factionName) {
    ArrayList<PlayerTown> towns = PlayerTowns.getAll();

    // TODO: Implement page # functionality

    // TODO: Check to see if faction is valid

    // Sorts the towns by level
    Collections.sort(towns);

    if (factionName.equals("")) Util.message(player, "List of all towns: (" + towns.size() + ")");
    else Util.message(player, "List of all towns for " + factionName + " faction:");

    for (PlayerTown town : towns) {
      if (Factions.getName(town.id_Faction).equalsIgnoreCase(factionName) || factionName.equals(""))
        Util.message(
            player,
            Factions.getName(town.id_Faction)
                + ": "
                + town.townName
                + " ("
                + town.getLevel().name
                + ")");
    }
  }
Ejemplo n.º 2
0
  // /town info [town_name]
  public static void info(Player player, String townName) {
    PlayerData playerData = Players.get(player.getName());
    PlayerTown playerTown = PlayerTowns.get(townName);

    // Check to see if specified town exists
    if (playerTown == null) {
      Util.message(player, "The town '" + townName + "' does not exist.");
      return;
    }

    Util.message(player, "Info for " + townName + ":");
    Util.message(player, "   Faction: " + Factions.getName(playerTown.id_Faction));
    Util.message(
        player,
        "   Level: " + playerTown.getLevel().name + " (" + playerTown.townLevel.level + ")");
    Util.message(player, "   Mayor: " + playerTown.mayor);
    if (playerData.townName.equalsIgnoreCase(townName)) {
      Util.message(player, "   Total Balance: " + iConomy.format(playerTown.treasuryBalance));
      Util.message(player, "   Minimum Balance:  " + iConomy.format(playerTown.minimumBalance));
      Util.message(player, "   Your Balance:  " + iConomy.format(playerData.treasuryBalance));
    }
  }