One of the following codes needs to be in your PlayerListener Long: Code:java public void onPlayerDropItem(PlayerDropItemEvent event){ Item item = event.getItemDrop(); // The item int locx = item.getLocation().getBlockX(); // Rounding int locy = item.getLocation().getBlockY(); // " " int locz = item.getLocation().getBlockZ(); // " " Location loc = new Location(locx, locy, locz); // The Location} Short: Code:java public void onPlayerDropItem(PlayerDropItemEvent event){ Item item = event.getItemDrop(); // The item Location loc = new Location(int locx = item.getLocation().getBlockX(),int locx = item.getLocation().getBlockY(), int locx = item.getLocation().getBlockZ()); // The Location}
No, i want to chech a Location for Drops. I dont want to log the drops. like this: Code: Location loc = new Location(12,64,12); DropList drops = loc.getAllDrops(); if(drops.get(0).getTypeId() == 5){ [...] } Nobody knows? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Like darkman2412 said, you could use the onPlayerDropItem event. See this line: ? Code: Item item = event.getItemDrop(); // The item Use it to create an if statement: if (item.getBlah == blahblah) { doBlah(); }
Try this method I made up : Code: public List<Item> getItemsAt(Location loc){ List<Item> entities = new ArrayList<Item>(); if(loc == null) return entities; for(Entity e : loc.getBlock().getChunk().getEntities()){ if(e instanceof Item){ Location blockloc = ((Item) e).getLocation().getBlock().getLocation(); if(blockloc.equals(loc)) entities.add((Item)e); } } return entities; } The location parameter must be a block location (eg 26, 75, 47 not 26.4473, 75.852, 47.122)