@EventHandler public void onItemMerge(ItemMergeEvent event) { if (event.getEntity().hasMetadata(RMetadata.META_NO_PICKUP) || event.getTarget().hasMetadata(RMetadata.META_NO_PICKUP)) { event.setCancelled(true); return; } removeLabel(event.getEntity()); }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onItemMerge(ItemMergeEvent e) { if (plugin.cfg.dropProtectMode == DropProtectMode.OFF) return; Item ent = e.getEntity(); Item target = e.getTarget(); if (items.getIfPresent(ent.getEntityId()) != null && items.getIfPresent(target.getEntityId()) == null) { items.put(target.getEntityId(), items.getIfPresent(ent.getEntityId())); } else if (items.getIfPresent(ent.getEntityId()) == null && items.getIfPresent(target.getEntityId()) != null) { items.put(target.getEntityId(), items.getIfPresent(target.getEntityId()));//Refresh } else if (items.getIfPresent(ent.getEntityId()) != null && items.getIfPresent(target.getEntityId()) != null && items.getIfPresent(ent.getEntityId()) != items.getIfPresent(target.getEntityId())) { e.setCancelled(true); } }
public PoreItemMergeEvent(org.spongepowered.api.event.inventory.ItemMergeEvent handle) { super(null, null); this.handle = checkNotNull(handle, "handle"); }
public org.spongepowered.api.event.inventory.ItemMergeEvent getHandle() { return handle; }