Add Teamserver module

This commit is contained in:
2024-08-05 09:42:55 +02:00
parent 2bdd23d04a
commit 5887f1703a
14 changed files with 1042 additions and 0 deletions
@@ -0,0 +1,56 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.teamserver.command;
import de.steamwar.command.SWCommand;
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;
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;
}
}