Add block/unblock commands and update investigation state handling
All checks were successful
SteamWarCI Build successful
All checks were successful
SteamWarCI Build successful
This commit is contained in:
@ -102,7 +102,7 @@ public class CheckCommand extends SWCommand {
|
||||
boolean isInvestigation = schematic.isInvestigation();
|
||||
|
||||
sender.prefixless("CHECK_LIST_TO_CHECK",
|
||||
new Message("CHECK_LIST_TO_CHECK_HOVER"),
|
||||
isInvestigation ? new Message("PLAIN_STRING", CheckedSchematic.getLastDeclinedOfNode(schematic.getId()).stream().map(CheckedSchematic::getDeclineReason).findFirst().orElse("")) : new Message("CHECK_LIST_TO_CHECK_HOVER"),
|
||||
isInvestigation ? ClickEvent.suggestCommand("") : ClickEvent.runCommand("/check schematic " + schematic.getId()),
|
||||
getWaitTime(schematic),
|
||||
schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), (isInvestigation ? "§c" : "") + schematic.getName());
|
||||
@ -187,7 +187,7 @@ public class CheckCommand extends SWCommand {
|
||||
currentCheckers.get(sender.getPlayer().getUniqueId()).decline(String.join(" ", message));
|
||||
}
|
||||
|
||||
@Register(value = "investigate")
|
||||
@Register(value = "block")
|
||||
public void investigate(PlayerChatter sender, String... message) {
|
||||
if(notChecking(sender.getPlayer()))
|
||||
return;
|
||||
@ -195,6 +195,14 @@ public class CheckCommand extends SWCommand {
|
||||
currentCheckers.get(sender.getPlayer().getUniqueId()).investigate(String.join(" ", message));
|
||||
}
|
||||
|
||||
@Register(value = "unblock")
|
||||
public void uninvestigate(PlayerChatter sender) {
|
||||
if(notChecking(sender.getPlayer()))
|
||||
return;
|
||||
|
||||
currentCheckers.get(sender.getPlayer().getUniqueId()).unblock();
|
||||
}
|
||||
|
||||
public static List<SchematicNode> getSchemsToCheck(){
|
||||
List<SchematicNode> schematicList = new ArrayList<>();
|
||||
|
||||
@ -325,6 +333,7 @@ public class CheckCommand extends SWCommand {
|
||||
CheckedSchematic.create(schematic, checker.user().getId(), startTime, Timestamp.from(Instant.now()), reason, sendMessageIsOnline.getAsBoolean());
|
||||
|
||||
if(type != null) {
|
||||
schematic.setInvestigation(false);
|
||||
schematic.setSchemtype(type);
|
||||
if (type == SchematicType.Normal) {
|
||||
schematic.setPrepared(false);
|
||||
@ -346,7 +355,13 @@ public class CheckCommand extends SWCommand {
|
||||
}
|
||||
|
||||
public void investigate(String reason) {
|
||||
concludeCheckSession(reason, null, () -> true);
|
||||
schematic.setInvestigation(true);
|
||||
concludeCheckSession(reason, null, () -> true);
|
||||
}
|
||||
|
||||
public void unblock() {
|
||||
schematic.setInvestigation(false);
|
||||
CheckedSchematic.create(schematic, checker.user().getId(), startTime, Timestamp.from(Instant.now()), "", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user