Merge pull request #224 from CoolJWB/development

Fix tempban reason issues
This commit is contained in:
super 2020-07-13 10:13:45 -04:00 committed by GitHub
commit cdb385dd20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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("\"");
} }