ShopChest/de/epiceric/shopchest/event/RegenerateShopItem.java

28 lines
742 B
Java
Raw Normal View History

2015-09-02 11:06:48 +00:00
package de.epiceric.shopchest.event;
import org.bukkit.entity.Item;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.ItemDespawnEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
public class RegenerateShopItem implements Listener{
public RegenerateShopItem() {}
@EventHandler(priority = EventPriority.HIGH)
public void onItemDespawn(ItemDespawnEvent e) {
Item item = e.getEntity();
if (item.hasMetadata("shopItem")) e.setCancelled(true);
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerPickUpItem(PlayerPickupItemEvent e) {
if (e.getItem().hasMetadata("shopItem")) e.setCancelled(true);
}
}