public void listAll() { Message m = new Message(player); DecimalFormat newFormat = new DecimalFormat("#.##"); m.successMessage("List of stocks:"); for (PlayerStock ps : stock.values()) m.regularMessage( ps.stock.getID() + " - Current Amount: " + ps.stock.getAmount() + " - Price: " + newFormat.format(ps.stock.getPrice()) + " " + StockMarket.economy.currencyNamePlural()); }
public void listMine() { Message m = new Message(player); DecimalFormat newFormat = new DecimalFormat("#.##"); if (!hasStocks()) { m.errorMessage("You don't own any stocks. /sm help for help."); return; } m.successMessage("List of your stocks:"); for (PlayerStock ps : stock.values()) if (ps.amount > 0) m.regularMessage( ps.stock.getID() + " - Amount: " + ps.amount + " - Price: " + newFormat.format(ps.stock.getPrice()) + " " + StockMarket.economy.currencyNamePlural()); }