Solved Is it okay to make a timer task that will update player inventory every 1 tick?

Discussion in 'Spigot Plugin Development' started by DrOreo002, Aug 15, 2018.

  1. So I have an animated inventory here, that will update the player's inventory every 1 tick. I just want to know if this okay to do.., it its not then how can I optimize it?
     
  2. 1 ticks is pretty quick, depending on what kind of animation you want to do, I'd recommand using a longer delay between updates.
     
    • Agree Agree x 1
  3. When you invoke setItem(), it automatically send only slot-update only to players looking in this inventory. You don't need to update the whole inventory for everyone every tick.
     
  4. DavidDevelops

    Supporter

    Well, 20 ticks = 1 second, so the quickest id go is at least 10, most things won't need to be updated in less than 1-second though, more infomation and we can give a better example on how to optimize
     
  5. I've tried it without using the update Inventory method. But the animation got really messy..

    My animation updated every 10 ticks so, if I make it longer it can be messy
     
  6. I've installed my updated plugin on my server and see how's going. For now there's no lag issue going on and everything is fine. I also have searched on every plugin's source code that has animated inventory. And seems like they're also updating the inventory every 1 ticks. Without any problem of lagging

    Anyway, thanks for the kind help ;). I really appreciate it. Solved