Paper/Spigot-API-Patches/0206-Potential-bed-API.patch
Aikar 0823d3fdce
[Auto] Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
1cb03826 SPIGOT-5900: Re-order Material enum entries to match Minecraft's order
fdd705db #507: Add hasDiscoveredRecipe() and getDiscoveredRecipes()

CraftBukkit Changes:
551e770f5 SPIGOT-5900: Add test for the order of Material enum entries
8297676c2 #682: Add hasDiscoveredRecipe() and getDiscoveredRecipes()
2020-07-01 19:41:58 -04:00

34 lines
1.3 KiB
Diff

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 2668196e04a7de245c63b4b74f0d056784ef0736..d3998c61af0c5fb1189ae7829e8cdfbef0cd3f97 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -240,6 +240,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>