PaperMC/patches/server/0527-Add-PlayerDeepSleepEvent.patch
Riley Park f17519338b
Expose server build information (#10729)
* Expose server build information

* squash patches

* final tweaks

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: masmc05 <masmc05@gmail.com>
2024-05-15 17:06:59 -07:00

24 lines
1.2 KiB
Diff

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
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 47ace2c3f395a86db3aa67d597686c8275a91323..bed2f9903378c16d630a08156f5c39047b613ad4 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;
}