Player.isSleepingIgnored()?

Discussion in 'Plugin Development' started by Zachster, Jan 1, 2014.

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

    Zachster

    Is Player.isSleepingIgnored() the method for checking if a player is in a bed? (true for in bed, false for not in bed)
     
  2. Offline

    Bart

    It will return true if the player is exempt from the "all players need to be in bed for the time to go to day" rule. Not sure what the best way to word that is.

    You can make someone exempt by doing player.setSleepingIgnored(true);

    I could have sworn there is a isSleeping method but I can't seem to find it. In which case, you can use PlayerBedEnterEvent
     
  3. Offline

    Zachster

    Yea I'm wanting to get the number of sleeping players.
     
  4. Offline

    Bart

    Code:java
    1. int num = 0;
    2. for(Player p : getServer().getOnlinePlayers())
    3. {
    4. if(player is sleeping)
    5. num++;
    6. }
    7. }
    8.  

    To check if they are sleeping you should keep track of a list of players that have entered the bed (and remove them from the list if they leave the bed)

    Please remember to add Bart to your message so that I can see this easier.
     
  5. Offline

    DrJava

    1) Thats not valid Java
    2) Thats not what he wanted
     
  6. Offline

    Bart

    Wait it's not valid Java? This changes everything!

    Sarcasm aside, it does exactly what he wanted, all he needs to do is fill in the if statement using what I said after posting the code.
     
  7. Offline

    HyrulesLegend

    Bart "player is sleeping" o-o.
     
  8. Offline

    Bart

     
  9. Offline

    Tirelessly

    Max_The_Link_Fan DrJava They changed it, in Java 8 you can type whatever you want and the compiler will figure out what it means. Try it, it works.

    But seriously, obviously that wasn't real code. Just because it's in syntax blocks doesn't mean it needs to be 100%.
     
    Bart likes this.
  10. Offline

    DrJava

    It doesn't do what he wants it to do. He knows how to check if the desired user is in a bed; which you completely ignored.
     
  11. Offline

    BillyGalbreath

    This is exactly what the OP knows already. The OP is asking what goes in "player is sleeping"

    Sometimes I wonder if you guys even read.
     
    MayoDwarf likes this.
Thread Status:
Not open for further replies.

Share This Page