From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Wed, 21 Apr 2021 15:58:19 -0700 Subject: [PATCH] Add PlayerDeepSleepEvent diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java index 136a6b8e2065c7bada396e0f54f91c841a85c3d8..13f21822d0eb1d167b9b71addb46c4f508301c8d 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -265,6 +265,13 @@ public abstract class Player extends LivingEntity { if (this.isSleeping()) { ++this.sleepCounter; + // Paper start - Add PlayerDeepSleepEvent + if (this.sleepCounter == SLEEP_DURATION) { + if (!new io.papermc.paper.event.player.PlayerDeepSleepEvent((org.bukkit.entity.Player) getBukkitEntity()).callEvent()) { + this.sleepCounter = Integer.MIN_VALUE; + } + } + // Paper end - Add PlayerDeepSleepEvent if (this.sleepCounter > 100) { this.sleepCounter = 100; }