fix: 10 bug fixes — healing dead players, kick bypass, gate race, swimming ghost, regression config, dead code cleanup, gate zone detection
This commit is contained in:
parent
b666f1b0fa
commit
d2b174b94c
35 changed files with 587 additions and 773 deletions
|
|
@ -14,7 +14,9 @@ import org.bukkit.plugin.Plugin;
|
|||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -39,6 +41,9 @@ public class GeneratorKick {
|
|||
private int globalCooldownTicks = 0;
|
||||
private BukkitTask cooldownTask;
|
||||
|
||||
/** Pending unblock tasks — cancelled on shutdown to avoid ghost tasks */
|
||||
private final List<BukkitTask> pendingUnblockTasks = new ArrayList<>();
|
||||
|
||||
public GeneratorKick(Plugin plugin, GameConfig config, GeneratorManager generatorManager) {
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
|
|
@ -135,6 +140,8 @@ public class GeneratorKick {
|
|||
for (BukkitTask t : chargingTasks.values()) t.cancel();
|
||||
chargingTasks.clear();
|
||||
if (cooldownTask != null) { cooldownTask.cancel(); cooldownTask = null; }
|
||||
for (BukkitTask t : pendingUnblockTasks) t.cancel();
|
||||
pendingUnblockTasks.clear();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
|
@ -164,9 +171,10 @@ public class GeneratorKick {
|
|||
|
||||
// Unblock generator after kick-duration (separate from global cooldown)
|
||||
int unblockTicks = config.getKickDuration() * 20;
|
||||
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
|
||||
BukkitTask unblockTask = plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
|
||||
gen.setBlocked(false);
|
||||
}, unblockTicks);
|
||||
pendingUnblockTasks.add(unblockTask);
|
||||
|
||||
// Start global kick cooldown
|
||||
startGlobalCooldown();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue