Solved Sorting Online UUIDS

Discussion in 'Plugin Development' started by johnnyD, Jul 2, 2020.

  1. Offline


    I am taking a list of uuids from a config file and trying to sort out the ones that are online.

    Heres what I have so far for my method, but I keep getting internal erros so im guessing something is null.
  2. @johnnyD
    I would use UUID not string and loop through all online players and add the uuid to a list

    ArrayList<UUID> list = new ArrayList<UUID>();
    for(Player p : Bukkit.getOnlinePlayers()){
  3. Offline


    Im looping through a list of uuids in a config, so I have to use a List<String> since .getStringList requires it.
  4. @johnnyD

    ArrayList<String> onlinePlayers = new ArrayList<String>();
                for(String uuid : this.getConfig().getStringList("players")) {
                    for(Player p : Bukkit.getOnlinePlayers()) {
                return onlinePlayers;
  5. Offline


    @johnnyD Do you want the offline players at the bottom (after online players) of the list or do you want to only have the online players in the list?

    Also, you can get a UUID from a string using UUID#fromString(String), so you don't need a list of type List<String>.
    Last edited: Jul 3, 2020
  6. Offline


    Thanks <3

Share This Page