aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0541-Add-PlayerDeepSleepEvent.patch
diff options
context:
space:
mode:
authormaxcom1 <[email protected]>2024-03-23 22:26:17 +0100
committerGitHub <[email protected]>2024-03-23 17:26:17 -0400
commitb6001403e9703cadaa6e8c8558e732b91c3c6d6e (patch)
treea8c57bbc334a8ad48d4ad2b43db335667b142bee /patches/server/0541-Add-PlayerDeepSleepEvent.patch
parent9ec7dfcbc41c6e625de0050b6997160a75df9f44 (diff)
downloadPaper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.tar.gz
Paper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.zip
Add methods to change entity physics (#10334)
Diffstat (limited to 'patches/server/0541-Add-PlayerDeepSleepEvent.patch')
-rw-r--r--patches/server/0541-Add-PlayerDeepSleepEvent.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/patches/server/0541-Add-PlayerDeepSleepEvent.patch b/patches/server/0541-Add-PlayerDeepSleepEvent.patch
new file mode 100644
index 0000000000..4ae6ac9026
--- /dev/null
+++ b/patches/server/0541-Add-PlayerDeepSleepEvent.patch
@@ -0,0 +1,24 @@
+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] 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 6fe21c29aa9d119490fbf1d69eb03c146674cde5..8ab62f37c9e1eb1582fba4adc02c3404bebc80f4 100644
+--- a/src/main/java/net/minecraft/world/entity/player/Player.java
++++ b/src/main/java/net/minecraft/world/entity/player/Player.java
+@@ -248,6 +248,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;
+ }