Yup. It's definitely doable but first the sleep status of a Player and maybe a PlayerSleep event needs to first be implemented into the API before a plugin can be written. You can add API requests here:
it says it all, any chance Red51 ?
mjminfo
Yup. It's definitely doable but first the sleep status of a Player and maybe a PlayerSleep event needs to first be implemented into the API before a plugin can be written. You can add API requests here:
it says it all, any chance Red51 ?
mjminfo
A "Player.isSleeping()" function as well as a "PlayerSleep" event will be available with the next update
Red51, what can I say other then you're amazing!
I might also suggest adding Player.isSitting and Player.isLaying booleans as well and appropriate PlayerEvents. I had this thought that in the future, we can sit down and lay down to recover stamina but like with any future plugins, they might find other uses as well. The isSitting will no doubt be useful for private group chats (e.g. people sitting around a table).
I realize the the concept of laying is not in the game yet but might be an alternative to sitting and could be kinda like how we "sleep" in the tent in the daytime but not actually go to sleep because its a multiplayer server. Laying down could restore stamina at a rate different from sitting or might heal a splinted leg faster. Laying down to recover stamina might be helpful if you're mining deep and have no proper chair to sit on. Some ideas ArcticuKitsu and I are brewing here: http://steamcommunity.com/app/…ns/12/133255708301019918/
A "Player.isSleeping()" function as well as a "PlayerSleep" event will be available with the next update
a BIG Thanks for your comprehension
mjminfo
And it is now added. I can write a plugin now to slowly recover health of my players when they rest in bed
And it is now added. I can write a plugin now to slowly recover health of my players when they rest in bed
care to share the plugin ?
is it only for the bed or also when sitting ?
I'll have to study the api a bit more and see what i can come up with. Java is not exactly my strong point.
Something doesn't seem right here. Am I doing this correct?
a PlayerSleepEvent is triggered. However after this happens, I grab the player and check player.isSleeping() but it's set to false.
Do you check e.isSleeping()? The event is also called when the player wakes up (I didn't try but it would not surprise me if any player logging in triggers such an event, as he turns from 'nothing' to awaken...)
Miwarre,
I initially tried e.isSleeping() but it did not exist according to the IDE so I used p.isSleping() instead but it always returned false. Looking again now at the javadoc i see that both functions exist. I'll try again when I get home but the reason I brought this up is because I suspect a bug in the API if Player.isSleeping() returns false after PlayerSleepEvent occurrs.
Don’t have an account yet? Create a new account now and be part of our community!