SteamWar/FightSystem
Archiviert
13
1

Remove dysfunctional lockreplay command
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2022-03-15 08:32:39 +01:00
Ursprung ea3261ccfa
Commit bb3929c563
5 geänderte Dateien mit 1 neuen und 66 gelöschten Zeilen

Datei anzeigen

@ -138,7 +138,6 @@ public class FightSystem extends JavaPlugin {
new AkCommand(); new AkCommand();
new LeaderCommand(); new LeaderCommand();
new LockschemCommand(); new LockschemCommand();
new LockReplayCommand();
new StateCommand(); new StateCommand();
new SkipCommand(); new SkipCommand();
new WinCommand(); new WinCommand();

Datei anzeigen

@ -53,8 +53,6 @@ LOCKSCHEM_LOCKED_BY=
REMOVE_HELP=§8/§eremove §8[§eSpieler§8] REMOVE_HELP=§8/§eremove §8[§eSpieler§8]
REPLAY_LOCKED=§7Replaywiedergabe für 1 Monat gesperrt
NOT_FIGHTLEADER=§cDu bist nicht Kampfleiter NOT_FIGHTLEADER=§cDu bist nicht Kampfleiter
WIN_HELP=§8/§7win §8[§eTeam §8or §etie§8] WIN_HELP=§8/§7win §8[§eTeam §8or §etie§8]

Datei anzeigen

@ -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 <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.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;
}
}

Datei anzeigen

@ -39,7 +39,6 @@ import org.bukkit.entity.Player;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.time.Instant; import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -48,15 +47,8 @@ import static de.steamwar.sql.Fight.setReplay;
public class FightStatistics { public class FightStatistics {
private static final int K = 20;
private static boolean replayLock = false;
private Timestamp starttime = Timestamp.from(Instant.now()); private Timestamp starttime = Timestamp.from(Instant.now());
public static void lockReplay() {
replayLock = true;
}
public FightStatistics() { public FightStatistics() {
new OneShotStateDependent(ArenaMode.SeriousFight, FightState.Running, this::enable); new OneShotStateDependent(ArenaMode.SeriousFight, FightState.Running, this::enable);
new OneShotStateDependent(ArenaMode.Event, FightState.Spectate, this::setEventResult); new OneShotStateDependent(ArenaMode.Event, FightState.Spectate, this::setEventResult);
@ -112,7 +104,7 @@ public class FightStatistics {
try { try {
int fightId = create(gameMode, Bukkit.getWorlds().get(0).getName(), starttime, remainingTime, 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()) for (FightPlayer fp : Fight.getBlueTeam().getPlayers())
savePlayerStats(fp, fightId); savePlayerStats(fp, fightId);
@ -131,7 +123,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);
} }
replayLock = false;
if (!Bukkit.getOnlinePlayers().isEmpty()) { if (!Bukkit.getOnlinePlayers().isEmpty()) {
Player p = Bukkit.getOnlinePlayers().iterator().next(); Player p = Bukkit.getOnlinePlayers().iterator().next();

Datei anzeigen

@ -18,7 +18,6 @@ commands:
remove: remove:
leader: leader:
lockschem: lockschem:
lockreplay:
state: state:
skip: skip:
win: win: