Skip to content

Commit 2b92bf7

Browse files
committed
Minor cleanup
1 parent 1b3ae84 commit 2b92bf7

File tree

5 files changed

+10
-21
lines changed

5 files changed

+10
-21
lines changed

src/main/kotlin/com/demonwav/mcdev/platform/bukkit/inspection/BukkitListenerImplementedInspection.kt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,14 @@ class BukkitListenerImplementedInspection : BaseInspection() {
4343
@Nls
4444
override fun getName() = "Implement Listener"
4545
@Nls
46-
override fun getFamilyName() =name
46+
override fun getFamilyName() = name
4747
}
4848
}
4949

5050
override fun buildVisitor(): BaseInspectionVisitor {
5151
return object : BaseInspectionVisitor() {
5252
override fun visitClass(aClass: PsiClass) {
53-
val methods = aClass.methods
54-
var isEventHandler = false
55-
for (method in methods) {
56-
val list = method.modifierList
57-
val annotation = list.findAnnotation(BukkitConstants.HANDLER_ANNOTATION)
58-
if (annotation != null) {
59-
isEventHandler = true
60-
break
61-
}
62-
}
63-
64-
if (!isEventHandler) {
53+
if (aClass.methods.none { it.modifierList.findAnnotation(BukkitConstants.HANDLER_ANNOTATION) != null }) {
6554
return
6655
}
6756

src/main/kotlin/com/demonwav/mcdev/transition/TransitionProjectComponent.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class TransitionProjectComponent(project: Project) : AbstractProjectComponent(pr
3939
"PAPER_MODULE_TYPE",
4040
"SPONGE_MODULE_TYPE",
4141
"FORGE_MODULE_TYPE",
42-
"BUNGEECORD_MODULE_TYPE")
42+
"BUNGEECORD_MODULE_TYPE"
43+
)
4344
}
4445
}

src/test/kotlin/com/demonwav/mcdev/framework/MockJdk.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ package com.demonwav.mcdev.framework
1313
import com.intellij.openapi.Disposable
1414
import com.intellij.openapi.projectRoots.JavaSdk
1515
import com.intellij.openapi.projectRoots.Sdk
16+
import com.intellij.openapi.projectRoots.SdkAdditionalData
1617
import com.intellij.openapi.roots.OrderRootType
1718
import com.intellij.openapi.roots.RootProvider
1819
import com.intellij.openapi.util.UserDataHolderBase
@@ -37,7 +38,7 @@ class MockJdk(private val name: String, jar: VirtualFile, private val home: Virt
3738
override fun getSdkModificator() =
3839
throw IncorrectOperationException("Can't modify, MockJDK is read-only")
3940

40-
override fun getSdkAdditionalData() = null
41+
override fun getSdkAdditionalData(): SdkAdditionalData? = null
4142

4243
override fun clone() = throw CloneNotSupportedException()
4344

src/test/kotlin/com/demonwav/mcdev/framework/ProjectBuilder.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,11 @@ class ProjectBuilder(fixture: JavaCodeInsightTestFixture) {
3232

3333
private val fixture: JavaCodeInsightTestFixture
3434
get() {
35-
if (fixtureRef.get() == null) {
36-
throw Exception("Reference collected")
37-
}
38-
if (fixtureRef.get()!!.project.isDisposed) {
35+
val fix = fixtureRef.get() ?: throw Exception("Reference collected")
36+
if (fix.project.isDisposed) {
3937
throw Exception("Project disposed")
4038
}
41-
return fixtureRef.get()!!
39+
return fix
4240
}
4341
private val project
4442
get() = fixture.project

src/test/kotlin/com/demonwav/mcdev/i18n/I18nCommenterTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class I18nCommenterTest : BaseMinecraftTest(PlatformType.MCP) {
2424

2525
private fun doTest(actionId: String, @Language("I18n") before: String, @Language("I18n") after: String) {
2626
buildProject {
27-
i18n("${fileName}.lang", before, configure = true)
27+
i18n("$fileName.lang", before, configure = true)
2828
i18n("${fileName}_after.lang", after, configure = false)
2929
}
3030

0 commit comments

Comments
 (0)