fix: resolve 3 remaining bugs (checkPlayerFall, removeTrailBlocks, scoredBlocks)
This commit is contained in:
parent
8f094c2971
commit
bee00c0c81
4 changed files with 14 additions and 3 deletions
|
|
@ -99,6 +99,8 @@ public class LifecycleEventManager {
|
|||
if (generator.state.playerSpawn != null) {
|
||||
player.teleport(generator.state.playerSpawn);
|
||||
}
|
||||
// Clear scored blocks so same coordinates can be re-scored after respawn
|
||||
player.clearScoredBlocks();
|
||||
}
|
||||
|
||||
// Reset generator state
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class LifecycleTickManager {
|
|||
for (var player : generator.getPlayers()) {
|
||||
if (player.player.getLocation().getY() < fallThreshold) {
|
||||
generator.fall();
|
||||
break; // Only trigger once per tick
|
||||
continue; // Don't break — keep checking remaining players
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,8 +88,10 @@ public class GeneratorCleanup {
|
|||
}
|
||||
}
|
||||
|
||||
// Remove from history
|
||||
generator.state.history.subList(startIndex, endIndex).clear();
|
||||
// Remove from history (synchronized to prevent concurrent index shift)
|
||||
synchronized (generator.state.history) {
|
||||
generator.state.history.subList(startIndex, endIndex).clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -115,6 +115,13 @@ public class ParkourPlayer extends ParkourUser {
|
|||
save(LoParkour.getPlugin().isEnabled());
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear scored blocks set, typically on fall/respawn so same coordinates can be re-scored.
|
||||
*/
|
||||
public void clearScoredBlocks() {
|
||||
scoredBlocks.clear();
|
||||
}
|
||||
|
||||
private static String blockKey(Block block) {
|
||||
return block.getX() + "," + block.getY() + "," + block.getZ();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue