Search getOnlinePlayers() for certain names?

Discussion in 'Plugin Development' started by Razorcane, Nov 24, 2011.

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

    Razorcane

    I have a String[] set up to get all the online players, and I also have a HashSet that stores the string of a player's name(from a text file). Is there a way to search my String array for a name that matches a string inside the HashSet?

    I thought about trying a for loop, but the logic for it doesn't make sense. Does anyone know what the issue is?
     
  2. Offline

    shadrxninga

    You could try something like this:

    Code:
    String[] onlineplayers = getOnlinePlayers();
    for(int i = 0; i < onlineplayers.length; i++){
        if(onlineplayers[i].getName().equals("SomeName"){
        //Do something
        }
    }
     
Thread Status:
Not open for further replies.

Share This Page