Skip to content

Commit 30371f1

Browse files
committed
C# is BTEC Kotlin
1 parent 4204a2b commit 30371f1

File tree

2 files changed

+15
-28
lines changed

2 files changed

+15
-28
lines changed

src/main/kotlin/com/demonwav/mcdev/platform/canary/CanaryFileIconProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class CanaryFileIconProvider : FileIconProvider {
3131
val module = ModuleUtilCore.findModuleForFile(file, project) ?: return null
3232
val canaryModule = MinecraftFacet.getInstance(module, CanaryModuleType, NeptuneModuleType) ?: return null
3333

34-
if (file == canaryModule.getCanaryInf() || file == canaryModule.getNeptuneInf()) {
34+
if (file == canaryModule.canaryInf || file == canaryModule.neptuneInf) {
3535
return canaryModule.icon
3636
}
3737
return null

src/main/kotlin/com/demonwav/mcdev/platform/canary/CanaryModule.kt

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,35 +31,22 @@ import com.intellij.psi.search.GlobalSearchScope
3131
class 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

Comments
 (0)