diff options
Diffstat (limited to 'patches/server/0526-Add-PlayerDeepSleepEvent.patch')
-rw-r--r-- | patches/server/0526-Add-PlayerDeepSleepEvent.patch | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/patches/server/0526-Add-PlayerDeepSleepEvent.patch b/patches/server/0526-Add-PlayerDeepSleepEvent.patch new file mode 100644 index 0000000000..b2ba3c0722 --- /dev/null +++ b/patches/server/0526-Add-PlayerDeepSleepEvent.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +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 2a2683d21d7bae023a93db422ab0aebf72ca56cb..b7c674505c2319c906a0cce53e0def2337b24d42 100644 +--- a/src/main/java/net/minecraft/world/entity/player/Player.java ++++ b/src/main/java/net/minecraft/world/entity/player/Player.java +@@ -260,6 +260,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; + } |