// A method to find a person given an incomplete string;
  public Vector<String> find(String name) {
    Set<String> players = plugin.playerdata.keySet();
    OfflinePlayer[] playernames = plugin.getServer().getOfflinePlayers();
    Vector<String> list = new Vector<String>();
    for (Iterator<String> i = players.iterator(); i.hasNext(); ) {

      String nametest = i.next();
      for (OfflinePlayer person : playernames) {
        if (nametest.equalsIgnoreCase(person.getName())) {
          nametest = person.getName();
        }
      }
      if (nametest.toLowerCase().contains(name.toLowerCase())
          && !nametest.equalsIgnoreCase(player.getName())) {
        list.add(nametest);
        if (nametest.equalsIgnoreCase(name)) {
          list.clear();
          list.add(nametest);
          return list;
        }
      }
    }
    return list;
  }
  @Override
  public Prompt acceptInput(ConversationContext arg0, String arg) {
    if (arg.startsWith("/")) {
      arg = arg.substring(1);
    }
    String[] args = arg.split(" ");
    if (args.length != 1 && args.length != 2 && args.length != 3 && args.length != 4)
      return new ManageMoney(plugin, player, 2);
    if (!inputs.containsKey(args[0].toLowerCase())) return new ManageMoney(plugin, player, 1);

    // Deposit
    if (args[0].equalsIgnoreCase("Deposit") && args.length == 2) {
      try {
        BigDecimal amount = new BigDecimal(args[1]).abs();
        amount = cut(amount);
        if (amount.compareTo(PDI.getMoneyOnHand()) == 1) {
          return new ManageMoney(plugin, player, 3);
        } else {
          PDI.transferMoneyToBank(amount);
          return new ManageMoney(plugin, player, 0);
        }
      } catch (Exception ex) {
        return new ManageMoney(plugin, player, 4);
      }
    }

    // Withdraw
    if (args[0].equalsIgnoreCase("Withdraw") && args.length == 2) {
      try {
        BigDecimal amount = new BigDecimal(args[1]).abs();
        amount = cut(amount);
        if (amount.compareTo(PDI.getMoneyInBank()) == 1) {
          return new ManageMoney(plugin, player, 5);
        } else {
          PDI.transferMoneyToBank(amount.negate());
          return new ManageMoney(plugin, player, 0);
        }
      } catch (Exception ex) {
        return new ManageMoney(plugin, player, 4);
      }
    }

    // Pay
    if (args[0].equalsIgnoreCase("Pay") && args.length == 3) {

      if (find(args[1]).size() == 1) args[1] = find(args[1]).get(0);
      else if (find(args[1]).size() == 0) return new ManageMoney(plugin, player, 6);
      else return new ManageMoney(plugin, player, 9, find(args[1]));

      PlayerData targetPDI = plugin.playerdata.get(args[1].toLowerCase());
      try {
        BigDecimal amount = new BigDecimal(args[2]).abs();
        amount = cut(amount);
        if (amount.compareTo(PDI.getMoneyOnHand()) == 1) return new ManageMoney(plugin, player, 3);
        PDI.transferMoney(amount, args[1]);
        if (plugin.getServer().getOfflinePlayer(args[1]).isOnline()) {
          plugin
              .getServer()
              .getPlayer(args[1])
              .sendRawMessage(
                  player.getName()
                      + " has paid you "
                      + cut(
                          amount
                              .divide(PDI.getMoneyMultiplyer())
                              .multiply(targetPDI.getMoneyMultiplyer()))
                      + " "
                      + targetPDI.getPluralMoney());
        }
        return new ManageMoney(plugin, player, 0);
      } catch (Exception ex) {
        ex.printStackTrace();
        return new ManageMoney(plugin, player, 4);
      }
    }

    // Take Out Loan
    if (args[0].equalsIgnoreCase("Take") && args.length == 4) {
      try {
        BigDecimal amount = new BigDecimal(args[3]).abs();
        amount = cut(amount);
        if (amount.compareTo((PDI.getMaxLoan().subtract(PDI.getLoanAmount()))) == 1) {
          return new ManageMoney(plugin, player, 7);
        } else {
          PDI.addLoan(amount);
          PDI.addMoney(amount);
          return new ManageMoney(plugin, player, 0);
        }
      } catch (Exception ex) {
        return new ManageMoney(plugin, player, 4);
      }
    }

    // Repay Loan
    if (args[0].equalsIgnoreCase("Repay") && args.length == 3) {
      try {
        BigDecimal amount = new BigDecimal(args[2]).abs();
        amount = cut(amount);
        if (amount.compareTo(PDI.getLoanAmount()) > 0) {
          return new ManageMoney(plugin, player, 8);
        }
        if (amount.compareTo(PDI.getMoneyOnHand()) > 0) {
          return new ManageMoney(plugin, player, 3);
        } else {
          PDI.removeLoan(amount);
          PDI.removeMoney(amount);
          return new ManageMoney(plugin, player, 0);
        }
      } catch (Exception ex) {
        return new ManageMoney(plugin, player, 4);
      }
    }
    // Back
    if (args[0].equalsIgnoreCase("back")) return new HudConversationMain(plugin, player, 0);
    return new ManageMoney(plugin, player, 10);
  }