mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-22 10:22:29 +00:00
Prevent armor items from being taken by the hologram
This commit is contained in:
parent
d2b75295ca
commit
bc13dd7a9d
@ -44,6 +44,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.*;
|
import org.bukkit.inventory.*;
|
||||||
@ -72,6 +73,16 @@ public class ShopInteractListener implements Listener {
|
|||||||
this.worldGuard = plugin.getWorldGuard();
|
this.worldGuard = plugin.getWorldGuard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true)
|
||||||
|
public void onPlayerManipulateArmorStand(PlayerArmorStandManipulateEvent e) {
|
||||||
|
// When clicking an armor stand with an armor item, the armor stand will take it.
|
||||||
|
// As a hologram consists of armor stands, they would also take the item.
|
||||||
|
ArmorStand armorStand = e.getRightClicked();
|
||||||
|
if (Hologram.isPartOfHologram(armorStand)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onPlayerInteractCreate(PlayerInteractEvent e) {
|
public void onPlayerInteractCreate(PlayerInteractEvent e) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
|
Loading…
Reference in New Issue
Block a user