File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
src/main/kotlin/com/demonwav/mcdev/platform/forge Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -69,12 +69,20 @@ class ForgeModule internal constructor(facet: MinecraftFacet) : AbstractModule(f
6969 val annotation = method.modifierList.findAnnotation(ForgeConstants .EVENT_HANDLER_ANNOTATION )
7070
7171 if (annotation != null ) {
72- return " Parameter is not a subclass of net.minecraftforge.fml.common.event.FMLEvent \n " +
73- " Compiling and running this listener may result in a runtime exception "
72+ return formatWrongEventMessage( ForgeConstants . FML_EVENT , ForgeConstants . SUBSCRIBE_EVENT_ANNOTATION ,
73+ ForgeConstants . EVENT == eventClass.qualifiedName)
7474 }
7575
76- return " Parameter is not a subclass of net.minecraftforge.fml.common.eventhandler.Event\n " +
77- " Compiling and running this listener may result in a runtime exception"
76+ return formatWrongEventMessage(ForgeConstants .EVENT , ForgeConstants .EVENT_HANDLER_ANNOTATION ,
77+ ForgeConstants .FML_EVENT == eventClass.qualifiedName)
78+ }
79+
80+ private fun formatWrongEventMessage (expected : String , suggested : String , wrong : Boolean ): String {
81+ val base = " Parameter is not a subclass of $expected \n "
82+ if (wrong) {
83+ return base + " This method should be annotated with $suggested "
84+ }
85+ return base + " Compiling and running this listener may result in a runtime exception"
7886 }
7987
8088 override fun isStaticListenerSupported (method : PsiMethod ) = true
You can’t perform that action at this time.
0 commit comments