Solved getPlayer(uuid) does not work

Discussion in 'BungeeCord Plugin Development' started by Henrik, Aug 10, 2018.

Thread Status:
Not open for further replies.
  1. I am trying to send online players in an arraylist a message, but the message is not being sent. I know the uuid is correct and that the player with the uuid is online. Is this a bungeecord bug?
    Code (Text):
    List<String> l1 = (List) d.get("arrayfriends");
                if(l1 != null && l1.size() > 0) {
                    for(String s1 : l1) {
                        System.out.println("s1: " + s1);
                        ProxiedPlayer t = ProxyServer.getInstance().getPlayer(s1);
                        if(t != null) {
                            t.sendMessage(new TextComponent("┬ža" + n + " is online."));
                        }
                    }
                }
     
  2. Try UUID.fromString(s1)
    I guess getPlayer with a string arugment will only work with names. You need an UUID instance
     
    • Winner Winner x 1
  3. UUID's don't work when your server is in offline mode, which is needed for BungeeCord. Not sure if there is a workaround.
     
  4. FrostedSnowman

    Resource Staff

    you need to set bungeecord to true in your spigot.yml
     
    • Like Like x 1
  5. Yep, I figured out that right after I posted this. It solved my issue.
     
Thread Status:
Not open for further replies.