SteamWar/BungeeCore
Archiviert
13
2

Fix CheckCommand schematic deleted
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2023-02-17 11:54:20 +01:00
Ursprung 6e2546a596
Commit 27c241f2d4
2 geänderte Dateien mit 38 neuen und 28 gelöschten Zeilen

@ -1 +1 @@
Subproject commit 69024c3bb9a432b71d94d28e7f5485e69d976b3f
Subproject commit 89b0c14da664589a7c9699d73bf72028cdf9dd0d

Datei anzeigen

@ -28,7 +28,6 @@ import de.steamwar.bungeecore.sql.SchematicType;
import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.command.SWCommand;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.TextComponent;
@ -37,7 +36,6 @@ import net.md_5.bungee.config.Configuration;
import java.sql.Timestamp;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
@ -265,6 +263,7 @@ public class CheckCommand extends SWCommand {
}
private void accept(int rank){
if(createLog("freigegeben")) {
if(ranks.containsKey(schematic.getSchemtype())){
if(rank <= 0 || ranks.get(schematic.getSchemtype()).size() < rank){
Message.send("CHECK_INVALID_RANK", checker);
@ -274,7 +273,6 @@ public class CheckCommand extends SWCommand {
}
schematic.setType(schematic.getSchemtype().fightType().toDB());
CheckedSchematic.create(schematic, SteamwarUser.get(checker.getUniqueId()).getId(), startTime, Timestamp.from(Instant.now()), "freigegeben");
SteamwarUser user = SteamwarUser.get(schematic.getOwner());
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(user.getUuid());
if(player != null) {
@ -283,11 +281,13 @@ public class CheckCommand extends SWCommand {
DiscordSchemAlert.sendAccept(schematic, user);
}
Message.team("CHECK_ACCEPTED_TEAM", schematic.getName(), user.getUserName());
}
stop();
}
private void decline(String reason){
CheckedSchematic.create(schematic, SteamwarUser.get(checker.getUniqueId()).getId(), startTime, Timestamp.from(Instant.now()), reason);
if(createLog(reason)) {
SteamwarUser user = SteamwarUser.get(schematic.getOwner());
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(user.getUuid());
if(player != null) {
@ -297,11 +297,13 @@ public class CheckCommand extends SWCommand {
}
Message.team("CHECK_DECLINED_TEAM", schematic.getName(), user.getUserName(), reason);
schematic.setType(SchematicType.Normal.toDB());
}
stop();
}
private void abort(){
CheckedSchematic.create(schematic, SteamwarUser.get(checker.getUniqueId()).getId(), startTime, Timestamp.from(Instant.now()), "Prüfvorgang abgebrochen");
createLog("Prüfvorgang abgebrochen");
stop();
}
@ -322,5 +324,13 @@ public class CheckCommand extends SWCommand {
currentCheckers.remove(checker.getUniqueId());
currentSchems.remove(schematic.getId());
}
private boolean createLog(String reason) {
if(SchematicNode.getSchematicNode(schematic.getId()) == null) // Schematic was deleted
return false;
CheckedSchematic.create(schematic, SteamwarUser.get(checker.getUniqueId()).getId(), startTime, Timestamp.from(Instant.now()), reason);
return true;
}
}
}