added support for sentences in acinform reports

This commit is contained in:
Elias Müller 2024-12-26 20:50:01 +01:00
parent fc067a2ae0
commit 2a52177043

View File

@ -20,17 +20,22 @@ public class AcInform extends Appliance {
String checkName = null; String checkName = null;
Float violationCount = null; Float violationCount = null;
for(int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
if(!args[i].startsWith("--")) continue; if (!args[i].startsWith("--")) continue;
if(i == args.length - 1) continue;
String nextArgument = args[i + 1];
if(nextArgument.startsWith("--")) continue;
switch(args[i]) { StringBuilder valueBuilder = new StringBuilder();
case "--anticheatName" -> anticheatName = nextArgument; for (int j = i + 1; j < args.length; j++) {
case "--playerName" -> playerName = nextArgument; if (args[j].startsWith("--")) break;
case "--check" -> checkName = nextArgument; if (!valueBuilder.isEmpty()) valueBuilder.append(" ");
case "--violationCount" -> violationCount = Float.valueOf(nextArgument); 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) { public void notifyAdmins(@Nullable String anticheatName, @Nullable String playerName, @Nullable String checkName, @Nullable Float violationCount) {
ComponentBuilder<TextComponent, TextComponent.Builder> component = Component.text(); ComponentBuilder<TextComponent, TextComponent.Builder> component = Component.text();
Component prefix = Component.text("# ", NamedTextColor.DARK_RED);
NamedTextColor textColor = NamedTextColor.GRAY; NamedTextColor textColor = NamedTextColor.GRAY;
if(playerName == null || playerName.isBlank()) if(playerName == null || playerName.isBlank())