From 1321e30ad6614fd5217de193ab7ae2bbf39286d2 Mon Sep 17 00:00:00 2001 From: routersys Date: Sat, 12 Sep 2026 11:12:03 +0900 Subject: [PATCH] =?UTF-8?q?=E6=9C=9F=E9=99=90=E4=BB=98=E3=81=8DBAN?= =?UTF-8?q?=E3=82=92=E6=8C=87=E5=AE=9A=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../github/ucchyocean/lc3/command/BanCommand.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/github/ucchyocean/lc3/command/BanCommand.java b/src/main/java/com/github/ucchyocean/lc3/command/BanCommand.java index aedd76b..4620524 100644 --- a/src/main/java/com/github/ucchyocean/lc3/command/BanCommand.java +++ b/src/main/java/com/github/ucchyocean/lc3/command/BanCommand.java @@ -87,8 +87,13 @@ public class BanCommand extends LunaChatSubCommand { boolean isSpecifiedChannel = false; if (args.length >= 3) { channel = api.getChannel(args[2]); - isSpecifiedChannel = true; - } else { + isSpecifiedChannel = (channel != null); + if ( !isSpecifiedChannel && !args[2].matches("[0-9]+") ) { + sender.sendMessage(Messages.errmsgNotExist()); + return true; + } + } + if (!isSpecifiedChannel) { channel = api.getDefaultChannel(sender.getName()); } if (channel == null) { @@ -124,7 +129,7 @@ public class BanCommand extends LunaChatSubCommand { // 期限付きBANの場合、期限の指定が正しいかどうかをチェックする int expireMinutes = -1; if (args.length >= 3 && !isSpecifiedChannel) { - if ( !args[2].matches("[0-9]+") ) { + if ( !args[2].matches("[0-9]{1,5}") ) { sender.sendMessage(Messages.errmsgInvalidBanExpireParameter()); return true; } @@ -138,7 +143,7 @@ public class BanCommand extends LunaChatSubCommand { // BAN実行 channel.getBanned().add(kicked); if ( expireMinutes != -1 ) { - long expire = System.currentTimeMillis() + expireMinutes * 60 * 1000; + long expire = System.currentTimeMillis() + expireMinutes * 60L * 1000; channel.getBanExpires().put(kicked, expire); } channel.removeMember(kicked);