Ideas for creating table

Discussion in 'Plugin Development' started by seang96, Jul 17, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    seang96

    I would like to make a automated nice format for a chat table with the following code. I am relatively new to java, and the formatting in minecraft's chats very limited. If anyone has an idea besides a chat table, please share! Thanks.
    Note:Line 9 and 11 are the messages that I wish to be formated.


    Code:java
    1. } else if (args.length > 1 && args[1].equalsIgnoreCase("list")
    2. || list == true) {
    3. int i = data.getInt("Total");
    4. int printed_items = 0;
    5. while (i > 0 && printed_items < 10) {
    6. if (data.getString("Transactions." + i + ".Player").equals(
    7. ((Player) sender).getDisplayName())) {
    8. if (printed_items == 0) {
    9. p.sendMessage(String.format("[" + ChatColor.LIGHT_PURPLE + "%s" + ChatColor.RESET + "] " + ChatColor.GOLD + "ID " + ChatColor.AQUA + "Item " + ChatColor.GREEN + "Amount " + ChatColor.DARK_PURPLE + "Price/Unit " + ChatColor.DARK_AQUA + "Total Price " + ChatColor.RED + "Status", getDescription().getName()));
    10. }
    11. p.sendMessage(String.format("[" + ChatColor.LIGHT_PURPLE + "%s" + ChatColor.RESET + "] " + ChatColor.GOLD + i + " " + ChatColor.AQUA + Material.getMaterial(data.getInt("Transactions." + i + ".Item")) + " " + ChatColor.GREEN + data.getInt("Transactions." + i + ".TotalAmount") + " " + ChatColor.DARK_PURPLE + data.getInt("Transactions." + i + ".Price") + " " + ChatColor.DARK_AQUA + data.getInt("Transactions." + i + ".Price") * data.getInt("Transactions." + i + ".TotalAmount") + " " + ChatColor.RED +data.getString("Transactions." + i + ".Status"), getDescription().getName()));
    12. printed_items++;
    13. }
    14. else if (printed_items == 0 && i == 0){
    15. p.sendMessage(String.format("[" + ChatColor.LIGHT_PURPLE + "%s" + ChatColor.RESET + "] " + ChatColor.GOLD + "You do not have any transactions on sale.", getDescription().getName()));
    16. return false;
    17. }
    18. i--;
    19. }


    bump still looking for ideas.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
Thread Status:
Not open for further replies.

Share This Page