Paper/Spigot-API-Patches/0126-Expand-ArmorStand-API.patch
Daniel Ennis c97ce029e9
1.16.2 Release (#4123)
PaperMC believes that 1.16.2 is now ready for general release as we fixed the main issue plagueing the 1.16.x release, the MapLike data conversion issues.

Until now, it was not safe for a server to convert a world to 1.16.2 without data conversion issues around villages and potentially other things. If you did, those MapLike errors meant something went wrong.

This is now resolved.

Big thanks to all those that helped, notably @BillyGalbreath and @Proximyst who did large parts of the update process with me.

Please as always, backup your worlds and test before updating to 1.16.2!

If you update to 1.16.2, there is no going back to an older build than this.

---------------------------------

Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com>
Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
Co-authored-by: krolik-exe <69214078+krolik-exe@users.noreply.github.com>
Co-authored-by: BillyGalbreath <BillyGalbreath@users.noreply.github.com>
Co-authored-by: stonar96 <minecraft.stonar96@gmail.com>
Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
Co-authored-by: Jason <jasonpenilla2@me.com>
Co-authored-by: kashike <kashike@vq.lc>
Co-authored-by: Aurora <21148213+aurorasmiles@users.noreply.github.com>
Co-authored-by: KennyTV <kennytv@t-online.de>
Co-authored-by: commandblockguy <commandblockguy1@gmail.com>
Co-authored-by: DigitalRegent <misterwener@gmail.com>
Co-authored-by: ishland <ishlandmc@yeah.net>
2020-08-24 22:40:19 -04:00

104 lines
3.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
index 365d3a3c5fc4a47efe56225ef1eb87b5046034f4..8ca6c9eba926f436203af211c6e274a59ddb15e8 100644
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
@@ -13,7 +13,7 @@ public interface ArmorStand extends LivingEntity {
* Returns the item the armor stand is currently holding.
*
* @return the held item
- * @deprecated prefer {@link EntityEquipment#getItemInHand()}
+ * @deprecated prefer {@link ArmorStand#getItem(EquipmentSlot)} // Paper
* @see #getEquipment()
*/
@NotNull
@@ -25,7 +25,7 @@ public interface ArmorStand extends LivingEntity {
*
* @param item the item to hold
* @deprecated prefer
- * {@link EntityEquipment#setItemInHand(org.bukkit.inventory.ItemStack)}
+ * {@link ArmorStand#setItem(EquipmentSlot, ItemStack)} // Paper
* @see #getEquipment()
*/
@Deprecated
@@ -376,5 +376,71 @@ public interface ArmorStand extends LivingEntity {
* @param tick {@code true} if this armour stand can tick, {@code false} otherwise
*/
void setCanTick(final boolean tick);
+
+ /**
+ * Returns the item the armor stand has
+ * equip in the given equipment slot
+ *
+ * @param slot the equipment slot to get
+ * @return the ItemStack in the equipment slot
+ */
+ @NotNull
+ ItemStack getItem(@NotNull 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(@NotNull final org.bukkit.inventory.EquipmentSlot slot, @Nullable final ItemStack item);
+
+ /**
+ * Get the list of disabled slots
+ *
+ * @return list of disabled slots
+ */
+ @NotNull
+ 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(@NotNull 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(@NotNull 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(@NotNull final org.bukkit.inventory.EquipmentSlot... slots);
+
+ /**
+ * Check if a specific slot is disabled
+ *
+ * @param slot The slot to check
+ * @return {@code true} if the slot is disabled, else {@code false}.
+ */
+ boolean isSlotDisabled(@NotNull org.bukkit.inventory.EquipmentSlot slot);
// Paper end
}