How do I hide all other players on the server?

Discussion in 'Plugin Development' started by Sir_Mr_Bman, Jul 15, 2014.

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

    Sir_Mr_Bman

    Hello.

    I want to hide all other players on a server.

    I already have my methods to run this, I just need to know how to hide AND unhide every player on the server.

    Thanks!
     
  2. Offline

    ChrystianSandu

    Try this:

    Code:java
    1. for (Player playertohide : Bukkit.getServer().getOnlinePlayers()) {
    2. playertohide.hidePlayer(playertohide);
    3. }
    4. // now you selected all players


    Now, you hide all players
     
  3. Offline

    Sir_Mr_Bman

    ChrystianSandu Thanks for a quick response!

    So, something like this would work?
    Code:java
    1. for (Player playertohide : Bukkit.getServer().getOnlinePlayers()) {
    2. playertohide.hidePlayer(playertohide);
    3. }
    4.  
     
  4. Offline

    ChrystianSandu

    Sorry, my mistake,...
    It is correct as you put. Because playertohide is player (declared)
    Sir_Mr_Bman
     
  5. Sir_Mr_Bman ChrystianSandu Don't spoon-feed code, especially when it's not correct. Maybe what you had before was correct and you changed it, but that's just more confusing. This current code would hide everyone from themselves, nothing more.
     
Thread Status:
Not open for further replies.

Share This Page