Allow HH:mm on /ban and /mute #132
@ -51,7 +51,8 @@ public class BanCommand extends BasicCommand {
|
||||
return;
|
||||
|
||||
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(" ");
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,8 @@ public class MuteCommand extends BasicCommand {
|
||||
return;
|
||||
|
||||
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(" ");
|
||||
}
|
||||
String msg = muteReason.toString();
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren