/* * This file is a part of the SteamWar software. * * Copyright (C) 2025 SteamWar.de-Serverteam * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package de.steamwar.teamserver.command; import de.steamwar.command.SWCommand; import de.steamwar.linkage.Linked; import de.steamwar.teamserver.Builder; import de.steamwar.teamserver.listener.FreezeListener; import net.md_5.bungee.api.ChatMessageType; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @Linked public class FreezeCommand extends SWCommand { public FreezeCommand() { super("freeze", "stoplag"); } @Register(description = "REGION_FREEZE_HELP") public void toggleCommand(Player p) { if (toggle()) { Bukkit.getOnlinePlayers().forEach(player -> { Builder.MESSAGE.sendPrefixless("REGION_FREEZE_ENABLED", player, ChatMessageType.ACTION_BAR); }); } else { Bukkit.getOnlinePlayers().forEach(player -> { Builder.MESSAGE.sendPrefixless("REGION_FREEZE_DISABLED", player, ChatMessageType.ACTION_BAR); }); } } private boolean toggle() { if (FreezeListener.freeze) { FreezeListener.freeze = false; } else { FreezeListener.freeze = true; } return FreezeListener.freeze; } }