aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0197-Potential-bed-API.patch
blob: a842554f354bdfbcee53258f4da7d49396195b90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JRoy <joshroy126@gmail.com>
Date: Sun, 10 May 2020 23:06:41 -0400
Subject: [PATCH] Potential bed API

Adds a new method to fetch the location of a player's bed without generating any sync loads.

getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks.

diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index c66130be13bf01b5834a6391864b865c0123fa5c..2557ddcc0528d4f9d811883b3ddc61148ebc3998 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -269,6 +269,19 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
      */
     public int getSleepTicks();
 
+
+    // Paper start - Potential bed api
+    /**
+     * Gets the Location of the player's bed, null if they have not slept
+     * in one. This method will not attempt to validate if the current bed
+     * is still valid.
+     *
+     * @return Bed Location if has slept in one, otherwise null.
+     */
+    @Nullable
+    public Location getPotentialBedLocation();
+    // Paper end
+
     /**
      * Attempts to make the entity sleep at the given location.
      * <br>