@@ -31,35 +31,22 @@ import com.intellij.psi.search.GlobalSearchScope
31
31
class CanaryModule <out T : AbstractModuleType <* >>(facet : MinecraftFacet , override val moduleType : T ) : AbstractModule(facet) {
32
32
33
33
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
51
40
}
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
60
48
}
61
- return neptuneInf
62
- }
49
+ private set
63
50
64
51
override fun isEventClassValid (eventClass : PsiClass , method : PsiMethod ? ) =
65
52
CanaryConstants .HOOK_CLASS == eventClass.qualifiedName
0 commit comments