From 2a5217704369b0be839c67e9c55ccfe4d13d547b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Elias=20M=C3=BCller?= <elias@elias-mueller.com>
Date: Thu, 26 Dec 2024 20:50:01 +0100
Subject: [PATCH] added support for sentences in acinform reports

---
 .../spawn/appliances/acInform/AcInform.java   | 26 +++++++++++--------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/main/java/eu/mhsl/craftattack/spawn/appliances/acInform/AcInform.java b/src/main/java/eu/mhsl/craftattack/spawn/appliances/acInform/AcInform.java
index 50fa6bd..99e5365 100644
--- a/src/main/java/eu/mhsl/craftattack/spawn/appliances/acInform/AcInform.java
+++ b/src/main/java/eu/mhsl/craftattack/spawn/appliances/acInform/AcInform.java
@@ -20,17 +20,22 @@ public class AcInform extends Appliance {
         String checkName = null;
         Float violationCount = null;
 
-        for(int i = 0; i < args.length; i++) {
-            if(!args[i].startsWith("--")) continue;
-            if(i == args.length - 1) continue;
-            String nextArgument = args[i + 1];
-            if(nextArgument.startsWith("--")) continue;
+        for (int i = 0; i < args.length; i++) {
+            if (!args[i].startsWith("--")) continue;
 
-            switch(args[i]) {
-                case "--anticheatName" -> anticheatName = nextArgument;
-                case "--playerName" -> playerName = nextArgument;
-                case "--check" -> checkName = nextArgument;
-                case "--violationCount" -> violationCount = Float.valueOf(nextArgument);
+            StringBuilder valueBuilder = new StringBuilder();
+            for (int j = i + 1; j < args.length; j++) {
+                if (args[j].startsWith("--")) break;
+                if (!valueBuilder.isEmpty()) valueBuilder.append(" ");
+                valueBuilder.append(args[j]);
+            }
+
+            String value = valueBuilder.toString();
+            switch (args[i]) {
+                case "--anticheatName" -> anticheatName = value;
+                case "--playerName" -> playerName = value;
+                case "--check" -> checkName = value;
+                case "--violationCount" -> violationCount = value.isEmpty() ? null : Float.valueOf(value);
             }
         }
 
@@ -39,7 +44,6 @@ public class AcInform extends Appliance {
 
     public void notifyAdmins(@Nullable String anticheatName, @Nullable String playerName, @Nullable String checkName, @Nullable Float violationCount) {
         ComponentBuilder<TextComponent, TextComponent.Builder> component = Component.text();
-        Component prefix = Component.text("# ", NamedTextColor.DARK_RED);
         NamedTextColor textColor = NamedTextColor.GRAY;
 
         if(playerName == null || playerName.isBlank())