Solved How can I make a item timer

Discussion in 'Spigot Plugin Development' started by Lolmaster5000, Jul 15, 2021.

  1. When you eat an chorus fruit it will get a cooldown, how can I make it in code?
     

    Attached Files:

  2. Player#setCooldown(Material,int):
    Code (Java):
    Player player;
    ...
    player.setCooldown(Material.CHORUS_FRUIT,<time>);
    Just change <time> with how long - in TICKS! (1 second = 20 ticks IDEALLY, could be less) - you want it to be on a cooldown.
     
    • Like Like x 2
  3. Didn’t know this existed. I guess you have to add this time when you want to start the cool down, right? Here would be item consumption I presume
     
    • Like Like x 1
  4. The time is how long from the moment the command is executed the Material will be on cooldown for the player (in ticks of course).
     
    • Like Like x 1
  5. Tank you!