Example #1
0
 public List<String> getStats() {
   List<String> output = new ArrayList<String>();
   output.add(ChatTools.formatTitle("War Stats"));
   output.add(Colors.Green + "  Nations: " + Colors.LightGreen + warringNations.size());
   output.add(
       Colors.Green
           + "  Towns: "
           + Colors.LightGreen
           + warringTowns.size()
           + " / "
           + townScores.size());
   output.add(Colors.Green + "  WarZone: " + Colors.LightGreen + warZone.size() + " Town blocks");
   try {
     output.add(
         Colors.Green
             + "  Spoils of War: "
             + Colors.LightGreen
             + warSpoils.getHoldingBalance()
             + " "
             + TownyEconomyObject.getEconomyCurrency());
     return output;
   } catch (EconomyException e) {
   }
   return null;
 }
Example #2
0
  static {
    ta_help.add(ChatTools.formatTitle("/townyadmin"));
    ta_help.add(
        ChatTools.formatCommand(
            "", "/townyadmin", "", TownySettings.getLangString("admin_panel_1")));
    ta_help.add(
        ChatTools.formatCommand(
            "",
            "/townyadmin",
            "set [] .. []",
            "'/townyadmin set' " + TownySettings.getLangString("res_5")));
    ta_help.add(ChatTools.formatCommand("", "/townyadmin", "unclaim [radius]", ""));
    ta_help.add(ChatTools.formatCommand("", "/townyadmin", "town/nation", ""));
    ta_help.add(ChatTools.formatCommand("", "/townyadmin", "givebonus [town/player] [num]", ""));
    ta_help.add(ChatTools.formatCommand("", "/townyadmin", "toggle neutral/war/debug/devmode", ""));

    // TODO: ta_help.add(ChatTools.formatCommand("", "/townyadmin",
    // "npc rename [old name] [new name]", ""));
    // TODO: ta_help.add(ChatTools.formatCommand("", "/townyadmin",
    // "npc list", ""));
    ta_help.add(
        ChatTools.formatCommand(
            "", "/townyadmin", "reload", TownySettings.getLangString("admin_panel_2")));
    ta_help.add(ChatTools.formatCommand("", "/townyadmin", "reset", ""));
    ta_help.add(ChatTools.formatCommand("", "/townyadmin", "backup", ""));
    ta_help.add(
        ChatTools.formatCommand(
            "", "/townyadmin", "newday", TownySettings.getLangString("admin_panel_3")));
    ta_help.add(ChatTools.formatCommand("", "/townyadmin", "purge [number of days]", ""));
    ta_help.add(
        ChatTools.formatCommand(
            "", "/townyadmin", "delete [] .. []", "delete a residents data files."));

    ta_unclaim.add(ChatTools.formatTitle("/townyadmin unclaim"));
    ta_unclaim.add(
        ChatTools.formatCommand(
            TownySettings.getLangString("admin_sing"),
            "/townyadmin unclaim",
            "",
            TownySettings.getLangString("townyadmin_help_1")));
    ta_unclaim.add(
        ChatTools.formatCommand(
            TownySettings.getLangString("admin_sing"),
            "/townyadmin unclaim",
            "[radius]",
            TownySettings.getLangString("townyadmin_help_2")));
  }
Example #3
0
 /**
  * @param maxListing Maximum lines to return. Value of -1 return all.
  * @return A list of the current scores per town sorted in descending order.
  */
 public List<String> getScores(int maxListing) {
   List<String> output = new ArrayList<String>();
   output.add(ChatTools.formatTitle("War - Top Scores"));
   KeyValueTable<Town, Integer> kvTable = new KeyValueTable<Town, Integer>(townScores);
   kvTable.sortByValue();
   kvTable.revese();
   int n = 0;
   for (KeyValue<Town, Integer> kv : kvTable.getKeyValues()) {
     n++;
     if (maxListing != -1 && n > maxListing) break;
     Town town = (Town) kv.key;
     output.add(
         String.format(
             Colors.Blue + "%40s " + Colors.Gold + "|" + Colors.LightGray + " %4d",
             TownyFormatter.getFormattedName(town),
             (Integer) kv.value));
   }
   return output;
 }
