Stage 12: Data storage system

This commit is contained in:
loki5512344 2026-05-31 20:47:02 +02:00
parent 82ed455cd2
commit 4fd7955d56
62 changed files with 5613 additions and 0 deletions

View file

@ -0,0 +1,70 @@
package dev.loki.hook;
import dev.loki.player.Survivor;
import org.bukkit.Location;
import java.util.UUID;
public class Hook {
private final UUID id;
private final Location location;
private Survivor hookedSurvivor;
private HookStage currentStage;
private int stageProgress;
private boolean occupied;
private boolean basement;
public Hook(UUID id, Location location, boolean basement) {
this.id = id;
this.location = location;
this.basement = basement;
this.currentStage = HookStage.STAGE_1;
this.stageProgress = 0;
this.occupied = false;
}
public void hookSurvivor(Survivor survivor) {
this.hookedSurvivor = survivor;
this.occupied = true;
this.currentStage = HookStage.STAGE_1;
this.stageProgress = 0;
}
public void unhookSurvivor() {
this.hookedSurvivor = null;
this.occupied = false;
this.currentStage = HookStage.STAGE_1;
this.stageProgress = 0;
}
public void tick() {
if (!occupied || hookedSurvivor == null) return;
stageProgress++;
int stageDuration = currentStage.getDurationSeconds() * 20;
if (stageProgress >= stageDuration && currentStage != HookStage.SACRIFICE) {
advanceStage();
}
}
private void advanceStage() {
currentStage = currentStage.next();
stageProgress = 0;
}
public double getStageProgressPercent() {
if (currentStage == HookStage.SACRIFICE) return 100;
int stageDuration = currentStage.getDurationSeconds() * 20;
return (double) stageProgress / stageDuration * 100;
}
public boolean isInStruggle() {
return currentStage == HookStage.STAGE_2;
}
public UUID getId() { return id; }
public Location getLocation() { return location; }
public Survivor getHookedSurvivor() { return hookedSurvivor; }
public HookStage getCurrentStage() { return currentStage; }
public boolean isOccupied() { return occupied; }
public boolean isBasement() { return basement; }
}