Posted January 5, 20187 yr 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?
January 5, 20187 yr Author 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}.
January 6, 20187 yr 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, 20187 yr by FlamingVikingGoat
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.