Fix tempban reason issues

Tempban won't cut off reasons that take the durations argument place anymore.
This commit is contained in:
CoolJWB 2020-07-13 01:34:39 +02:00
parent f9e8a4c8ba
commit cb108e0c13

View File

@ -58,20 +58,17 @@ public class Command_tempban extends FreedomCommand
final StringBuilder message = new StringBuilder("Temporarily banned " + player.getName()); final StringBuilder message = new StringBuilder("Temporarily banned " + player.getName());
Date expires = FUtil.parseDateOffset("30m"); Date expires = FUtil.parseDateOffset("30m");
message.append(" until ").append(date_format.format(expires));
String reason = null;
if (args.length >= 2) if (args.length >= 2)
{ {
Date parsed_offset = FUtil.parseDateOffset(args[1]); Date parsed_offset = FUtil.parseDateOffset(args[1]);
reason = StringUtils.join(ArrayUtils.subarray(args, parsed_offset == null ? 1 : 2, args.length), " ") + " (" + sender.getName() + ")";
if (parsed_offset != null) if (parsed_offset != null)
{ {
expires = parsed_offset; expires = parsed_offset;
} }
}
message.append(" until ").append(date_format.format(expires));
String reason = null;
if (args.length >= 3)
{
reason = StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ") + " (" + sender.getName() + ")";
message.append(", Reason: \"").append(reason).append("\""); message.append(", Reason: \"").append(reason).append("\"");
} }