Paper/patches/server/0567-Add-PlayerDeepSleepEvent.patch

23 lines
1.1 KiB
Diff
Raw Normal View History

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
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
index 2957b3929c1e92af1b1a2636b83b757a0fbc789d..482eaa28277eca1dbb25d1f3cf6c27328a8879de 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
2023-12-06 04:34:04 +01:00
@@ -248,6 +248,11 @@ public abstract class Player extends LivingEntity {
2021-06-11 14:02:28 +02:00
if (this.isSleeping()) {
++this.sleepCounter;
+ // Paper start - Add PlayerDeepSleepEvent
2021-06-11 14:02:28 +02:00
+ 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 - Add PlayerDeepSleepEvent
2021-06-11 14:02:28 +02:00
if (this.sleepCounter > 100) {
this.sleepCounter = 100;
}