Java Code Examples for org.bukkit.entity.EntityType#DROPPED_ITEM
The following examples show how to use
org.bukkit.entity.EntityType#DROPPED_ITEM .
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: RealDisplayItem.java From QuickShop-Reremake with GNU General Public License v3.0 | 6 votes |
@Override public boolean removeDupe() { if (this.item == null) { Util.debugLog("Warning: Trying to removeDupe for a null display shop."); return false; } boolean removed = false; // Chunk chunk = shop.getLocation().getChunk(); for (Entity entity : item.getNearbyEntities(1.5, 1.5, 1.5)) { if (entity.getType() != EntityType.DROPPED_ITEM) { continue; } Item eItem = (Item) entity; UUID displayUUID = this.item.getUniqueId(); if (!eItem.getUniqueId().equals(displayUUID)) { if (DisplayItem.checkIsTargetShopDisplay(eItem.getItemStack(), this.shop)) { Util.debugLog( "Removing a duped ItemEntity " + eItem.getUniqueId() + " at " + eItem.getLocation()); entity.remove(); removed = true; } } } return removed; }
Example 2
Source File: MagnetModule.java From Modern-LWC with MIT License | 6 votes |
public static boolean isDisplay(Entity entity) { try { if (entity.getType() == EntityType.DROPPED_ITEM) { ItemMeta itemMeta = ((Item) entity).getItemStack().getItemMeta(); if (itemMeta != null && containsLocation(itemMeta.getDisplayName())) { return true; } } else if (entity.getType() == EntityType.ARMOR_STAND) { if (containsLocation(entity.getCustomName())) { return true; } } } catch (NoSuchFieldError error) { // do nothing } return false; }
Example 3
Source File: DisplayProtectionListener.java From QuickShop-Reremake with GNU General Public License v3.0 | 5 votes |
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void player(PlayerFishEvent event) { if (DisplayItem.getNowUsing() != DisplayType.REALITEM) { return; } if (event.getState() != State.CAUGHT_ENTITY) { return; } if (event.getCaught() == null) { return; } if (event.getCaught().getType() != EntityType.DROPPED_ITEM) { return; } final Item item = (Item) event.getCaught(); final ItemStack is = item.getItemStack(); if (!DisplayItem.checkIsGuardItemStack(is)) { return; } // item.remove(); event.getHook().remove(); // event.getCaught().remove(); event.setCancelled(true); sendAlert( "[DisplayGuard] Player " + event.getPlayer().getName() + " trying hook item use Fishing Rod, QuickShop already removed it."); Util.inventoryCheck(event.getPlayer().getInventory()); }
Example 4
Source File: CustomItemFish.java From AdditionsAPI with MIT License | 5 votes |
@EventHandler(priority = EventPriority.MONITOR) public void onCustomItemFish(CustomItemFishEvent customEvent) { if (customEvent.isCancelled()) return; CustomItem cItem = customEvent.getCustomItem(); PlayerFishEvent event = customEvent.getPlayerFishEvent(); Player player = event.getPlayer(); if (cItem.getDurabilityMechanics() instanceof FishingRodDurability) { ItemStack item = customEvent.getCustomItemStack().getItemStack(); State state = event.getState(); FishingRodDurability mechanics = (FishingRodDurability) cItem.getDurabilityMechanics(); PlayerCustomItemDamageEvent damageEvent = new PlayerCustomItemDamageEvent(player, item, 0, cItem); switch (state) { case CAUGHT_ENTITY: if (event.getCaught().getType() == EntityType.DROPPED_ITEM) { damageEvent.setDamage(mechanics.getItemReel()); } else { damageEvent.setDamage(mechanics.getEntityReel()); } break; case CAUGHT_FISH: damageEvent.setDamage(mechanics.getFishCatch()); break; case IN_GROUND: damageEvent.setDamage(mechanics.getBlockReel()); break; default: break; } if (damageEvent.getDamage() != 0) Bukkit.getServer().getPluginManager().callEvent(damageEvent); } }
Example 5
Source File: ChunkListener.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
public void cleanup(Chunk chunk) { for (Entity entity : chunk.getEntities()) { if (entity.getType() == EntityType.DROPPED_ITEM) { entity.remove(); } } }
Example 6
Source File: CraftItem.java From Kettle with GNU General Public License v3.0 | 4 votes |
public EntityType getType() { return EntityType.DROPPED_ITEM; }
Example 7
Source File: CraftItem.java From Thermos with GNU General Public License v3.0 | 4 votes |
public EntityType getType() { return EntityType.DROPPED_ITEM; }