QUOTE: Be someone’s rainbow today.

Added item drop to ArmorStand - poppy - A feature-rich Minecraft plugin which enhances gaming experience

poppy

A feature-rich Minecraft plugin which enhances gaming experience
git clone git://192.168.2.2/poppy
Log | Files | Refs | README

commit b031652d5ed107c0f324252729dbe204aeb54d23
parent 7f8be5249322c1ce91f8627545f51ef3ca88e710
Author: luca-luca <reisingerluca@gmail.com>
Date:   Wed, 24 Feb 2021 20:05:31 +0100

Added item drop to ArmorStand
Diffstat:
Msrc/de/typable/minecrafthub/event/EventListener.java | 20++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/de/typable/minecrafthub/event/EventListener.java b/src/de/typable/minecrafthub/event/EventListener.java @@ -10,6 +10,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerInteractAtEntityEvent; @@ -86,9 +87,23 @@ public class EventListener implements Listener armorstand.setArms(true); event.setCancelled(true); - + item.setAmount(item.getAmount() - 2); } } } -} + + @EventHandler + public void onArmorStandDestroy(EntityDeathEvent event) + { + if(event.getEntity() instanceof ArmorStand) + { + ArmorStand armorstand = (ArmorStand) event.getEntity(); + + if(armorstand.hasArms()) + { + event.getDrops().add(new ItemStack(Material.STICK, 2)); + } + } + } +} +\ No newline at end of file