Java Code Examples for org.bukkit.event.entity.ItemSpawnEvent#setCancelled()
The following examples show how to use
org.bukkit.event.entity.ItemSpawnEvent#setCancelled() .
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: ChunkListener.java From FastAsyncWorldedit with GNU General Public License v3.0 | 6 votes |
@EventHandler(priority = EventPriority.LOWEST) public void onItemSpawn(ItemSpawnEvent event) { if (physicsFreeze) { event.setCancelled(true); return; } Location loc = event.getLocation(); int cx = loc.getBlockX() >> 4; int cz = loc.getBlockZ() >> 4; int[] count = getCount(cx, cz); if (count[2] >= Settings.IMP.TICK_LIMITER.ITEMS) { event.setCancelled(true); return; } if (++count[2] >= Settings.IMP.TICK_LIMITER.ITEMS) { cleanup(loc.getChunk()); cancelNearby(cx, cz); if (rateLimit <= 0) { rateLimit = 20; Fawe.debug("[FAWE `tick-limiter`] Detected and cancelled item lag source at " + loc); } event.setCancelled(true); return; } }
Example 2
Source File: CustomItemManager.java From civcraft with GNU General Public License v2.0 | 6 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void OnItemSpawn(ItemSpawnEvent event) { ItemStack stack = event.getEntity().getItemStack(); if (LoreMaterial.isCustom(stack)) { LoreMaterial.getMaterial(stack).onItemSpawn(event); } if (isUnwantedVanillaItem(stack)) { if (!stack.getType().equals(Material.HOPPER) && !stack.getType().equals(Material.HOPPER_MINECART)) { event.setCancelled(true); event.getEntity().remove(); } } }
Example 3
Source File: ItemDestroyMatchModule.java From PGM with GNU Affero General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void processItemRemoval(ItemSpawnEvent event) { ItemStack item = event.getEntity().getItemStack(); for (BlockFilter filter : this.itemsToRemove) { if (filter.matches(item.getType(), item.getData().getData())) { event.setCancelled(true); } } }
Example 4
Source File: ItemDestroyMatchModule.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void processItemRemoval(ItemSpawnEvent event) { final ItemStack item = event.getEntity().getItemStack(); if(patterns.stream().anyMatch(pattern -> pattern.matches(item))) { event.setCancelled(true); } }
Example 5
Source File: BowlessListener.java From UhcCore with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onItemSpawn(ItemSpawnEvent e) { ItemStack item = e.getEntity().getItemStack(); if ((item.getType().equals(Material.BOW) || item.getType().equals(Material.ARROW))) { e.setCancelled(true); } }
Example 6
Source File: DWorldListener.java From DungeonsXL with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onItemSpawn(ItemSpawnEvent event) { if (plugin.getGameWorld(event.getLocation().getWorld()) != null) { if (Category.SIGNS.containsItem(event.getEntity().getItemStack())) { event.setCancelled(true); } } }
Example 7
Source File: DisableShulkerboxes.java From Minepacks with GNU General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onItemSpawn(ItemSpawnEvent event) { if(SHULKER_BOX_MATERIALS.contains(event.getEntity().getItemStack().getType())) { event.setCancelled(true); } }
Example 8
Source File: MainListener.java From HolographicDisplays with GNU General Public License v3.0 | 5 votes |
@EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = false) public void onItemSpawn(ItemSpawnEvent event) { if (nmsManager.isNMSEntityBase(event.getEntity())) { if (event.isCancelled()) { event.setCancelled(false); } } }
Example 9
Source File: HologramListener.java From Holograms with MIT License | 4 votes |
@EventHandler(priority = EventPriority.MONITOR) public void onItemSpawn(ItemSpawnEvent event) { if (event.isCancelled() && plugin.getEntityController().getHologramEntity(event.getEntity()) != null) { event.setCancelled(false); } }
Example 10
Source File: UnitItemMaterial.java From civcraft with GNU General Public License v2.0 | 4 votes |
@Override public void onItemSpawn(ItemSpawnEvent event) { // Never let these spawn as items. event.setCancelled(true); }
Example 11
Source File: TutorialBook.java From civcraft with GNU General Public License v2.0 | 4 votes |
public void onItemSpawn(ItemSpawnEvent event) { event.setCancelled(true); }
Example 12
Source File: ItemRemove.java From CardinalPGM with MIT License | 4 votes |
@EventHandler public void onItemSpawn(ItemSpawnEvent event) { ItemStack itemStack = event.getEntity().getItemStack(); if (itemStack.getType().equals(item.getMaterial()) && (itemStack.getDurability() == item.getData() || item.getData() < 0)) event.setCancelled(true); }