Unable to remove an item from inventory properly

Discussion in 'Plugin Development' started by bigbeno37, Jul 21, 2012.

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

    bigbeno37

    Hey there!

    I am trying to make a protection plugin which protects a block for whatever is declared in the config.yml file. I have tried my best to do so, and for the most part, it works. However, there is something odd that I have noticed.

    Whenever I log into my localhost server and right click on a block with my stick and a piece of the required item in my inventory, it protects the block. However, the item does not get removed, as I wish it did. When I go to right click again, it then says that I need a piece of the defined material. However, as I explained before, I already do have a piece of that material.

    Could someone please look over my code and tell me what I am doing wrong? Thanks.

    ShlockoCraftCore:
    com.shlockocraft.bigbeno37.ShlockoCraftCore:
    ShlockoCraftCore.java:
    http://pastie.org/4298597

    com.shlockocraft.bigbeno37.ShlockoCraftCore.Data:
    ShlockoCraftAPI.java:
    http://pastie.org/4298601
    ShlockoCraftVAR.java:
    http://pastie.org/4298604

    com.shlockocraft.bigbeno37.ShlockoCraftCore.Listener:
    ShlockoCraftExecutor.java:
    http://pastie.org/4298612
    ShlockoCraftListener.java:
    http://pastie.org/4298613
     
  2. Offline

    r0306

    bigbeno37
    I think that the inventory is not being updated. Try forcing an update with:
    Code:
    player.updateInventory();
     
  3. Offline

    bigbeno37

    On my Eclipse, it's saying that .updateInventory(); has been deprecated. However, it still works, so should I just add @SuppressWarning to the method or is there something else I could do?
     
  4. Offline

    r0306

    bigbeno37
    Even though it's deprecated, it doesn't really matter. You can add the suppress annotation but you don't have to. It's just for the IDE to know that you know that the method is deprecated. :p
     
  5. Offline

    bigbeno37

    Thanks for that. Oh, just a simple question. When removing a key from a HashMap, does that also get rid of its value?
     
  6. Offline

    r0306

  7. Offline

    bigbeno37

    Okay, thanks for that once again.
     
  8. Offline

    r0306

Thread Status:
Not open for further replies.

Share This Page