Giving a player a item with 123:23

Discussion in 'Plugin Development' started by SugarCraft, Jun 9, 2013.

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

    SugarCraft

    [syntax:java]String input = "123:23";
    int id = Integer.parseInt(input.split(":")[0]);
    int data=Integer.parseInt(input.split(":")[1]);
    ItemStack item = new ItemStack(id);
    item.setDurability((short) data);[/syntax]
    okay, i have this code but how do i give a player an item when they do this?
     
  2. Offline

    Bancey

    Set the item in the players hand to the itemstack you defined.
     
  3. Offline

    SugarCraft

    Can you give me an example?
     
  4. player.setItemInHand(new ItemStack(Material.getMaterial(123)).setData(23));
     
    SugarCraft likes this.
Thread Status:
Not open for further replies.

Share This Page