testserver/Spigot-API-Patches/0206-Potential-bed-API.patch

58 lines
2.2 KiB
Diff
Raw Normal View History

2020-05-11 04:19:04 +00:00
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
2020-06-25 02:33:35 +00:00
index 1f94cbee36b6a952b2ecca8efbeaf7deee640a81..c0d38f5a39610cbc523d210b76f17fa17c0d7e62 100644
2020-05-11 04:19:04 +00:00
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
2020-06-25 02:33:35 +00:00
@@ -239,6 +239,43 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*/
public int getSleepTicks();
2020-05-11 04:19:04 +00:00
2020-06-25 02:33:35 +00:00
+ /**
+ * Gets the Location where the player will spawn at their bed, null if
+ * they have not slept in one or their current bed spawn is invalid.
+ *
+ * @return Bed Spawn Location if bed exists, otherwise null.
+ */
+ @Nullable
+ public Location getBedSpawnLocation();
+
2020-05-11 04:19:04 +00:00
+ // 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
2020-06-25 02:33:35 +00:00
+
+ /**
+ * Sets the Location where the player will spawn at their bed.
+ *
+ * @param location where to set the respawn location
+ */
+ public void setBedSpawnLocation(@Nullable Location location);
+
+ /**
+ * Sets the Location where the player will spawn at their bed.
+ *
+ * @param location where to set the respawn location
+ * @param force whether to forcefully set the respawn location even if a
+ * valid bed is not present
+ */
+ public void setBedSpawnLocation(@Nullable Location location, boolean force);
2020-05-11 04:19:04 +00:00
+
/**
2020-06-25 02:33:35 +00:00
* Attempts to make the entity sleep at the given location.
* <br>