shaba123 Posted May 22, 2018 Share Posted May 22, 2018 How can i define an item id to a number? I want to say itemId(991) = 12345; So that i can check to see if my inventory contains itemId(991) and if it does then it will add 12345 to an integer. Quote Link to comment Share on other sites More sharing options...
DeadPk3r Posted May 22, 2018 Share Posted May 22, 2018 Are you asking for item id to go up or another integer? anyways could do this, basically if inventory has itemid 991 will add +1 to value so new value be 124 public int value = 123; if(getInventory().contains(991)) { value += 1; } Quote Link to comment Share on other sites More sharing options...
d0zza Posted May 22, 2018 Share Posted May 22, 2018 2 hours ago, shaba123 said: How can i define an item id to a number? I want to say itemId(991) = 12345; So that i can check to see if my inventory contains itemId(991) and if it does then it will add 12345 to an integer. Like I said in the other topic you made, use a HashMap, you can use a HashMap for item IDs too. 2 hours ago, d0zza said: https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html A HashMap will allow you to link an item or String (item name) to a particular integer (item value). 1 Quote Link to comment Share on other sites More sharing options...
shaba123 Posted May 22, 2018 Author Share Posted May 22, 2018 This thread can be deleted, d0zza answered my question in another thread, Quote Link to comment Share on other sites More sharing options...