2020-05-01 22:03:47 +00:00
|
|
|
From cce65d9377cfd96529bc8fb770758fb9208a0650 Mon Sep 17 00:00:00 2001
|
2018-07-30 03:53:59 +00:00
|
|
|
From: willies952002 <admin@domnian.com>
|
|
|
|
Date: Thu, 26 Jul 2018 02:22:44 -0400
|
|
|
|
Subject: [PATCH] Expand ArmorStand API
|
|
|
|
|
|
|
|
Add the following:
|
|
|
|
- Add proper methods for getting and setting items in both hands. Deprecates old methods
|
|
|
|
- Enable/Disable slot interactions
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java
|
2020-04-02 21:07:06 +00:00
|
|
|
index c8c08f1f2..af70bac79 100644
|
2018-07-30 03:53:59 +00:00
|
|
|
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
|
2020-01-22 18:19:54 +00:00
|
|
|
@@ -1,6 +1,7 @@
|
2018-07-30 03:53:59 +00:00
|
|
|
package org.bukkit.entity;
|
|
|
|
|
2020-01-22 18:19:54 +00:00
|
|
|
import org.bukkit.inventory.EntityEquipment;
|
2018-07-30 03:53:59 +00:00
|
|
|
+import org.bukkit.inventory.EquipmentSlot;
|
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
import org.bukkit.util.EulerAngle;
|
2019-03-20 00:28:15 +00:00
|
|
|
import org.jetbrains.annotations.NotNull;
|
2020-01-22 18:19:54 +00:00
|
|
|
@@ -12,7 +13,7 @@ public interface ArmorStand extends LivingEntity {
|
|
|
|
* Returns the item the armor stand is currently holding.
|
2018-07-30 03:53:59 +00:00
|
|
|
*
|
|
|
|
* @return the held item
|
2020-01-22 18:19:54 +00:00
|
|
|
- * @deprecated prefer {@link EntityEquipment#getItemInHand()}
|
|
|
|
+ * @deprecated prefer {@link ArmorStand#getItem(EquipmentSlot)} // Paper
|
|
|
|
* @see #getEquipment()
|
2018-07-30 03:53:59 +00:00
|
|
|
*/
|
2019-03-20 00:28:15 +00:00
|
|
|
@NotNull
|
2020-01-22 18:19:54 +00:00
|
|
|
@@ -24,7 +25,7 @@ public interface ArmorStand extends LivingEntity {
|
2018-07-30 03:53:59 +00:00
|
|
|
*
|
|
|
|
* @param item the item to hold
|
2020-01-22 18:19:54 +00:00
|
|
|
* @deprecated prefer
|
|
|
|
- * {@link EntityEquipment#setItemInHand(org.bukkit.inventory.ItemStack)}
|
|
|
|
+ * {@link ArmorStand#setItem(EquipmentSlot, ItemStack)} // Paper
|
|
|
|
* @see #getEquipment()
|
2018-07-30 03:53:59 +00:00
|
|
|
*/
|
2020-01-22 18:19:54 +00:00
|
|
|
@Deprecated
|
|
|
|
@@ -324,5 +325,71 @@ public interface ArmorStand extends LivingEntity {
|
2018-08-16 22:11:35 +00:00
|
|
|
* @param tick {@code true} if this armour stand can tick, {@code false} otherwise
|
2018-07-30 03:53:59 +00:00
|
|
|
*/
|
2018-08-16 22:11:35 +00:00
|
|
|
void setCanTick(final boolean tick);
|
2018-07-30 03:53:59 +00:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Returns the item the armor stand has
|
|
|
|
+ * equip in the given equipment slot
|
|
|
|
+ *
|
|
|
|
+ * @param slot the equipment slot to get
|
2018-08-17 04:29:16 +00:00
|
|
|
+ * @return the ItemStack in the equipment slot
|
2018-07-30 03:53:59 +00:00
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ @NotNull
|
|
|
|
+ ItemStack getItem(@NotNull final org.bukkit.inventory.EquipmentSlot slot);
|
2018-07-30 03:53:59 +00:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Sets the item the armor stand has
|
|
|
|
+ * equip in the given equipment slot
|
|
|
|
+ *
|
|
|
|
+ * @param slot the equipment slot to set
|
|
|
|
+ * @param item the item to hold
|
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ void setItem(@NotNull final org.bukkit.inventory.EquipmentSlot slot, @Nullable final ItemStack item);
|
2018-07-30 03:53:59 +00:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Get the list of disabled slots
|
|
|
|
+ *
|
|
|
|
+ * @return list of disabled slots
|
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ @NotNull
|
2018-07-30 03:53:59 +00:00
|
|
|
+ java.util.Set<org.bukkit.inventory.EquipmentSlot> getDisabledSlots();
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Set the disabled slots
|
|
|
|
+ *
|
|
|
|
+ * This makes it so a player is unable to interact with the Armor Stand to place, remove, or replace an item in the given slot(s)
|
|
|
|
+ * Note: Once a slot is disabled, the only way to get an item back it to break the armor stand.
|
|
|
|
+ *
|
|
|
|
+ * @param slots var-arg array of slots to lock
|
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ void setDisabledSlots(@NotNull org.bukkit.inventory.EquipmentSlot... slots);
|
2018-07-30 03:53:59 +00:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Disable specific slots, adding them
|
|
|
|
+ * to the currently disabled slots
|
|
|
|
+ *
|
|
|
|
+ * This makes it so a player is unable to interact with the Armor Stand to place, remove, or replace an item in the given slot(s)
|
|
|
|
+ * Note: Once a slot is disabled, the only way to get an item back it to break the armor stand.
|
|
|
|
+ *
|
|
|
|
+ * @param slots var-arg array of slots to lock
|
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ void addDisabledSlots(@NotNull final org.bukkit.inventory.EquipmentSlot... slots);
|
2018-07-30 03:53:59 +00:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Remove the given slots from the disabled
|
|
|
|
+ * slots list, enabling them.
|
|
|
|
+ *
|
|
|
|
+ * This makes it so a player is able to interact with the Armor Stand to place, remove, or replace an item in the given slot(s)
|
|
|
|
+ *
|
|
|
|
+ * @param slots var-arg array of slots to unlock
|
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ void removeDisabledSlots(@NotNull final org.bukkit.inventory.EquipmentSlot... slots);
|
2018-07-30 03:53:59 +00:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Check if a specific slot is disabled
|
|
|
|
+ *
|
2018-08-17 04:29:16 +00:00
|
|
|
+ * @param slot The slot to check
|
2018-07-30 03:53:59 +00:00
|
|
|
+ * @return {@code true} if the slot is disabled, else {@code false}.
|
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ boolean isSlotDisabled(@NotNull org.bukkit.inventory.EquipmentSlot slot);
|
2018-07-30 03:53:59 +00:00
|
|
|
// Paper end
|
|
|
|
}
|
|
|
|
--
|
2020-05-01 22:03:47 +00:00
|
|
|
2.26.2
|
2018-07-30 03:53:59 +00:00
|
|
|
|