期限付きBANを指定できるようにする

このコミットが含まれているのは:
routersys committed 2026-09-12 11:31:21 +09:00
1 親 e0d9748b1a
コミット 1321e30ad6
1ファイル変更
+9 -4
+9 -4
ファイルの表示
@@ -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);