Add a method to reset Lodestone compasses back to normal ones (#11308)

This commit is contained in:
DerEchtePilz 2024-08-25 22:25:13 +02:00 committed by GitHub
parent ad4c524c2f
commit 374d9c85ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 251 additions and 16 deletions

View file

@ -40,6 +40,46 @@ index a6d1dde422de98f178c0c9add99e01203a35e5cb..01ec84248a681180088fb1d7d22b80f8
ItemType.Typed<ItemMeta> TOTEM_OF_UNDYING = getItemType("totem_of_undying");
ItemType.Typed<ItemMeta> SHULKER_SHELL = getItemType("shulker_shell");
ItemType.Typed<ItemMeta> IRON_NUGGET = getItemType("iron_nugget");
diff --git a/src/main/java/org/bukkit/inventory/meta/CompassMeta.java b/src/main/java/org/bukkit/inventory/meta/CompassMeta.java
index 5040ab6190b41442986d2a734a8e782df0eab2f6..48bac38469ce3c5b2e59ad115375e7e5a2417da7 100644
--- a/src/main/java/org/bukkit/inventory/meta/CompassMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/CompassMeta.java
@@ -28,7 +28,8 @@ public interface CompassMeta extends ItemMeta {
/**
* Sets the location this lodestone compass will point to.
*
- * @param lodestone new location or null to clear
+ * @param lodestone new location or null to clear the targeted location
+ * @see #clearLodestone() to reset the compass to a normal compass
*/
void setLodestone(@Nullable Location lodestone);
@@ -49,9 +50,25 @@ public interface CompassMeta extends ItemMeta {
* location.
*
* @param tracked new tracked status
+ * @see #clearLodestone() to reset the compass to a normal compass
*/
void setLodestoneTracked(boolean tracked);
+ // Paper start - Add more lodestone compass methods
+ /**
+ * Checks if this compass is considered a lodestone compass.
+ * @see #hasLodestone() to check if a position is being tracked
+ * @see #isLodestoneTracked() to check if it verifies the position is a lodestone
+ */
+ boolean isLodestoneCompass();
+
+ /**
+ * Reset this compass to a normal compass, removing any tracked
+ * location.
+ */
+ void clearLodestone();
+ // Paper end - Add more lodestone compass methods
+
@Override
CompassMeta clone();
}
diff --git a/src/main/java/org/bukkit/inventory/meta/Damageable.java b/src/main/java/org/bukkit/inventory/meta/Damageable.java
index ff6818b6d9e0207eafdd749928f33aeac3f27191..992f39da07bafe9769effaa7dc6adc018c89329d 100644
--- a/src/main/java/org/bukkit/inventory/meta/Damageable.java