Skip to content

Cooldowns

Hempfest edited this page Apr 16, 2021 · 1 revision

Making your cooldown

(Example taken from ClansPro)

public class CooldownRespawn extends Cooldown {

	private final UUID id;
	private final long time;

	public CooldownRespawn(UUID player) {
		this.id = player;
		this.time = abv(5); // abv = absolute value, 5 = seconds
	}

	@Override
	public String getId() {
		return "ClansPro-war-respawn-" + id.toString(); // Set your cooldown's id
	}

	@Override
	public long getCooldown() {
		return time;
	}
}

(Set your cooldown)

Cooldown respawn = new CooldownRespawn(player.getUniqueId());
respawn.save();

(Check your cooldown)

Cooldown respawn = Cooldown.getById("ClansPro-war-respawn-" + player.getUniqueId().toString());
if (respawn.isComplete()) {
    Cooldown.remove(respawn);
}

For a full list of methods try using this in your IDE!

Clone this wiki locally