Solved Inventory Items not appearing

Discussion in 'Plugin Development' started by FireBreath14, Oct 11, 2013.

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

    FireBreath14

    When I give players items using p.getInventory().addItem(etc);, the item DOES go in the inventory, but the player doesn't see it. The way to get them to see it is to tell them to click the slot number, and then it appears. But until then it appears empty.

    Whats causing this, and how can I give items differently so this doesnt happen?


    Thanks!
     
  2. Offline

    Jogy34

    player.updateInventory();
     
    FireBreath14 likes this.
  3. Offline

    tommycake50

    Do it that way BUT:
    player.updateInventory();
    Or:
    player.getInventory().setContents(player.getInventory().getContents());
     
    FireBreath14 likes this.
  4. Offline

    geNAZt

    But keep in mind this is a deprecated function due to a bigger bug. If the bug gets resolved this function will disappear
     
  5. Offline

    tommycake50

    That isn't a problem if you update your plugin every stable build.
     
  6. Offline

    geNAZt

    Yes true, but some people build their Plugins once and forget about it :D (no offense)
     
  7. Offline

    Jogy34


    It's deprecated because : "This method should not be relied upon as it is a temporary work-around for a larger, more complicated issue."

    It is still currently a viable work around for the problems like that. You also won't have to update it every single time because it's in the bukkit API. As a third thing, they won't get rid of it because it will break so many plugins, they'll probably just leave it and tell people to use the new method or to just not use it.
     
    FireBreath14 likes this.
  8. Offline

    geNAZt

    Well about deprecation and removing of items there will be a funny time when 1.7 comes around. If the mojang guys keep trying to get rid of TypeIDs and BlockIDs. There will be much plugins breaking... :D
     
  9. Offline

    FireBreath14

    Okay well I'll try both. Gosh can't believe its that simple XD - thanks everyone for your help, I 'liked' all yalls helpful posts :D

    Oh and Jogy34 - I love your tardis plugin! If you ever need help with it please ask :)

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

Share This Page