forked from SteamWar/SteamWar
Remove UnrankCommand
This commit is contained in:
@@ -167,7 +167,6 @@ TPS_WARNING=§c{0} §7TPS
|
|||||||
UI_PRE_RUNNING=§7Kits distributed
|
UI_PRE_RUNNING=§7Kits distributed
|
||||||
UI_RUNNING=§aFight started
|
UI_RUNNING=§aFight started
|
||||||
UI_SKIP=§7Skipping to next event
|
UI_SKIP=§7Skipping to next event
|
||||||
UI_UNRANKED=§7Unranked match
|
|
||||||
UI_PLAYER_JOINS=§a§l» {0}{1}
|
UI_PLAYER_JOINS=§a§l» {0}{1}
|
||||||
UI_PLAYER_LEAVES=§c§l« {0}{1}
|
UI_PLAYER_LEAVES=§c§l« {0}{1}
|
||||||
UI_LEADER_JOINS=§a§l» {0}Leader {1}
|
UI_LEADER_JOINS=§a§l» {0}Leader {1}
|
||||||
|
|||||||
@@ -154,7 +154,6 @@ COMMAND_CURRENTLY_UNAVAILABLE=§cDieser Befehl ist zu diesem Kampfzeitpunkt nich
|
|||||||
UI_PRE_RUNNING=§7Kits verteilt
|
UI_PRE_RUNNING=§7Kits verteilt
|
||||||
UI_RUNNING=§aArena freigegeben
|
UI_RUNNING=§aArena freigegeben
|
||||||
UI_SKIP=§7Sprung zum nächsten Ereignis
|
UI_SKIP=§7Sprung zum nächsten Ereignis
|
||||||
UI_UNRANKED=§7Ungewerteter Kampf
|
|
||||||
UI_LEADER_JOINS=§a§l» {0}Leader {1}
|
UI_LEADER_JOINS=§a§l» {0}Leader {1}
|
||||||
UI_PLAYER_DEATH={0}{1} §7ist gestorben
|
UI_PLAYER_DEATH={0}{1} §7ist gestorben
|
||||||
UI_PLAYER_LEAVE={0}{1} §7hat den Kampf verlassen
|
UI_PLAYER_LEAVE={0}{1} §7hat den Kampf verlassen
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.fightsystem.commands;
|
|
||||||
|
|
||||||
import de.steamwar.fightsystem.ArenaMode;
|
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
|
||||||
import de.steamwar.fightsystem.states.StateDependentCommand;
|
|
||||||
import de.steamwar.fightsystem.utils.FightStatistics;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
public class UnrankCommand implements CommandExecutor {
|
|
||||||
|
|
||||||
public UnrankCommand () {
|
|
||||||
new StateDependentCommand(ArenaMode.VariableTeams, FightState.Setup, "unrank", this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
||||||
if(!(sender instanceof Player))
|
|
||||||
return false;
|
|
||||||
Player player = (Player) sender;
|
|
||||||
|
|
||||||
if(Commands.checkGetLeader(player) == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
FightStatistics.unrank();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -32,20 +32,16 @@ import de.steamwar.fightsystem.states.FightState;
|
|||||||
import de.steamwar.fightsystem.states.OneShotStateDependent;
|
import de.steamwar.fightsystem.states.OneShotStateDependent;
|
||||||
import de.steamwar.fightsystem.winconditions.Wincondition;
|
import de.steamwar.fightsystem.winconditions.Wincondition;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.network.NetworkSender;
|
|
||||||
import de.steamwar.network.packets.common.FightEndsPacket;
|
|
||||||
import de.steamwar.sql.EventFight;
|
import de.steamwar.sql.EventFight;
|
||||||
import de.steamwar.sql.EventRelation;
|
import de.steamwar.sql.EventRelation;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import lombok.Getter;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static de.steamwar.sql.Fight.create;
|
import static de.steamwar.sql.Fight.create;
|
||||||
import static de.steamwar.sql.Fight.markReplayAvailable;
|
import static de.steamwar.sql.Fight.markReplayAvailable;
|
||||||
@@ -53,14 +49,6 @@ import static de.steamwar.sql.Fight.markReplayAvailable;
|
|||||||
@Linked
|
@Linked
|
||||||
public class FightStatistics {
|
public class FightStatistics {
|
||||||
|
|
||||||
@Getter
|
|
||||||
private static boolean unranked = false;
|
|
||||||
|
|
||||||
public static void unrank() {
|
|
||||||
unranked = true;
|
|
||||||
FightUI.addSubtitle("UI_UNRANKED");
|
|
||||||
}
|
|
||||||
|
|
||||||
private Timestamp starttime = Timestamp.from(Instant.now());
|
private Timestamp starttime = Timestamp.from(Instant.now());
|
||||||
|
|
||||||
public FightStatistics() {
|
public FightStatistics() {
|
||||||
@@ -145,12 +133,6 @@ public class FightStatistics {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Failed to save statistics", e);
|
Bukkit.getLogger().log(Level.SEVERE, "Failed to save statistics", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Bukkit.getOnlinePlayers().isEmpty() && !unranked) {
|
|
||||||
NetworkSender.send(new FightEndsPacket((byte) win, blueSchem == null ? 0 : blueSchem, redSchem == null ? 0 : redSchem, Fight.getBlueTeam().getPlayers().stream().map(FightPlayer::getUser).map(SteamwarUser::getId).collect(Collectors.toList()), Fight.getRedTeam().getPlayers().stream().map(FightPlayer::getUser).map(SteamwarUser::getId).collect(Collectors.toList()), gameMode, (int)(endTime.getEpochSecond() - starttime.toInstant().getEpochSecond())));
|
|
||||||
}
|
|
||||||
|
|
||||||
unranked = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getLeader(FightTeam team) {
|
private int getLeader(FightTeam team) {
|
||||||
|
|||||||
Reference in New Issue
Block a user