Stage 2-3: Player states and Killer system

This commit is contained in:
loki5512344 2026-05-31 20:49:28 +02:00
parent 5a53620b3a
commit d1f854fc79
14 changed files with 1095 additions and 0 deletions

View file

@ -0,0 +1,86 @@
package dev.loki.totem;
import org.bukkit.Location;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EntityType;
import java.util.UUID;
public abstract class Totem {
protected final UUID id;
protected final Location location;
protected ArmorStand display;
protected TotemState state;
protected UUID linkedPerkId;
public Totem(Location location) {
this.id = UUID.randomUUID();
this.location = location;
this.state = TotemState.DULL;
this.linkedPerkId = null;
}
public void spawn() {
if (display != null && !display.isDead()) {
return;
}
display = (ArmorStand) location.getWorld().spawnEntity(location, EntityType.ARMOR_STAND);
display.setVisible(false);
display.setGravity(false);
display.setSmall(true);
display.setMarker(true);
display.setCustomNameVisible(true);
updateVisuals();
}
public void remove() {
if (display != null && !display.isDead()) {
display.remove();
}
}
public abstract void updateVisuals();
public abstract void onInteract(UUID playerId);
public UUID getId() {
return id;
}
public Location getLocation() {
return location;
}
public TotemState getState() {
return state;
}
public void setState(TotemState state) {
this.state = state;
updateVisuals();
}
public UUID getLinkedPerkId() {
return linkedPerkId;
}
public void setLinkedPerkId(UUID linkedPerkId) {
this.linkedPerkId = linkedPerkId;
}
public boolean isHexTotem() {
return state == TotemState.HEX;
}
public boolean isBlessedTotem() {
return state == TotemState.BLESSED;
}
public boolean isCleansed() {
return state == TotemState.CLEANSED;
}
public double distanceTo(Location other) {
return location.distance(other);
}
}