fixed bug in teamtasks

This commit is contained in:
2025-06-21 17:55:52 +02:00
parent 0d1e6070ce
commit 427aed9a7e
6 changed files with 8 additions and 9 deletions

View File

@ -91,7 +91,7 @@ public class Countdown {
} }
} }
public boolean isDone() { private boolean isDone() {
return this.current <= 0; return this.current <= 0;
} }

View File

@ -59,7 +59,6 @@ public class ProjectStart extends Appliance {
private final Map<GameRule<Boolean>, Boolean> gameRulesAfterStart = Map.ofEntries( private final Map<GameRule<Boolean>, Boolean> gameRulesAfterStart = Map.ofEntries(
entry(GameRule.DO_DAYLIGHT_CYCLE, true), entry(GameRule.DO_DAYLIGHT_CYCLE, true),
entry(GameRule.DO_INSOMNIA, true), entry(GameRule.DO_INSOMNIA, true),
entry(GameRule.ANNOUNCE_ADVANCEMENTS, true),
entry(GameRule.DISABLE_RAIDS, false), entry(GameRule.DISABLE_RAIDS, false),
entry(GameRule.DO_FIRE_TICK, true), entry(GameRule.DO_FIRE_TICK, true),
entry(GameRule.DO_ENTITY_DROPS, true), entry(GameRule.DO_ENTITY_DROPS, true),

View File

@ -2,5 +2,5 @@ package eu.mhsl.craftattack.spawn.varo.appliances.internal.teamTasks;
public interface Task { public interface Task {
void stopTask(); void stopTask();
boolean isRunning(); boolean isTaskRunning();
} }

View File

@ -27,17 +27,17 @@ public class TeamTasks extends Appliance {
public Map<Type, Task> getRunningTeamTasks(VaroTeam team) { public Map<Type, Task> getRunningTeamTasks(VaroTeam team) {
return this.getTeamTasks(team).entrySet().stream() return this.getTeamTasks(team).entrySet().stream()
.filter(entry -> entry.getValue().isRunning()) .filter(entry -> entry.getValue().isTaskRunning())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
} }
public void cancelTeamTasks(VaroTeam team) { public void cancelTeamTasks(VaroTeam team) {
Main.logger().info(String.format("All TeamTasks for Team %s were cancelled: %s", team.name, this.getRunningTeamTasks(team))); Main.logger().info(String.format("All TeamTasks for Team %s were cancelled: %s", team.name, this.getRunningTeamTasks(team)));
this.getTeamTasks(team).forEach((type, bukkitTask) -> bukkitTask.stopTask()); this.getTeamTasks(team).forEach((type, task) -> task.stopTask());
} }
public void addTask(VaroTeam team, Type type, Task runnable) { public void addTask(VaroTeam team, Type type, Task runnable) {
if(this.getTeamTasks(team).containsKey(type) && this.getTeamTasks(team).get(type).isRunning()) { if(this.getTeamTasks(team).containsKey(type) && this.getTeamTasks(team).get(type).isTaskRunning()) {
throw new IllegalStateException(String.format("Task %s for Team %s was already running!", type.name(), team.name)); throw new IllegalStateException(String.format("Task %s for Team %s was already running!", type.name(), team.name));
} }

View File

@ -10,7 +10,7 @@ public abstract class BukkitTeamTask implements Task, BukkitTask {
} }
@Override @Override
public boolean isRunning() { public boolean isTaskRunning() {
return !this.isCancelled(); return !this.isCancelled();
} }
} }

View File

@ -18,7 +18,7 @@ public class CountdownTeamTask extends Countdown implements Task {
} }
@Override @Override
public boolean isRunning() { public boolean isTaskRunning() {
return !super.isDone(); return super.isRunning();
} }
} }