Solved Item ID in the new update.

Discussion in 'Plugin Development' started by gjossep, May 30, 2014.

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

    gjossep

    Hey guys,
    Just wondering with the new update how to get the material ID from an ItemStack now. The old method of
    Code:java
    1. item.getType().getId();
    is Deprecated. Is this just temp or is there a new method coming up for it, as it seems that the method is returning null.

    Thanks
     
  2. Offline

    DxDy

    Since when does it return null? Is there any specific commit you can point us to ?
     
  3. Offline

    gjossep

    Idk, i was super confused. But i think my code should work, but it returns null.
    Code:java
    1. public SItemStack(ItemStack item) {
    2. this.type = item.getType().getId();
    3.  
    4. System.out.println(this.type);
    5. }

    It gives a null in the system out, and it gives a nullpointer error in the console
     
  4. Offline

    Bammerbom

    gjossep Maybe is your "item" here null?
     
  5. Offline

    gjossep

    Already checked that, and its not....

    Bammerbom DxDy It was a rookie mistake, solved it. Got the contents of an inventory but forgot that it gets everything in the inventory even the empty ones. Thanks anyways

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 1, 2016
Thread Status:
Not open for further replies.

Share This Page