Cooldown on / head?

Ta
- in Servers
1

How do I add a cooldown to / head? On my Minecraft server, premi players / head should have as Pex but not every day but 1st week.

Lu

If a player executes / heads, I would get the current value of System.currentTimeMillis (). You can then save this value in a database (MySQL, MongoDB…). If a player enters the command again, you get the saved value from the database and the current value of System.currentTimeMillis (). Then you subtract the old value from the current one. You can then convert this difference from milliseconds to days / weeks.

Suggestions: You can still consider to what extent you might want to use a cache so that you don't have to access the database every time. Furthermore, you may be able to add a permission query so that players have a different cooldown depending on their rank.