Add TowerRun module

This commit is contained in:
2024-08-05 09:02:07 +02:00
parent a760366d30
commit d4af6d9ddb
29 changed files with 2293 additions and 1 deletions
@@ -0,0 +1,51 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 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.towerrun.commands;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeValidator;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup;
import de.steamwar.towerrun.TowerRun;
import de.steamwar.towerrun.countdowns.LobbyCountdown;
import org.bukkit.entity.Player;
public class StartCommand extends SWCommand {
private final LobbyCountdown countdown;
public StartCommand(LobbyCountdown countdown) {
super("start", "skip");
this.countdown = countdown;
}
@Register
public void command(@Validator Player player) {
if (countdown.getTime() > 10) {
countdown.setOverride(true);
countdown.setTime(10);
}
TowerRun.getMessage().send("COMMAND_START", player);
}
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> playerValidator() {
return (commandSender, player, messageSender) -> SteamwarUser.get(player.getUniqueId()).getUserGroup() != UserGroup.Member;
}
}