2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
Date: Wed, 21 Apr 2021 15:58:19 -0700
|
2024-01-19 17:54:05 +01:00
|
|
|
Subject: [PATCH] Add PlayerDeepSleepEvent
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
2024-07-06 21:19:14 +02:00
|
|
|
index 513e6505706e64f9410fa190014976dc469793af..b444b24a92bd2209ee4104ae82c7cfa9c876c910 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
2024-07-06 21:19:14 +02:00
|
|
|
@@ -262,6 +262,13 @@ public abstract class Player extends LivingEntity {
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
if (this.isSleeping()) {
|
|
|
|
++this.sleepCounter;
|
2024-01-19 17:54:05 +01:00
|
|
|
+ // Paper start - Add PlayerDeepSleepEvent
|
2024-02-01 10:15:57 +01:00
|
|
|
+ if (this.sleepCounter == SLEEP_DURATION) {
|
|
|
|
+ if (!new io.papermc.paper.event.player.PlayerDeepSleepEvent((org.bukkit.entity.Player) getBukkitEntity()).callEvent()) {
|
|
|
|
+ this.sleepCounter = Integer.MIN_VALUE;
|
|
|
|
+ }
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
2024-01-19 17:54:05 +01:00
|
|
|
+ // Paper end - Add PlayerDeepSleepEvent
|
2021-06-11 14:02:28 +02:00
|
|
|
if (this.sleepCounter > 100) {
|
|
|
|
this.sleepCounter = 100;
|
|
|
|
}
|