aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0581-Added-PlayerDeepSleepEvent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0581-Added-PlayerDeepSleepEvent.patch')
-rw-r--r--patches/server/0581-Added-PlayerDeepSleepEvent.patch22
1 files changed, 22 insertions, 0 deletions
diff --git a/patches/server/0581-Added-PlayerDeepSleepEvent.patch b/patches/server/0581-Added-PlayerDeepSleepEvent.patch
new file mode 100644
index 0000000000..e77b33f0bb
--- /dev/null
+++ b/patches/server/0581-Added-PlayerDeepSleepEvent.patch
@@ -0,0 +1,22 @@
+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] Added 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 c44f8ed810b0c9a510d7e1c07987323a8a620ca4..dee00042a780b053cd094081874aad221abf1b2b 100644
+--- a/src/main/java/net/minecraft/world/entity/player/Player.java
++++ b/src/main/java/net/minecraft/world/entity/player/Player.java
+@@ -253,6 +253,11 @@ public abstract class Player extends LivingEntity {
+
+ if (this.isSleeping()) {
+ ++this.sleepCounter;
++ // Paper start
++ if (this.sleepCounter == 100) {
++ if (!new io.papermc.paper.event.player.PlayerDeepSleepEvent((org.bukkit.entity.Player) getBukkitEntity()).callEvent()) { this.sleepCounter = Integer.MIN_VALUE; }
++ }
++ // Paper end
+ if (this.sleepCounter > 100) {
+ this.sleepCounter = 100;
+ }