Skip to content

Commit 6de2db1

Browse files
committed
Fix some stuff, hopefully fixes #330
1 parent 822607e commit 6de2db1

File tree

6 files changed

+10
-15
lines changed

6 files changed

+10
-15
lines changed

src/main/kotlin/com/demonwav/mcdev/facet/MinecraftFacet.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ class MinecraftFacet(module: Module, name: String, configuration: MinecraftFacet
184184

185185
val icon: Icon?
186186
get() {
187-
val iconCount = moduleMap.keys.count { it.hasIcon() }
187+
val iconCount = moduleMap.keys.count { it.hasIcon }
188188
return when {
189189
iconCount == 0 -> null
190-
iconCount == 1 -> moduleMap.keys.firstOrNull { it.hasIcon() }?.icon
190+
iconCount == 1 -> moduleMap.keys.firstOrNull { it.hasIcon }?.icon
191191
iconCount == 2 && moduleMap.containsAllKeys(SpongeModuleType, ForgeModuleType) -> PlatformAssets.SPONGE_FORGE_ICON
192192
moduleMap.size > 0 -> PlatformAssets.MINECRAFT_ICON
193193
else -> null

src/main/kotlin/com/demonwav/mcdev/platform/AbstractModuleType.kt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,18 @@ abstract class AbstractModuleType<out T : AbstractModule>(val groupId: String, v
3030

3131
val colorMap = LinkedHashMap<String, Color>()
3232

33-
@get:Contract(pure = true)
3433
abstract val platformType: PlatformType
3534

36-
@get:Contract(pure = true)
3735
abstract val icon: Icon?
3836

39-
@Contract(pure = true)
40-
open fun hasIcon() = true
37+
open val hasIcon = true
4138

42-
@get:Contract(pure = true)
4339
abstract val id: String
4440

45-
@get:Contract(pure = true)
4641
abstract val ignoredAnnotations: List<String>
4742

48-
@get:Contract(pure = true)
4943
abstract val listenerAnnotations: List<String>
5044

51-
@get:Contract(pure = true)
5245
val classToColorMappings: Map<String, Color>
5346
get() = this.colorMap
5447

src/main/kotlin/com/demonwav/mcdev/platform/BaseTemplate.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import java.util.Properties
2222

2323
object BaseTemplate {
2424

25+
private val NEW_LINE = "\\n+".toRegex()
26+
2527
fun applyBuildGradleTemplate(project: Project,
2628
file: VirtualFile,
2729
groupId: String,
@@ -112,7 +114,7 @@ object BaseTemplate {
112114

113115
var text = template.getText(allProperties)
114116
if (trimNewlines) {
115-
text = text.replace("\\n+".toRegex(), "\n")
117+
text = text.replace(NEW_LINE, "\n")
116118
}
117119
VfsUtil.saveText(file, text)
118120

src/main/kotlin/com/demonwav/mcdev/platform/forge/ForgeTemplate.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ object ForgeTemplate {
104104
properties.setProperty("URL", url)
105105
properties.setProperty("UPDATE_URL", updateUrl)
106106

107-
if (authorList != null) {
107+
if (!authorList.isNullOrBlank()) {
108108
properties.setProperty("HAS_AUTHOR_LIST", "true")
109109
properties.setProperty("AUTHOR_LIST", authorList)
110110
}
111111

112-
if (dependenciesList != null) {
112+
if (!dependenciesList.isNullOrBlank()) {
113113
properties.setProperty("HAS_DEPENDENCIES_LIST", "true")
114114
properties.setProperty("DEPENDENCIES_LIST", dependenciesList)
115115
}

src/main/kotlin/com/demonwav/mcdev/platform/mcp/McpModuleType.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ object McpModuleType : AbstractModuleType<McpModule>("", "") {
2929
override val id = ID
3030
override val ignoredAnnotations = emptyList<String>()
3131
override val listenerAnnotations = emptyList<String>()
32+
override val hasIcon = false
3233

3334
override fun generateModule(facet: MinecraftFacet) = McpModule(facet)
34-
override fun hasIcon() = false
3535
}

src/main/kotlin/com/demonwav/mcdev/platform/mixin/MixinModuleType.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object MixinModuleType : AbstractModuleType<MixinModule>("org.spongepowered", "m
2323
override val id = ID
2424
override val ignoredAnnotations = emptyList<String>()
2525
override val listenerAnnotations = emptyList<String>()
26+
override val hasIcon = false
2627

27-
override fun hasIcon() = false
2828
override fun generateModule(facet: MinecraftFacet) = MixinModule(facet)
2929
}

0 commit comments

Comments
 (0)