Solved Clearing Inventory On Sign Click Issue

Discussion in 'Plugin Development' started by arsenalfcgunners, Jul 4, 2015.

Thread Status:
Not open for further replies.
  1. When the sign is click I teleport the player and do player.getInventory().clear() and then give them different items. What happens when I click the sign is that I get teleported but I still see my old inventory. However when I try to move the items around in my inventory all the items disappear the the ones that I should have been given appear. It seems as if their is a visual glitch or something. Anyone know how to fix this? I have tired so many alternatives and nothing works. If I do the command manually by typing it instead of clicking the sign everything works perfectly.

    Things I have tried to avoid the glitch:
    • Clearing items before teleport
    • Clearing items by doing /clear from console.
    • Clearing items by doing /clear using playerDispatch command
    • Clearing items by doing /clear with player.chat();
    • Clearing each inventory slot manually by looping though the inventory and setting each slot to Material.Air
    • Clearing items a second after teleport using a timer.
    All of the above give me the same results.
     
    Last edited: Jul 4, 2015
  2. Offline

    lilian58660

    Paste your codes if you want help :)
     
  3. Offline

    Denziz

    @arsenalfcgunners

    Have you tried to update the inventory?

    Code:
    player.updateInventory();
     
    arsenalfcgunners likes this.
  4. Thank you so much! That worked.
     
Thread Status:
Not open for further replies.

Share This Page