This commit is contained in:
loki5512344 2026-06-10 23:00:12 +02:00
parent 89dc9eb00d
commit 957ab4a5a2
149 changed files with 5379 additions and 3263 deletions

View file

@ -135,12 +135,13 @@ public class GeneratorKick {
private void executeKick(Killer killer, Generator gen) {
chargingTasks.remove(killer.getUuid());
// Remove progress
// Remove 20% progress (or configured percent) and STOP — no continuous regression
double regPct = config.getKickRegressionPercent();
double current = gen.getProgress();
double newProg = Math.max(0, current - regPct);
gen.setProgress(newProg);
gen.setUnderRegression(true, config.getKickDuration() * 20);
// Block generator from repair for the cooldown duration
gen.setBlocked(true);
Player p = killer.getPlayer();
if (p != null && p.isOnline()) {
@ -149,10 +150,16 @@ public class GeneratorKick {
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.6f, 1.3f);
}
// Notify all players nearby
Bukkit.broadcast(Component.text("[DBD] ⚡ Маньяк разрушил генератор!", NamedTextColor.DARK_RED));
// Notify all players
Bukkit.broadcast(Component.text("[DBD] ⚡ Маньяк разрушил генератор! -" + (int)regPct + "%", NamedTextColor.DARK_RED));
// Start global cooldown
// Unblock generator after kick-duration (separate from global cooldown)
int unblockTicks = config.getKickDuration() * 20;
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
gen.setBlocked(false);
}, unblockTicks);
// Start global kick cooldown
startGlobalCooldown();
}