Example #4
0
  public void parseToggleCommand(String[] split) throws TownyException {

    boolean choice;

    if (split.length == 0) {
      // command was '/townyadmin toggle'
      player.sendMessage(ChatTools.formatTitle("/townyadmin toggle"));
      player.sendMessage(ChatTools.formatCommand("", "/townyadmin toggle", "war", ""));
      player.sendMessage(ChatTools.formatCommand("", "/townyadmin toggle", "neutral", ""));
      player.sendMessage(ChatTools.formatCommand("", "/townyadmin toggle", "devmode", ""));
      player.sendMessage(ChatTools.formatCommand("", "/townyadmin toggle", "debug", ""));
      player.sendMessage(
          ChatTools.formatCommand("", "/townyadmin toggle", "townwithdraw/nationwithdraw", ""));
      player.sendMessage(ChatTools.formatCommand("", "/townyadmin toggle npc", "[resident]", ""));
      return;
    }

    if (!TownyUniverse.getPermissionSource()
        .testPermission(
            player,
            PermissionNodes.TOWNY_COMMAND_TOWNYADMIN_TOGGLE.getNode(split[0].toLowerCase())))
      throw new TownyException(TownySettings.getLangString("msg_err_command_disable"));

    if (split[0].equalsIgnoreCase("war")) {
      choice = TownyUniverse.isWarTime();

      if (!choice) {
        plugin.getTownyUniverse().startWarEvent();
        TownyMessaging.sendMsg(getSender(), TownySettings.getLangString("msg_war_started"));
      } else {
        plugin.getTownyUniverse().endWarEvent();
        TownyMessaging.sendMsg(getSender(), TownySettings.getLangString("msg_war_ended"));
      }
    } else if (split[0].equalsIgnoreCase("neutral")) {

      try {
        choice = !TownySettings.isDeclaringNeutral();
        TownySettings.setDeclaringNeutral(choice);
        TownyMessaging.sendMsg(
            getSender(),
            String.format(
                TownySettings.getLangString("msg_nation_allow_neutral"),
                choice ? "Enabled" : "Disabled"));

      } catch (Exception e) {
        TownyMessaging.sendErrorMsg(
            getSender(), TownySettings.getLangString("msg_err_invalid_choice"));
        return;
      }

    } else if (split[0].equalsIgnoreCase("devmode")) {
      try {
        choice = !TownySettings.isDevMode();
        TownySettings.setDevMode(choice);
        TownyMessaging.sendMsg(
            getSender(),
            "Dev Mode " + (choice ? Colors.Green + "Enabled" : Colors.Red + "Disabled"));
      } catch (Exception e) {
        TownyMessaging.sendErrorMsg(
            getSender(), TownySettings.getLangString("msg_err_invalid_choice"));
      }
    } else if (split[0].equalsIgnoreCase("debug")) {
      try {
        choice = !TownySettings.getDebug();
        TownySettings.setDebug(choice);
        TownyMessaging.sendMsg(
            getSender(),
            "Debug Mode " + (choice ? Colors.Green + "Enabled" : Colors.Red + "Disabled"));
      } catch (Exception e) {
        TownyMessaging.sendErrorMsg(
            getSender(), TownySettings.getLangString("msg_err_invalid_choice"));
      }
    } else if (split[0].equalsIgnoreCase("townwithdraw")) {
      try {
        choice = !TownySettings.getTownBankAllowWithdrawls();
        TownySettings.SetTownBankAllowWithdrawls(choice);
        TownyMessaging.sendMsg(
            getSender(),
            "Town Withdrawls " + (choice ? Colors.Green + "Enabled" : Colors.Red + "Disabled"));
      } catch (Exception e) {
        TownyMessaging.sendErrorMsg(
            getSender(), TownySettings.getLangString("msg_err_invalid_choice"));
      }
    } else if (split[0].equalsIgnoreCase("nationwithdraw")) {
      try {
        choice = !TownySettings.geNationBankAllowWithdrawls();
        TownySettings.SetNationBankAllowWithdrawls(choice);
        TownyMessaging.sendMsg(
            getSender(),
            "Nation Withdrawls " + (choice ? Colors.Green + "Enabled" : Colors.Red + "Disabled"));
      } catch (Exception e) {
        TownyMessaging.sendErrorMsg(
            getSender(), TownySettings.getLangString("msg_err_invalid_choice"));
      }

    } else if (split[0].equalsIgnoreCase("npc")) {

      if (split.length != 2)
        throw new TownyException(
            String.format(
                TownySettings.getLangString("msg_err_invalid_input"), "Eg: toggle npc [resident]"));

      try {
        Resident resident = TownyUniverse.getDataSource().getResident(split[1]);
        resident.setNPC(!resident.isNPC());

        TownyUniverse.getDataSource().saveResident(resident);

        TownyMessaging.sendMessage(
            sender,
            String.format(
                TownySettings.getLangString("msg_npc_flag"), resident.isNPC(), resident.getName()));

      } catch (NotRegisteredException x) {
        throw new TownyException(
            String.format(TownySettings.getLangString("msg_err_not_registered_1"), split[1]));
      }

    } else {
      // parameter error message
      // neutral/war/townmobs/worldmobs
      TownyMessaging.sendErrorMsg(
          getSender(), TownySettings.getLangString("msg_err_invalid_choice"));
    }
  }
Example #5
0
  /**
   * Remove residents who havn't logged in for X amount of days.
   *
   * @param split
   */
  public void purge(String[] split) {

    if (split.length == 0) {
      // command was '/townyadmin purge'
      player.sendMessage(ChatTools.formatTitle("/townyadmin purge"));
      player.sendMessage(ChatTools.formatCommand("", "/townyadmin purge", "[number of days]", ""));
      player.sendMessage(
          ChatTools.formatCommand(
              "", "", "Removes offline residents not seen for this duration.", ""));

      return;
    }

    int days = 1;

    try {
      days = Integer.parseInt(split[0]);
    } catch (NumberFormatException e) {
      TownyMessaging.sendErrorMsg(
          getSender(), TownySettings.getLangString("msg_error_must_be_int"));
      return;
    }

    // Use questioner to confirm.
    Plugin test = BukkitTools.getServer().getPluginManager().getPlugin("Questioner");

    if (this.sender instanceof Player
        && TownySettings.isUsingQuestioner()
        && test != null
        && test instanceof Questioner
        && test.isEnabled()) {
      Questioner questioner = (Questioner) test;
      questioner.loadClasses();

      List<Option> options = new ArrayList<Option>();
      options.add(
          new Option(
              TownySettings.questionerAccept(),
              new PurgeQuestionTask(plugin, this.sender, TimeTools.getMillis(days + "d"))));
      options.add(
          new Option(
              TownySettings.questionerDeny(),
              new PurgeQuestionTask(plugin, this.sender, TimeTools.getMillis(days + "d")) {

                @Override
                public void run() {

                  TownyMessaging.sendMessage(getSender(), "Purge Aborted!");
                }
              }));

      Question question =
          new Question(this.sender.getName(), "Do you really want to perform this purge", options);

      try {
        plugin.appendQuestion(questioner, question);
      } catch (Exception e) {
        System.out.println(e.getMessage());
      }
    } else {

      // Run a purge in it's own thread
      new ResidentPurge(plugin, this.sender, TimeTools.getMillis(days + "d")).start();
    }
  }
Example #6
0
  public void adminSet(String[] split) throws TownyException {

    if (split.length == 0) {
      sender.sendMessage(ChatTools.formatTitle("/townyadmin set"));
      // TODO: player.sendMessage(ChatTools.formatCommand("",
      // "/townyadmin set", "king [nation] [king]", ""));
      sender.sendMessage(
          ChatTools.formatCommand(
              "",
              "/townyadmin set",
              "mayor [town] " + TownySettings.getLangString("town_help_2"),
              ""));
      sender.sendMessage(ChatTools.formatCommand("", "/townyadmin set", "mayor [town] npc", ""));
      // player.sendMessage(ChatTools.formatCommand("", "/townyadmin set",
      // "debugmode [on/off]", ""));
      // player.sendMessage(ChatTools.formatCommand("", "/townyadmin set",
      // "devmode [on/off]", ""));

      return;
    }

    if (!TownyUniverse.getPermissionSource()
        .testPermission(
            player, PermissionNodes.TOWNY_COMMAND_TOWNYADMIN_SET.getNode(split[0].toLowerCase())))
      throw new TownyException(TownySettings.getLangString("msg_err_command_disable"));

    if (split[0].equalsIgnoreCase("mayor")) {
      if (split.length < 3) {

        sender.sendMessage(ChatTools.formatTitle("/townyadmin set mayor"));
        sender.sendMessage(
            ChatTools.formatCommand(
                "Eg",
                "/townyadmin set mayor",
                "[town] " + TownySettings.getLangString("town_help_2"),
                ""));
        sender.sendMessage(
            ChatTools.formatCommand("Eg", "/townyadmin set mayor", "[town] npc", ""));

      } else
        try {
          Resident newMayor = null;
          Town town = TownyUniverse.getDataSource().getTown(split[1]);

          if (split[2].equalsIgnoreCase("npc")) {
            String name = nextNpcName();
            TownyUniverse.getDataSource().newResident(name);

            newMayor = TownyUniverse.getDataSource().getResident(name);

            newMayor.setRegistered(System.currentTimeMillis());
            newMayor.setLastOnline(0);
            newMayor.setNPC(true);

            TownyUniverse.getDataSource().saveResident(newMayor);
            TownyUniverse.getDataSource().saveResidentList();

            // set for no upkeep as an NPC mayor is assigned
            town.setHasUpkeep(false);

          } else {
            newMayor = TownyUniverse.getDataSource().getResident(split[2]);

            // set upkeep again
            town.setHasUpkeep(true);
          }

          if (!town.hasResident(newMayor)) TownCommand.townAddResident(town, newMayor);
          // Delete the resident if the old mayor was an NPC.
          Resident oldMayor = town.getMayor();

          town.setMayor(newMayor);

          if (oldMayor.isNPC()) {
            try {
              town.removeResident(oldMayor);
              TownyUniverse.getDataSource().removeResident(oldMayor);

              TownyUniverse.getDataSource().removeResidentList(oldMayor);

            } catch (EmptyTownException e) {
              // Should never reach here as we are setting a new
              // mayor before removing the old one.
              e.printStackTrace();
            }
          }
          TownyUniverse.getDataSource().saveTown(town);
          String[] msg = TownySettings.getNewMayorMsg(newMayor.getName());
          TownyMessaging.sendTownMessage(town, msg);
          // TownyMessaging.sendMessage(player, msg);
        } catch (TownyException e) {
          TownyMessaging.sendErrorMsg(getSender(), e.getMessage());
        }

    } else if (split[0].equalsIgnoreCase("capital")) {

      if (split.length < 2) {

        sender.sendMessage(ChatTools.formatTitle("/townyadmin set capital"));
        sender.sendMessage(ChatTools.formatCommand("Eg", "/ta set capital", "[town name]", ""));

      } else {

        try {
          Town newCapital = TownyUniverse.getDataSource().getTown(split[1]);
          Nation nation = newCapital.getNation();

          nation.setCapital(newCapital);
          plugin.resetCache();

          TownyMessaging.sendNationMessage(
              nation,
              TownySettings.getNewKingMsg(newCapital.getMayor().getName(), nation.getName()));

          TownyUniverse.getDataSource().saveNation(nation);
          TownyUniverse.getDataSource().saveNationList();

        } catch (TownyException e) {
          TownyMessaging.sendErrorMsg(player, e.getMessage());
        }
      }

    } else {
      TownyMessaging.sendErrorMsg(
          getSender(),
          String.format(TownySettings.getLangString("msg_err_invalid_property"), "administrative"));
      return;
    }
  }
