Removing items from ground

Discussion in 'Plugin Development' started by ThrustLP, Jul 8, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    ThrustLP

    Hey guys! So with a command /rem I remove all items that are currently on the ground. I am getting all entitys on the ground an then (if they are Instanceof Item) i remove them. That works perfectly BUT Items that are dropped after a players death stay on the ground. So how can I remove the items a player dropped with a command?

    Thanks!
     
  2. Offline

    Kariyaki_LP

    Code:
    @EventHandler
    publicvoid onPlayerDeath(PlayerDeathEvent event){
               for(ItemStack i : event.getDrops()){
                    i.setType(Material.AIR);
               }
    }
    That might be working . I don't have Test it ...
     
  3. Offline

    ThrustLP

    @Kariyaki_LP Yes, but I do not want to remove them right after the players death, I want to remove them with a command.
     
  4. @Kariyaki_LP Please don't spoonfeed, especially since there is no need to even do a for loop there.
     
  5. Offline

    N00BHUN73R

    @ThrustLP
    Make a command, then get all near entities within a set radius, let's say 5. Then you do player#getnearbyentities(5, 5, 5)
    then check if its an itemdrop and if it is, e.remove() it
     
Thread Status:
Not open for further replies.

Share This Page