Solved Converting UUID From File to Name In Chat

Discussion in 'BungeeCord Plugin Development' started by ryans1230, Jun 5, 2016.

Thread Status:
Not open for further replies.
  1. I've got a list of UUID's saved to a yml file that I am trying to resolve and put into a chat message. The only problem is I am having troubles figuring out how to match their UUID to their in-game name, then sending their name through sendMessage. The only problem is, I can't think of the correct way to do it.

    Can someone help point me in the right direction of where I should begin with getting the UUID of a player in game, and checking if it equals a UUID on file in a config.

    Thank you very much :)
     
  2. Store the UUID in the config along with the name of the player it goes against and update it when the player joins the server.

    ALTERNATIVELY if you already have only UUID's int he config i will go find the way to get an offline players name, but this method should only be used when NEEDED, so its prefferable that you only load the names onEnable or when the player joins the server.

    EDIT:

    https://gist.github.com/evilmidget38/a5c971d2f2b2c3b3fb37 This is for getting an offline players name otherwise if the player is online use Server.getPlayer(UUID)
     
  3. Here's the code I'm trying to work with:

    Code (Text):

    for (String key : DataManager.getRanks().keySet())
    {

        ProxiedPlayer p = ProxyServer.getInstance().getPlayer(key);
        if (p != null)
        {
            send = false;
            if (!DataManager.getHiddenPlayers().contains(key)) {
                s.sendMessage(TextComponent.fromLegacyText(
                        ChatColor.translateAlternateColorCodes('&', DataManager.getOnline().replace("{username}", key)
                                .replace("{online_at_server}", p.getServer().getInfo().getName())
                                .replace("{rank}", (CharSequence)DataManager.getPrefixes().get(DataManager.getRanks().get(key))))));
     
     
  4. As and what's wrong with it? I mean yeah it's code, but it's code I can't directly try because I don't have the libraries or the full code, also I don't even know what these variables are:

    Send
    S
    Key

    And I have no clue what code is in

    DataManager
    ProxiedPlayer

    Which means with no error, no attempts at debugging to find out where the code stops I can't actually tell you what's wrong with the code nor how to fix it :/
     
  5. Send is a boolean to actually sending the message to the player.
    S is the sender of the command
    Key is the is the uuid I am getting from the file.

    DataManager is how I am accessing the file to get the different sections.
    ProxiedPlayer is checking every player connected to the network against the file.

    The problem is right now it's only spitting out UUID, and I can't seem to figure out the correct method to resolving the player's uuid when the command is executed. When I try to set another String get the player name from the key, I get a null pointer exception.
     
Thread Status:
Not open for further replies.