This commit is contained in:
YuTian 2024-08-06 10:26:41 +08:00
parent 0371c889ea
commit fac8abdf6c
2 changed files with 11 additions and 0 deletions

View File

@ -33,6 +33,7 @@ public final class ColorblindWar extends JavaPlugin {
if (game.isStarted()) {
game.stop(false);
}
GiftEffectManager.stopQueue();
}
@Override

View File

@ -7,6 +7,7 @@ import com.io.yutian.colorblindwar.util.RandomUtil;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitTask;
import java.util.*;
import java.util.function.Function;
@ -24,6 +25,15 @@ public class GiftEffectManager {
giftQueues.put(effectId, giftQueue);
}
public static void stopQueue() {
giftQueues.values().forEach(giftQueue -> {
BukkitTask task = giftQueue.getTask();
if (task != null && !task.isCancelled()) {
task.cancel();
}
});
}
public static GiftQueue getGiftQueue(String effectId) {
return giftQueues.get(effectId);
}