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

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


    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


    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


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


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

    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


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


    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


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


  9. Offline


    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


    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


    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