From bb3929c563589bca6861871bea6ce746a7d16004 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 15 Mar 2022 08:32:39 +0100 Subject: [PATCH] Remove dysfunctional lockreplay command Signed-off-by: Lixfel --- .../de/steamwar/fightsystem/FightSystem.java | 1 - .../fightsystem/FightSystem.properties | 2 - .../commands/LockReplayCommand.java | 52 ------------------- .../fightsystem/utils/FightStatistics.java | 11 +--- FightSystem_Core/src/plugin.yml | 1 - 5 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 FightSystem_Core/src/de/steamwar/fightsystem/commands/LockReplayCommand.java diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java index 5088d1c..ecd354c 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java @@ -138,7 +138,6 @@ public class FightSystem extends JavaPlugin { new AkCommand(); new LeaderCommand(); new LockschemCommand(); - new LockReplayCommand(); new StateCommand(); new SkipCommand(); new WinCommand(); diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties index bff5b59..1a52880 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties +++ b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties @@ -53,8 +53,6 @@ LOCKSCHEM_LOCKED_BY= REMOVE_HELP=§8/§eremove §8[§eSpieler§8] -REPLAY_LOCKED=§7Replaywiedergabe für 1 Monat gesperrt - NOT_FIGHTLEADER=§cDu bist nicht Kampfleiter WIN_HELP=§8/§7win §8[§eTeam §8or §etie§8] diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/commands/LockReplayCommand.java b/FightSystem_Core/src/de/steamwar/fightsystem/commands/LockReplayCommand.java deleted file mode 100644 index 72bdee6..0000000 --- a/FightSystem_Core/src/de/steamwar/fightsystem/commands/LockReplayCommand.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - This file is a part of the SteamWar software. - - Copyright (C) 2020 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 de.steamwar.fightsystem.utils.FightUI; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class LockReplayCommand implements CommandExecutor { - - public LockReplayCommand() { - new StateDependentCommand(ArenaMode.AntiReplay, FightState.Schem, "lockreplay", 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.lockReplay(); - FightUI.addSubtitle("REPLAY_LOCKED"); - 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 a527439..eb3de05 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/utils/FightStatistics.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/utils/FightStatistics.java @@ -39,7 +39,6 @@ import org.bukkit.entity.Player; import java.io.FileInputStream; import java.sql.Timestamp; import java.time.Instant; -import java.time.temporal.ChronoUnit; import java.util.logging.Level; import java.util.stream.Collectors; @@ -48,15 +47,8 @@ import static de.steamwar.sql.Fight.setReplay; public class FightStatistics { - private static final int K = 20; - private static boolean replayLock = false; - private Timestamp starttime = Timestamp.from(Instant.now()); - public static void lockReplay() { - replayLock = true; - } - public FightStatistics() { new OneShotStateDependent(ArenaMode.SeriousFight, FightState.Running, this::enable); new OneShotStateDependent(ArenaMode.Event, FightState.Spectate, this::setEventResult); @@ -112,7 +104,7 @@ public class FightStatistics { try { int fightId = create(gameMode, Bukkit.getWorlds().get(0).getName(), starttime, remainingTime, - blueLeader, redLeader, blueSchem, redSchem, win, windescription, Timestamp.from(Instant.now().plus(replayLock ? 30 : 0, ChronoUnit.DAYS))); + blueLeader, redLeader, blueSchem, redSchem, win, windescription); for (FightPlayer fp : Fight.getBlueTeam().getPlayers()) savePlayerStats(fp, fightId); @@ -131,7 +123,6 @@ public class FightStatistics { } catch (Exception e) { Bukkit.getLogger().log(Level.SEVERE, "Failed to save statistics", e); } - replayLock = false; if (!Bukkit.getOnlinePlayers().isEmpty()) { Player p = Bukkit.getOnlinePlayers().iterator().next(); diff --git a/FightSystem_Core/src/plugin.yml b/FightSystem_Core/src/plugin.yml index 74e8510..d608f19 100644 --- a/FightSystem_Core/src/plugin.yml +++ b/FightSystem_Core/src/plugin.yml @@ -18,7 +18,6 @@ commands: remove: leader: lockschem: - lockreplay: state: skip: win: