Add investigation support to schematics and refine rejection handling

This commit is contained in:
2025-07-18 14:11:26 +02:00
parent a21760003e
commit e17ba8bdcb
4 changed files with 39 additions and 7 deletions
@@ -99,11 +99,13 @@ public class CheckCommand extends SWCommand {
for (SchematicNode schematic : schematicList) {
CheckSession current = currentSchems.get(schematic.getId());
if (current == null) {
boolean isInvestigation = schematic.isInvestigation();
sender.prefixless("CHECK_LIST_TO_CHECK",
new Message("CHECK_LIST_TO_CHECK_HOVER"),
ClickEvent.runCommand("/check schematic " + schematic.getId()),
isInvestigation ? ClickEvent.suggestCommand("") : ClickEvent.runCommand("/check schematic " + schematic.getId()),
getWaitTime(schematic),
schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName());
schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), (isInvestigation ? "§c" : "") + schematic.getName());
} else {
sender.prefixless("CHECK_LIST_CHECKING",
new Message("CHECK_LIST_CHECKING_HOVER"),
@@ -130,6 +132,10 @@ public class CheckCommand extends SWCommand {
return;
}
if(schem.isInvestigation() && !sender.user().hasPerm(UserPerm.MODERATION)) {
sender.system("CHECK_SCHEMATIC_INVESTIGATION_PENDING");
}
int playerTeam = sender.user().hasPerm(UserPerm.MODERATION) ? 0 : sender.user().getTeam();
if (playerTeam != 0 && SteamwarUser.get(schem.getOwner()).getTeam() == playerTeam) {
sender.system("CHECK_SCHEMATIC_OWN_TEAM");
@@ -181,6 +187,14 @@ public class CheckCommand extends SWCommand {
currentCheckers.get(sender.getPlayer().getUniqueId()).decline(String.join(" ", message));
}
@Register(value = "investigate")
public void investigate(PlayerChatter sender, String... message) {
if(notChecking(sender.getPlayer()))
return;
currentCheckers.get(sender.getPlayer().getUniqueId()).investigate(String.join(" ", message));
}
public static List<SchematicNode> getSchemsToCheck(){
List<SchematicNode> schematicList = new ArrayList<>();
@@ -223,7 +237,7 @@ public class CheckCommand extends SWCommand {
currentCheckers.put(checker.user().getUUID(), this);
currentSchems.put(schematic.getId(), this);
for(CheckedSchematic previous : CheckedSchematic.previousChecks(schematic))
for(CheckedSchematic previous : CheckedSchematic.getLastDeclinedOfNode(schematic.getId()))
checker.prefixless("CHECK_SCHEMATIC_PREVIOUS", previous.getEndTime(), SteamwarUser.get(previous.getValidator()).getUserName(), previous.getDeclineReason());
next();
}).start();
@@ -309,6 +323,7 @@ public class CheckCommand extends SWCommand {
private void concludeCheckSession(String reason, SchematicType type, BooleanSupplier sendMessageIsOnline) {
if(SchematicNode.getSchematicNode(schematic.getId()) != null) {
CheckedSchematic.create(schematic, checker.user().getId(), startTime, Timestamp.from(Instant.now()), reason, sendMessageIsOnline.getAsBoolean());
if(type != null) {
schematic.setSchemtype(type);
if (type == SchematicType.Normal) {
@@ -329,5 +344,9 @@ public class CheckCommand extends SWCommand {
currentCheckers.remove(checker.user().getUUID());
currentSchems.remove(schematic.getId());
}
public void investigate(String reason) {
concludeCheckSession(reason, null, () -> true);
}
}
}