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();
|
boolean isInvestigation = schematic.isInvestigation();
|
||||||
|
|
||||||
sender.prefixless("CHECK_LIST_TO_CHECK",
|
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()),
|
isInvestigation ? ClickEvent.suggestCommand("") : ClickEvent.runCommand("/check schematic " + schematic.getId()),
|
||||||
getWaitTime(schematic),
|
getWaitTime(schematic),
|
||||||
schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), (isInvestigation ? "§c" : "") + schematic.getName());
|
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));
|
currentCheckers.get(sender.getPlayer().getUniqueId()).decline(String.join(" ", message));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "investigate")
|
@Register(value = "block")
|
||||||
public void investigate(PlayerChatter sender, String... message) {
|
public void investigate(PlayerChatter sender, String... message) {
|
||||||
if(notChecking(sender.getPlayer()))
|
if(notChecking(sender.getPlayer()))
|
||||||
return;
|
return;
|
||||||
@ -195,6 +195,14 @@ public class CheckCommand extends SWCommand {
|
|||||||
currentCheckers.get(sender.getPlayer().getUniqueId()).investigate(String.join(" ", message));
|
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(){
|
public static List<SchematicNode> getSchemsToCheck(){
|
||||||
List<SchematicNode> schematicList = new ArrayList<>();
|
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());
|
CheckedSchematic.create(schematic, checker.user().getId(), startTime, Timestamp.from(Instant.now()), reason, sendMessageIsOnline.getAsBoolean());
|
||||||
|
|
||||||
if(type != null) {
|
if(type != null) {
|
||||||
|
schematic.setInvestigation(false);
|
||||||
schematic.setSchemtype(type);
|
schematic.setSchemtype(type);
|
||||||
if (type == SchematicType.Normal) {
|
if (type == SchematicType.Normal) {
|
||||||
schematic.setPrepared(false);
|
schematic.setPrepared(false);
|
||||||
@ -346,7 +355,13 @@ public class CheckCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void investigate(String reason) {
|
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