2019-01-01 04:15:55 +01:00
|
|
|
From ee715356b1b15cf9d00a6761b77d10dbbc08b2e5 Mon Sep 17 00:00:00 2001
|
2018-07-30 05:53:59 +02: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
|
2019-01-01 04:15:55 +01:00
|
|
|
index 859f166f..eda4873d 100644
|
2018-07-30 05:53:59 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
|
|
|
|
@@ -1,5 +1,6 @@
|
|
|
|
package org.bukkit.entity;
|
|
|
|
|
|
|
|
+import org.bukkit.inventory.EquipmentSlot;
|
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
import org.bukkit.util.EulerAngle;
|
|
|
|
|
|
|
|
@@ -10,7 +11,12 @@ public interface ArmorStand extends LivingEntity {
|
|
|
|
* currently holding
|
|
|
|
*
|
|
|
|
* @return the held item
|
|
|
|
+ // Paper start - Deprecate in favor of setItemInMainHand
|
|
|
|
+ * @deprecated use {@link ArmorStand#getItem(EquipmentSlot)} instead
|
|
|
|
+ * @see ArmorStand#getItem(EquipmentSlot)
|
|
|
|
+ // Paper end
|
|
|
|
*/
|
|
|
|
+ @Deprecated // Paper
|
|
|
|
ItemStack getItemInHand();
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -18,7 +24,12 @@ public interface ArmorStand extends LivingEntity {
|
|
|
|
* holding
|
|
|
|
*
|
|
|
|
* @param item the item to hold
|
|
|
|
+ // Paper start - Deprecate in favor of setItemInMainHand
|
|
|
|
+ * @deprecated use {@link ArmorStand#setItem(EquipmentSlot, ItemStack)} instead
|
|
|
|
+ * @see ArmorStand#setItem(EquipmentSlot, ItemStack)
|
|
|
|
+ // Paper end
|
|
|
|
*/
|
|
|
|
+ @Deprecated // Paper
|
|
|
|
void setItemInHand(ItemStack item);
|
|
|
|
|
|
|
|
/**
|
2018-08-17 06:29:16 +02:00
|
|
|
@@ -291,5 +302,69 @@ public interface ArmorStand extends LivingEntity {
|
2018-08-17 00:11:35 +02:00
|
|
|
* @param tick {@code true} if this armour stand can tick, {@code false} otherwise
|
2018-07-30 05:53:59 +02:00
|
|
|
*/
|
2018-08-17 00:11:35 +02:00
|
|
|
void setCanTick(final boolean tick);
|
2018-07-30 05:53:59 +02:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Returns the item the armor stand has
|
|
|
|
+ * equip in the given equipment slot
|
|
|
|
+ *
|
|
|
|
+ * @param slot the equipment slot to get
|
2018-08-17 06:29:16 +02:00
|
|
|
+ * @return the ItemStack in the equipment slot
|
2018-07-30 05:53:59 +02:00
|
|
|
+ */
|
|
|
|
+ ItemStack getItem(final org.bukkit.inventory.EquipmentSlot slot);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 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
|
|
|
|
+ */
|
|
|
|
+ void setItem(final org.bukkit.inventory.EquipmentSlot slot, final ItemStack item);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Get the list of disabled slots
|
|
|
|
+ *
|
|
|
|
+ * @return list of disabled slots
|
|
|
|
+ */
|
|
|
|
+ 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
|
|
|
|
+ */
|
|
|
|
+ void setDisabledSlots(org.bukkit.inventory.EquipmentSlot... slots);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 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
|
|
|
|
+ */
|
|
|
|
+ void addDisabledSlots(final org.bukkit.inventory.EquipmentSlot... slots);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 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
|
|
|
|
+ */
|
|
|
|
+ void removeDisabledSlots(final org.bukkit.inventory.EquipmentSlot... slots);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Check if a specific slot is disabled
|
|
|
|
+ *
|
2018-08-17 06:29:16 +02:00
|
|
|
+ * @param slot The slot to check
|
2018-07-30 05:53:59 +02:00
|
|
|
+ * @return {@code true} if the slot is disabled, else {@code false}.
|
|
|
|
+ */
|
|
|
|
+ boolean isSlotDisabled(org.bukkit.inventory.EquipmentSlot slot);
|
|
|
|
// Paper end
|
|
|
|
}
|
|
|
|
--
|
2019-01-01 04:15:55 +01:00
|
|
|
2.20.1
|
2018-07-30 05:53:59 +02:00
|
|
|
|