@rfc1920 you need to fix up your cooldown logic, it's not working properly. Change the config to seconds (and change from float to int) to add more granularity. Then use this logic:
bool hascooldownperm = permission.UserHasPermission(player.UserIDString, MinicopterCooldown);
int secondsleft = 0;
if (hascooldownperm && useCooldown)
{
if (!storedData.playercounter.ContainsKey(player.userID))
{
storedData.playercounter.Add(player.userID, secondsSinceEpoch);
}
else
{
int count = new int();
storedData.playercounter.TryGetValue(player.userID, out count);
secondsleft = cooldownseconds - (secondsSinceEpoch - count);
if (debug) Puts($"Player DID NOT reach cooldown return.");
if (secondsleft > 0)
{
Player.Message(player, $"{lang.GetMessage("CooldownMsg", this, player.UserIDString)} ({secondsleft} seconds)", Prefix);
return;
}
}
}
else
{
if (storedData.playercounter.ContainsKey(player.userID))
{
storedData.playercounter.Remove(player.userID);
}
}
Merged postAlternatively for minimal changes, you can just use this:
minleft = cooldownmin - ((secondsSinceEpoch - count) / 60);
int roundedUp = (int)Math.Ceiling(minleft);
if (minleft > 0)
{
if (debug) Puts($"Player DID NOT reach cooldown return.");
Player.Message(player, $"{lang.GetMessage("CooldownMsg", this, player.UserIDString)} ({roundedUp} min)", Prefix);
return;
}