iZerus Posted January 5, 2018 Posted January 5, 2018 How to turn off sleep? When not all players sleep on the server, the player simply lies on the bed. How to do also, but in a single player game? Quote
ArmamentHaki Posted January 5, 2018 Posted January 5, 2018 I believe there is a Player Sleep In Bed Event try to use that Quote
iZerus Posted January 5, 2018 Author Posted January 5, 2018 4 hours ago, ArmamentHaki said: I believe there is a Player Sleep In Bed Event try to use that * This event is not {@link Cancelable}. Quote
FlamingVikingGoat Posted January 6, 2018 Posted January 6, 2018 (edited) In the PlayerSleepInBed event, there is a public field(for 1.8) result, an EnumStatus(which is used to determine whether or not a player can sleep). You can cancel sleep with an event like this: Spoiler public void cancelSleep(PlayerSleepInBedEvent event){ event.result = EntityPlayer.EnumStatus.OTHER_PROBLEM; } Note: In later versions, the result field is private with the setter setResult. Keep this in mind if you plan to upgrade. Edited January 6, 2018 by FlamingVikingGoat Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.