getting strings off a config and adding them to command pages

Discussion in 'Plugin Development' started by dan14941, Apr 13, 2014.

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

    dan14941

    Ok so i want to do something that lists the name of companies that have been made but if the amount of companies is bigger than the amount of lines that can fi ton screen it will go onto a different page like if you are searching on factions it has pages.
    Here is my code so far:
    Code:java
    1. else if(args[0].equalsIgnoreCase("list"))
    2. {
    3. List<String> companies = null;
    4. companies = plugin.newCData.getStringList("companies");
    5.  
    6. int pageNumberMax;
    7.  
    8. if(!(companies.size() < 5))
    9. {
    10. pageNumberMax = companies.size() / 6;
    11. }
    12. else
    13. {
    14. pageNumberMax = 1;
    15. }
    16.  
    17. if(!(companies.size() > 6))
    18. {
    19. player.sendMessage(ChatColor.AQUA + "+== Companies ==+");
    20. for(int i = 0; i < companies.size(); i++)
    21. {
    22. player.sendMessage(ChatColor.YELLOW + companies.get(i));
    23. player.sendMessage(ChatColor.GREEN + "page: 1/" + pageNumberMax);
    24. }
    25. }
    26. else if(companies.size() > 6);
    27. {
    28. player.sendMessage(ChatColor.AQUA + "+== Companies ==+");
    29. for(int i = 0; i < companies.size(); i++)
    30. {
    31. player.sendMessage(ChatColor.YELLOW + companies.get(i));
    32. player.sendMessage(ChatColor.GREEN + "page: 1/" + pageNumberMax);
    33. }
    34. }
    35. }


    Im using a custom config called newCData.
    Please if you can not like tell me the exact code but tell me how so then i learn :)

    Bump

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

Share This Page