From dfc9957c243d4a556dccddaf29cded0dad2ad83c Mon Sep 17 00:00:00 2001 From: Him188 Date: Sun, 29 Nov 2020 19:26:05 +0800 Subject: [PATCH] Revert "Check Command.owner, #216" This reverts commit 595c9480 --- .../mirai-console/src/command/AbstractCommand.kt | 2 -- backend/mirai-console/src/command/Command.kt | 14 -------------- 2 files changed, 16 deletions(-) diff --git a/backend/mirai-console/src/command/AbstractCommand.kt b/backend/mirai-console/src/command/AbstractCommand.kt index bb5163bc9..c9048e221 100644 --- a/backend/mirai-console/src/command/AbstractCommand.kt +++ b/backend/mirai-console/src/command/AbstractCommand.kt @@ -37,8 +37,6 @@ public abstract class AbstractCommand init { Command.checkCommandName(primaryName) - @Suppress("LeakingThis") - Command.checkCommandOwner(this) secondaryNames.forEach(Command.Companion::checkCommandName) } diff --git a/backend/mirai-console/src/command/Command.kt b/backend/mirai-console/src/command/Command.kt index 532e9b048..675481731 100644 --- a/backend/mirai-console/src/command/Command.kt +++ b/backend/mirai-console/src/command/Command.kt @@ -117,19 +117,5 @@ public interface Command { name.contains('.') -> throw IllegalArgumentException("'.' is forbidden in command name.") } } - - /** - * 检查指令 [owner] 的合法性, 在非法时抛出 [IllegalArgumentException] - */ - @JvmStatic - @Throws(IllegalArgumentException::class) - public fun checkCommandOwner(command: Command) { - val owner = command.owner - if (owner is ConsoleCommandOwner) { - if (command.javaClass.enclosingClass != BuiltInCommands::class.java) { - throw IllegalArgumentException("ConsoleCommandOwner is not allowed") - } - } - } } }