mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-25 18:37:35 +01:00
19eefe9321
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
25 lines
1.2 KiB
Diff
25 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 80426e943b38e1cbde6ce80b3964df4d5ae23c94..7e54b4b521d0cfe907db5cfa26129752b3de4355 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
@@ -261,6 +261,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;
|
|
}
|