diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java index ecd354c..4d6acb8 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java @@ -140,6 +140,7 @@ public class FightSystem extends JavaPlugin { new LockschemCommand(); new StateCommand(); new SkipCommand(); + new UnrankCommand(); new WinCommand(); new LiveRecorder(); diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties index 1a52880..2f2ec0d 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties +++ b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties @@ -173,6 +173,7 @@ TPS_WARNING= UI_PRE_RUNNING=§7Kits verteilt UI_RUNNING=§aArena freigegeben UI_SKIP=§7Sprung zum nächsten Ereignis +UI_UNRANKED=§7Ungewerteter Kampf UI_PLAYER_JOINS=§a§l» {0}{1} UI_PLAYER_LEAVES=§c§l« {0}{1} UI_LEADER_JOINS=§a§l» {0}Leader {1} diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/commands/UnrankCommand.java b/FightSystem_Core/src/de/steamwar/fightsystem/commands/UnrankCommand.java new file mode 100644 index 0000000..25bdf35 --- /dev/null +++ b/FightSystem_Core/src/de/steamwar/fightsystem/commands/UnrankCommand.java @@ -0,0 +1,49 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2022 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.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 org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +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; + } +} diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/utils/FightStatistics.java b/FightSystem_Core/src/de/steamwar/fightsystem/utils/FightStatistics.java index eb3de05..f1e6e25 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/utils/FightStatistics.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/utils/FightStatistics.java @@ -47,6 +47,13 @@ import static de.steamwar.sql.Fight.setReplay; public class FightStatistics { + private static boolean unranked = false; + + public static void unrank() { + unranked = true; + FightUI.addSubtitle("UI_UNRANKED"); + } + private Timestamp starttime = Timestamp.from(Instant.now()); public FightStatistics() { @@ -124,10 +131,12 @@ public class FightStatistics { Bukkit.getLogger().log(Level.SEVERE, "Failed to save statistics", e); } - if (!Bukkit.getOnlinePlayers().isEmpty()) { + if (!Bukkit.getOnlinePlayers().isEmpty() && !unranked) { Player p = Bukkit.getOnlinePlayers().iterator().next(); new FightEndsPacket((byte) win, blueSchem == null ? 0 : blueSchem, redSchem == null ? 0 : redSchem, Fight.getBlueTeam().getPlayers().stream().map(FightPlayer::getPlayer).map(SteamwarUser::get).map(SteamwarUser::getId).collect(Collectors.toList()), Fight.getRedTeam().getPlayers().stream().map(FightPlayer::getPlayer).map(SteamwarUser::get).map(SteamwarUser::getId).collect(Collectors.toList()), gameMode).send(p); } + + unranked = false; } private int getLeader(FightTeam team) { diff --git a/FightSystem_Core/src/plugin.yml b/FightSystem_Core/src/plugin.yml index d608f19..f66ce4f 100644 --- a/FightSystem_Core/src/plugin.yml +++ b/FightSystem_Core/src/plugin.yml @@ -22,4 +22,5 @@ commands: skip: win: resetwg: - resettb: \ No newline at end of file + resettb: + unrank: \ No newline at end of file