@@ -31,35 +31,22 @@ import com.intellij.psi.search.GlobalSearchScope
3131class CanaryModule <out T : AbstractModuleType <* >>(facet : MinecraftFacet , override val moduleType : T ) : AbstractModule(facet) {
3232
3333 override val type: PlatformType = moduleType.platformType
34- private var canaryInf: VirtualFile ? = null
35- private var neptuneInf: VirtualFile ? = null
36-
37- init {
38- setup()
39- }
40-
41- private fun setup () {
42- canaryInf = facet.findFile(CanaryConstants .CANARY_INF , SourceType .RESOURCE )
43- neptuneInf = facet.findFile(CanaryConstants .NEPTUNE_INF , SourceType .RESOURCE )
44- }
45-
46- fun getCanaryInf (): VirtualFile ? {
47- if (canaryInf == null ) {
48- // try and find the file again if it's not already present
49- // when this object was first created it may not have been ready
50- setup()
34+ var canaryInf: VirtualFile ? = null
35+ get() {
36+ if (field == null ) {
37+ field = facet.findFile(CanaryConstants .CANARY_INF , SourceType .RESOURCE )
38+ }
39+ return field
5140 }
52- return canaryInf
53- }
54-
55- fun getNeptuneInf (): VirtualFile ? {
56- if (neptuneInf == null ) {
57- // try and find the file again if it's not already present
58- // when this object was first created it may not have been ready
59- setup()
41+ private set
42+ var neptuneInf: VirtualFile ? = null
43+ get() {
44+ if (field == null ) {
45+ field = facet.findFile(CanaryConstants .NEPTUNE_INF , SourceType .RESOURCE )
46+ }
47+ return field
6048 }
61- return neptuneInf
62- }
49+ private set
6350
6451 override fun isEventClassValid (eventClass : PsiClass , method : PsiMethod ? ) =
6552 CanaryConstants .HOOK_CLASS == eventClass.qualifiedName
0 commit comments