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);