Discussion in 'Plugin Development' started by ACTruncale, Apr 10, 2011.
Does anyone know the calls to check if players are in the bed sleeping and wake up when day comes?
there have been added some new event for beds in the last few revisions, try searching javadocs, or eclipse autocomplete, I dont remember those exact names.
To check if a player is in bed you could use: player.isSleeping()
It will return a Boolean value true if the player is in bed and false if not..
As for checking if a player has slept and time has skipped to the morning the only easy way I know (without messing with schedulers and player.getSleepTicks()) is this:
1. Listen for the PLAYER_BED_LEAVE event.
2. If you catch it, check if the time is morning with server.getTime()
As players are unable to enter the bed unless it is night time, if they leave the bed it *should* be morning
Gotcha! Thanks I'll try both of those.
Separate names with a comma.