Solved How to spawn item?

Discussion in 'Plugin Development' started by MM1990d, Sep 8, 2012.

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

    MM1990d

    Hi, I want to spawn item (lever). How to spawn it? Not block but entity. I can't find it ;/ Can someone help me, please?
     
  2. Offline

    RealDope

    Spawn it as in add it to a players inventory?
     
    MM1990d likes this.
  3. Offline

    MM1990d

    No, not in player inventory. I to want spawn lever on the ground (as an item).
     
  4. Offline

    RealDope

    Then where do you want it to be spawned if it's not a block?..

    You want it to be dropped on the ground?
     
    MM1990d likes this.
  5. Offline

    MM1990d

    Yes :)
     
  6. Offline

    bobacadodl

    World.dropitemnaturally(loc, itemstack) i think...
     
    MM1990d likes this.
  7. Offline

    MM1990d

    Thanks! I really need this :)
     
  8. Offline

    CXdur

    for example:
    Code:
    public void onPlayerJoin(final PlayerJoinEvent e) {
    Player p  = e.getPlayer();
    p.getWorld().dropItemNaturally(p.getLocation(), new ItemStack(Material.LEVER)); // drops a lever at his location..
    }
    
    I think that will work, but I'm not sure.
     
Thread Status:
Not open for further replies.

Share This Page