Example #7
0
  public void parseAdminNationCommand(String[] split) throws TownyException {

    if (split.length == 0 || split[0].equalsIgnoreCase("?")) {

      sender.sendMessage(ChatTools.formatTitle("/townyadmin nation"));
      sender.sendMessage(
          ChatTools.formatCommand(
              TownySettings.getLangString("admin_sing"), "/townyadmin nation", "[nation]", ""));
      sender.sendMessage(
          ChatTools.formatCommand(
              TownySettings.getLangString("admin_sing"),
              "/townyadmin nation",
              "[nation] add [] .. []",
              ""));
      sender.sendMessage(
          ChatTools.formatCommand(
              TownySettings.getLangString("admin_sing"),
              "/townyadmin nation",
              "[nation] rename [newname]",
              ""));
      sender.sendMessage(
          ChatTools.formatCommand(
              TownySettings.getLangString("admin_sing"),
              "/townyadmin nation",
              "[nation] delete",
              ""));

      return;
    }
    try {
      Nation nation = TownyUniverse.getDataSource().getNation(split[0]);
      if (split.length == 1) {
        TownyMessaging.sendMessage(getSender(), TownyFormatter.getStatus(nation));
        return;
      }

      if (!TownyUniverse.getPermissionSource()
          .testPermission(
              player,
              PermissionNodes.TOWNY_COMMAND_TOWNYADMIN_NATION.getNode(split[1].toLowerCase())))
        throw new TownyException(TownySettings.getLangString("msg_err_command_disable"));

      if (split[1].equalsIgnoreCase("add")) {
        /*
         * if (isConsole) { sender.sendMessage(
         * "[Towny] InputError: This command was designed for use in game only."
         * ); return; }
         */
        NationCommand.nationAdd(
            nation, TownyUniverse.getDataSource().getTowns(StringMgmt.remArgs(split, 2)));

      } else if (split[1].equalsIgnoreCase("delete")) {

        TownyUniverse.getDataSource().removeNation(nation);

      } else if (split[1].equalsIgnoreCase("rename")) {

        if (!NameValidation.isBlacklistName(split[2])) {
          TownyUniverse.getDataSource().renameNation(nation, split[2]);
          TownyMessaging.sendNationMessage(
              nation,
              String.format(
                  TownySettings.getLangString("msg_nation_set_name"),
                  ((getSender() instanceof Player) ? player.getName() : "CONSOLE"),
                  nation.getName()));
        } else
          TownyMessaging.sendErrorMsg(getSender(), TownySettings.getLangString("msg_invalid_name"));
      }

    } catch (NotRegisteredException e) {
      TownyMessaging.sendErrorMsg(getSender(), e.getMessage());
    } catch (AlreadyRegisteredException e) {
      TownyMessaging.sendErrorMsg(getSender(), e.getMessage());
    }
  }
Example #8
0
  public void parseAdminTownCommand(String[] split) throws TownyException {

    // TODO Make this use the actual town command procedually.

    if (split.length == 0 || split[0].equalsIgnoreCase("?")) {
      sender.sendMessage(ChatTools.formatTitle("/townyadmin town"));
      sender.sendMessage(
          ChatTools.formatCommand(
              TownySettings.getLangString("admin_sing"), "/townyadmin town", "[town]", ""));
      sender.sendMessage(
          ChatTools.formatCommand(
              TownySettings.getLangString("admin_sing"),
              "/townyadmin town",
              "[town] add/kick [] .. []",
              ""));
      sender.sendMessage(
          ChatTools.formatCommand(
              TownySettings.getLangString("admin_sing"),
              "/townyadmin town",
              "[town] rename [newname]",
              ""));
      sender.sendMessage(
          ChatTools.formatCommand(
              TownySettings.getLangString("admin_sing"), "/townyadmin town", "[town] delete", ""));
      sender.sendMessage(
          ChatTools.formatCommand(
              TownySettings.getLangString("admin_sing"), "/townyadmin town", "[town] spawn", ""));
      sender.sendMessage(
          ChatTools.formatCommand(
              TownySettings.getLangString("admin_sing"),
              "/townyadmin town",
              "[town] outpost #",
              ""));

      return;
    }

    try {

      Town town = TownyUniverse.getDataSource().getTown(split[0]);

      if (split.length == 1) {
        TownyMessaging.sendMessage(getSender(), TownyFormatter.getStatus(town));
        return;
      }

      if (!TownyUniverse.getPermissionSource()
          .testPermission(
              player,
              PermissionNodes.TOWNY_COMMAND_TOWNYADMIN_TOWN.getNode(split[1].toLowerCase())))
        throw new TownyException(TownySettings.getLangString("msg_err_command_disable"));

      if (split[1].equalsIgnoreCase("add")) {
        /*
         * if (isConsole) { sender.sendMessage(
         * "[Towny] InputError: This command was designed for use in game only."
         * ); return; }
         */
        TownCommand.townAdd(getSender(), town, StringMgmt.remArgs(split, 2));

      } else if (split[1].equalsIgnoreCase("kick")) {

        TownCommand.townKickResidents(
            getSender(),
            town.getMayor(),
            town,
            TownyUniverse.getValidatedResidents(getSender(), StringMgmt.remArgs(split, 2)));

      } else if (split[1].equalsIgnoreCase("delete")) {

        TownyUniverse.getDataSource().removeTown(town);

      } else if (split[1].equalsIgnoreCase("rename")) {

        if (!NameValidation.isBlacklistName(split[2])) {
          TownyUniverse.getDataSource().renameTown(town, split[2]);
          TownyMessaging.sendTownMessage(
              town,
              String.format(
                  TownySettings.getLangString("msg_town_set_name"),
                  ((getSender() instanceof Player) ? player.getName() : "CONSOLE"),
                  town.getName()));
        } else
          TownyMessaging.sendErrorMsg(getSender(), TownySettings.getLangString("msg_invalid_name"));

      } else if (split[1].equalsIgnoreCase("spawn")) {

        TownCommand.townSpawn(player, StringMgmt.remArgs(split, 2), town, "", false);

      } else if (split[1].equalsIgnoreCase("outpost")) {

        TownCommand.townSpawn(player, StringMgmt.remArgs(split, 2), town, "", true);
      }

    } catch (NotRegisteredException e) {
      TownyMessaging.sendErrorMsg(getSender(), e.getMessage());
    } catch (TownyException e) {
      TownyMessaging.sendErrorMsg(getSender(), e.getMessage());
    }
  }
