From cb108e0c130e7559abd6a696c1ceea231c9fd179 Mon Sep 17 00:00:00 2001 From: CoolJWB Date: Mon, 13 Jul 2020 01:34:39 +0200 Subject: [PATCH] Fix tempban reason issues Tempban won't cut off reasons that take the durations argument place anymore. --- .../totalfreedommod/command/Command_tempban.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tempban.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tempban.java index dacca6ab..4310387a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tempban.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tempban.java @@ -58,20 +58,17 @@ public class Command_tempban extends FreedomCommand final StringBuilder message = new StringBuilder("Temporarily banned " + player.getName()); Date expires = FUtil.parseDateOffset("30m"); + message.append(" until ").append(date_format.format(expires)); + + String reason = null; if (args.length >= 2) { 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) { 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("\""); }