Solved Setting Rank does not work.

Discussion in 'Plugin Development' started by Uranium_Ape, Mar 23, 2020.

  1. Offline

    Uranium_Ape

    Hi, when I try and use my setRank() function, it works but instead of a rank name, I get null.. I know it has something to do with
    Code:
    String getRank = plugin.getConfig().getString("player." + player.getUniqueId().toString() + ".ranks");
    I just don't know what.. It looks correct to me.


    Full Function:

    Code:
    public void setRank(Player player) {
            String getRank = plugin.getConfig().getString("player." + player.getUniqueId().toString() + ".ranks");
          
            player.setDisplayName(ChatColor.DARK_GREEN + "-" + getRank + ChatColor.DARK_GREEN + "- " + ChatColor.GREEN + player.getName() + ChatColor.WHITE);
            player.setPlayerListName(ChatColor.DARK_GREEN + "-" + getRank + ChatColor.DARK_GREEN + "-" + ChatColor.GREEN + player.getName());
          
        }
    EDIT: Never mind, I spent the past 40 minutes trying to figure it out myself only for me to figure out I put "player." not "players." lol..
     
    Last edited: Mar 23, 2020

Share This Page