DoNothingPoint.kt 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright 2019-2021 Mamoe Technologies and contributors.
  3. *
  4. * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
  5. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
  6. *
  7. * https://github.com/mamoe/mirai/blob/dev/LICENSE
  8. */
  9. package net.mamoe.console.integrationtest.testpoints
  10. import net.mamoe.console.integrationtest.AbstractTestPointAsPlugin
  11. import net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription
  12. import net.mamoe.mirai.console.plugin.jvm.KotlinPlugin
  13. import net.mamoe.mirai.utils.info
  14. /*
  15. DoNothingPoint: Example
  16. */
  17. internal object DoNothingPoint : AbstractTestPointAsPlugin() {
  18. var enableCalled = false
  19. override fun newPluginDescription(): JvmPluginDescription {
  20. return JvmPluginDescription(
  21. id = "net.mamoe.testpoint.do-nothing",
  22. version = "1.1.0",
  23. name = "DoNothing",
  24. )
  25. }
  26. override fun KotlinPlugin.onEnable0() {
  27. logger.info { "DoNothing.onEnable() called" }
  28. enableCalled = true
  29. }
  30. override fun KotlinPlugin.onDisable0() {
  31. logger.info { "DoNothing.onDisable() called" }
  32. }
  33. override fun onConsoleStartSuccessfully() {
  34. assert(enableCalled) {
  35. "DoNothing.onEnable() not called."
  36. }
  37. }
  38. }