Files
src
build.gradle
Code
5 222
src/main/java/com/stellarsmp/data/PlayerData.java
package com.stellarsmp.data;
import com.stellarsmp.stellars.StellarType;
import lombok.Getter;
import lombok.Setter;
import java.util.*;
@Getter @Setter
public class PlayerData {
private final UUID uuid;
private StellarType stellarType;
private int stellarLevel = 1;
private double hearts = 20.0;
private double maxHearts = 20.0;
private final Set<UUID> trustedPlayers = new HashSet<>();
private boolean abilityEnabled = true;
private ActivationMethod activationMethod = ActivationMethod.SHIFT_RIGHT_CLICK;
private final Map<String, Long> cooldowns = new HashMap<>();
private boolean hasStellar = false;
public PlayerData(UUID uuid) {
this.uuid = uuid;
}
public enum ActivationMethod {
SHIFT_RIGHT_CLICK,
SHIFT_F
}
public boolean isOnCooldown(String abilityName) {
Long cooldownEnd = cooldowns.get(abilityName);
if (cooldownEnd == null) return false;
return System.currentTimeMillis() < cooldownEnd;
}
public long getCooldownRemaining(String abilityName) {
Long cooldownEnd = cooldowns.get(abilityName);
if (cooldownEnd == null) return 0;
long remaining = cooldownEnd - System.currentTimeMillis();
return Math.max(0, remaining);
}
public void setCooldown(String abilityName, long cooldownSeconds) {
cooldowns.put(abilityName, System.currentTimeMillis() + (cooldownSeconds * 1000));
}
public boolean isTrusted(UUID target) {
return trustedPlayers.contains(target);
}
public void addTrusted(UUID target) {
trustedPlayers.add(target);
}
public void removeTrusted(UUID target) {
trustedPlayers.remove(target);
}
}