SteamWar/BungeeCore
Archiviert
13
2
Dieser Commit ist enthalten in:
Chaoscaot 2020-10-20 22:10:57 +02:00
Ursprung c3ff72373b
Commit a959b20370
2 geänderte Dateien mit 14 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -51,7 +51,8 @@ public class BanCommand extends BasicCommand {
return; return;
StringBuilder banReason = new StringBuilder(); StringBuilder banReason = new StringBuilder();
for (int i = 3; i < args.length; i++){ int start = hasTimestamp(args[2])?2:3;
for (int i = start; i < args.length; i++){
banReason.append(args[i]).append(" "); banReason.append(args[i]).append(" ");
} }
String msg = banReason.toString(); String msg = banReason.toString();
@ -79,4 +80,14 @@ public class BanCommand extends BasicCommand {
} }
} }
} }
public static boolean hasTimestamp(String time) {
SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm");
try{
dateFormat.parse(time);
return true;
}catch(ParseException exception){
return false;
}
}
} }

Datei anzeigen

@ -47,7 +47,8 @@ public class MuteCommand extends BasicCommand {
return; return;
StringBuilder muteReason = new StringBuilder(); StringBuilder muteReason = new StringBuilder();
for (int i = 3; i < args.length; i++){ int start = BanCommand.hasTimestamp(args[2])?2:3;
for (int i = start; i < args.length; i++){
muteReason.append(args[i]).append(" "); muteReason.append(args[i]).append(" ");
} }
String msg = muteReason.toString(); String msg = muteReason.toString();