org.bukkit.event.entity.ItemMergeEvent Java Examples
The following examples show how to use
org.bukkit.event.entity.ItemMergeEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Player19Listener.java From BedWars with GNU Lesser General Public License v3.0 | 6 votes |
@EventHandler public void onItemMerge(ItemMergeEvent event) { // This is already in 1.8.8, but in older 1.8.x versions not (need to check 1.8.8/9 version) if (event.isCancelled()) { return; } for (String s : Main.getGameNames()) { Game game = Main.getGame(s); if (game.getStatus() == GameStatus.RUNNING && game.getOriginalOrInheritedSpawnerDisableMerge()) { if (GameCreator.isInArea(event.getEntity().getLocation(), game.getPos1(), game.getPos2()) || GameCreator.isInArea(event.getTarget().getLocation(), game.getPos1(), game.getPos2())) { event.setCancelled(true); return; } } } }
Example #2
Source File: Player19Listener.java From BedWars with GNU Lesser General Public License v3.0 | 6 votes |
@EventHandler public void onItemMerge(ItemMergeEvent event) { // This is already in 1.8.8, but in older 1.8.x versions not (need to check 1.8.8/9 version) if (event.isCancelled()) { return; } for (String s : Main.getGameNames()) { Game game = Main.getGame(s); if (game.getStatus() == GameStatus.RUNNING && game.getOriginalOrInheritedSpawnerDisableMerge()) { if (GameCreator.isInArea(event.getEntity().getLocation(), game.getPos1(), game.getPos2()) || GameCreator.isInArea(event.getTarget().getLocation(), game.getPos1(), game.getPos2())) { event.setCancelled(true); return; } } } }
Example #3
Source File: DropProtectListener.java From NyaaUtils with MIT License | 5 votes |
@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); } }
Example #4
Source File: ChickenHandler.java From EliteMobs with GNU General Public License v3.0 | 4 votes |
@EventHandler public void onSuperEggMerge(ItemMergeEvent event) { if (event.getEntity().getItemStack().hasItemMeta() && event.getEntity().getItemStack().getItemMeta().hasLore() && event.getEntity().getItemStack().getItemMeta().getLore().equals(lore)) { new BukkitRunnable() { @Override public void run() { if (event.getTarget().isValid()) { event.getTarget().remove(); } } }.runTaskLater(MetadataHandler.PLUGIN, 20 * 60); } }