From 6d801e473cd59b2f6ae9336b885d44147566eaf4 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 18 Jul 2025 14:23:38 +0200 Subject: [PATCH] Add block/unblock commands and update investigation state handling --- .../velocitycore/commands/CheckCommand.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java index 123f91fa..8826a594 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java +++ b/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java @@ -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 getSchemsToCheck(){ List 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); } } }