Having trouble with itempickup

Discussion in 'Plugin Development' started by KaiPol, Jan 1, 2014.

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

    KaiPol

    Okay so I'm trying to make it so that the player can't pickup a certain item for 5 seconds here's what I have:
    Code:
     
            private ItemStack deadt;
           
            @EventHandler
            private void Death(PlayerDeathEvent event){
               Player dead = event.getEntity();
                World world = dead.getWorld();
                Location location = dead.getLocation();
                deadt = new ItemStack(Material.NAME_TAG);
                world.dropItem(location, deadt);
                ((Item) deadt).setPickupDelay(100);
               
            }
    This doesn't work the player can pick it up instantly.
     
  2. Offline

    BillyGalbreath

    Save player's name to list on death and start a delayed task to remove the entry 5 seconds later. On pickup event check if player's name is in that list and cancel the event if so. Simple.
     
    KaiPol likes this.
  3. Offline

    KaiPol

    BillyGalbreath
    Now I feel stupid xD
    Thanks!
     
Thread Status:
Not open for further replies.

Share This Page