Example #9
0
  private void buildTAPanel() {

    ta_panel.clear();
    Runtime run = Runtime.getRuntime();
    ta_panel.add(ChatTools.formatTitle(TownySettings.getLangString("ta_panel_1")));
    ta_panel.add(
        Colors.Blue
            + "["
            + Colors.LightBlue
            + "Towny"
            + Colors.Blue
            + "] "
            + Colors.Green
            + TownySettings.getLangString("ta_panel_2")
            + Colors.LightGreen
            + TownyUniverse.isWarTime()
            + Colors.Gray
            + " | "
            + Colors.Green
            + TownySettings.getLangString("ta_panel_3")
            + (TownyTimerHandler.isHealthRegenRunning()
                ? Colors.LightGreen + "On"
                : Colors.Rose + "Off")
            + Colors.Gray
            + " | "
            + (Colors.Green
                + TownySettings.getLangString("ta_panel_5")
                + (TownyTimerHandler.isDailyTimerRunning()
                    ? Colors.LightGreen + "On"
                    : Colors.Rose + "Off")));
    /*
     * ta_panel.add(Colors.Blue + "[" + Colors.LightBlue + "Towny" +
     * Colors.Blue + "] " + Colors.Green +
     * TownySettings.getLangString("ta_panel_4") +
     * (TownySettings.isRemovingWorldMobs() ? Colors.LightGreen + "On" :
     * Colors.Rose + "Off") + Colors.Gray + " | " + Colors.Green +
     * TownySettings.getLangString("ta_panel_4_1") +
     * (TownySettings.isRemovingTownMobs() ? Colors.LightGreen + "On" :
     * Colors.Rose + "Off"));
     *
     * try { TownyEconomyObject.checkEconomy(); ta_panel.add(Colors.Blue +
     * "[" + Colors.LightBlue + "Economy" + Colors.Blue + "] " +
     * Colors.Green + TownySettings.getLangString("ta_panel_6") +
     * Colors.LightGreen + TownyFormatter.formatMoney(getTotalEconomy()) +
     * Colors.Gray + " | " + Colors.Green +
     * TownySettings.getLangString("ta_panel_7") + Colors.LightGreen +
     * getNumBankAccounts()); } catch (Exception e) { }
     */
    ta_panel.add(
        Colors.Blue
            + "["
            + Colors.LightBlue
            + TownySettings.getLangString("ta_panel_8")
            + Colors.Blue
            + "] "
            + Colors.Green
            + TownySettings.getLangString("ta_panel_9")
            + Colors.LightGreen
            + MemMgmt.getMemSize(run.totalMemory())
            + Colors.Gray
            + " | "
            + Colors.Green
            + TownySettings.getLangString("ta_panel_10")
            + Colors.LightGreen
            + Thread.getAllStackTraces().keySet().size()
            + Colors.Gray
            + " | "
            + Colors.Green
            + TownySettings.getLangString("ta_panel_11")
            + Colors.LightGreen
            + TownyFormatter.getTime());
    ta_panel.add(Colors.Yellow + MemMgmt.getMemoryBar(50, run));
  }