Thread: Issue with adding a new toolbelt.

Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13
  1. #11  
    Registered Member
    Join Date
    Mar 2020
    Posts
    23
    Thanks given
    3
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by clem585 View Post
    You're calling Toolbelt::addItem incorrectly. You're sending the item ID as the slot ID. Post the code where your call Toolbelt::addItem from, probably InventoryOptionsHandler.

    I'm sorry. I've only been learning java for around 6 months now, so I'm still trying to figure things out!

    Code:
    public static void handleItemOption6(Player player, int slotId, int itemId, Item item) {
    		long time = Utils.currentTimeMillis();
    		if (player.getLockDelay() >= time || player.getEmotesManager().getNextEmoteEnd() >= time) {
    			return;
    		}
    		if (!player.getInventory().containsItem(item.getId(), item.getAmount())) {
    			return;
    		}
    		player.stopAll(false);
    		if (player.getToolbelt().addItem(itemId, item)) {
    			return;
    		}
    Reply With Quote  
     

  2. #12  
    Contributor

    clem585's Avatar
    Join Date
    Sep 2013
    Posts
    3,788
    Thanks given
    706
    Thanks received
    702
    Rep Power
    570
    Quote Originally Posted by sofakingh4rd View Post
    I'm sorry. I've only been learning java for around 6 months now, so I'm still trying to figure things out!

    Code:
    public static void handleItemOption6(Player player, int slotId, int itemId, Item item) {
    		long time = Utils.currentTimeMillis();
    		if (player.getLockDelay() >= time || player.getEmotesManager().getNextEmoteEnd() >= time) {
    			return;
    		}
    		if (!player.getInventory().containsItem(item.getId(), item.getAmount())) {
    			return;
    		}
    		player.stopAll(false);
    		if (player.getToolbelt().addItem(itemId, item)) {
    			return;
    		}
    Replace your if with this:

    Code:
    if (player.getToolbelt().addItem(slotId, item)) {
    Project thread
    Reply With Quote  
     

  3. Thankful user:


  4. #13  
    Registered Member
    Join Date
    Mar 2020
    Posts
    23
    Thanks given
    3
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by clem585 View Post
    Replace your if with this:

    Code:
    if (player.getToolbelt().addItem(slotId, item)) {
    That did the trick. I now understand how to do this for the future now, so I thank you for that, Thanks again
    Reply With Quote  
     

Page 2 of 2 FirstFirst 12

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Need help with adding a new prayer
    By Ferret in forum Help
    Replies: 0
    Last Post: 01-20-2020, 09:50 PM
  2. [PI] Issues with adding data
    By 1047881l in forum Help
    Replies: 2
    Last Post: 03-15-2017, 12:18 PM
  3. [PI] Issue with adding commands
    By JesusAlmighty in forum Help
    Replies: 5
    Last Post: 09-14-2014, 04:14 PM
  4. Adding a new .java file
    By dadabehh in forum Help
    Replies: 11
    Last Post: 08-01-2009, 10:56 PM
  5. Help with adding new items.
    By Markk in forum Help
    Replies: 0
    Last Post: 01-19-2009, 12:28 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •