fix
This commit is contained in:
parent
89dc9eb00d
commit
957ab4a5a2
149 changed files with 5379 additions and 3263 deletions
|
|
@ -8,6 +8,7 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* Handles healing another survivor (shift + proximity, 15 sec by default)
|
||||
|
|
@ -26,6 +27,17 @@ public class SurvivorHealing {
|
|||
// Per-survivor heal counter (tracks heals used this match)
|
||||
private int healsUsed = 0;
|
||||
|
||||
/** Lookup function to find ANY player's Survivor (for healing others). */
|
||||
private Function<Player, Survivor> survivorLookup;
|
||||
|
||||
public void setSurvivorLookup(Function<Player, Survivor> lookup) {
|
||||
this.survivorLookup = lookup;
|
||||
}
|
||||
|
||||
public boolean hasSurvivorLookup() {
|
||||
return survivorLookup != null;
|
||||
}
|
||||
|
||||
public SurvivorHealing(SurvivorController controller, GameConfig config) {
|
||||
this.controller = controller;
|
||||
this.config = config;
|
||||
|
|
@ -171,12 +183,14 @@ public class SurvivorHealing {
|
|||
}
|
||||
|
||||
private Survivor getSurvivorFromPlayer(Player player) {
|
||||
// Self: return controller's survivor
|
||||
if (controller.getPlayer() != null && controller.getPlayer().equals(player)) {
|
||||
return controller.getSurvivor();
|
||||
}
|
||||
// For healing other survivors the target won't be this controller's survivor.
|
||||
// The target state check is done via the Survivor object that must be passed in.
|
||||
// This method is used for both self and other.
|
||||
// Other survivor: use lookup function
|
||||
if (survivorLookup != null) {
|
||||
return survivorLookup.apply(player);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue