Skip to content

Forge only wants lowercased MODIDs, let's sanity check that! #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

package com.demonwav.mcdev.creator

import com.demonwav.mcdev.exception.MinecraftSetupException
import com.demonwav.mcdev.asset.PlatformAssets
import com.demonwav.mcdev.platform.PlatformType
import com.demonwav.mcdev.platform.forge.ForgeProjectConfiguration
Expand All @@ -32,6 +33,10 @@ import javax.swing.JPanel
import javax.swing.JProgressBar
import javax.swing.JTextField
import javax.swing.SwingWorker
import com.intellij.openapi.ui.MessageType
import com.intellij.openapi.ui.popup.Balloon
import com.intellij.openapi.ui.popup.JBPopupFactory
import com.intellij.ui.awt.RelativePoint

class ForgeProjectSettingsWizard(private val creator: MinecraftProjectCreator) : MinecraftModuleWizardStep() {

Expand Down Expand Up @@ -89,7 +94,7 @@ class ForgeProjectSettingsWizard(private val creator: MinecraftProjectCreator) :
return null
}

pluginNameField.text = WordUtils.capitalize(creator.artifactId)
pluginNameField.text = creator.artifactId.toLowerCase()
pluginVersionField.text = creator.version

if (settings != null && !settings!!.isFirst) {
Expand Down Expand Up @@ -162,7 +167,21 @@ class ForgeProjectSettingsWizard(private val creator: MinecraftProjectCreator) :
}

override fun validate(): Boolean {
return validate(pluginNameField, pluginVersionField, mainClassField, authorsField, dependField, MinecraftModuleWizardStep.pattern) && !loadingBar.isVisible
if (validate(pluginNameField, pluginVersionField, mainClassField, authorsField, dependField, MinecraftModuleWizardStep.pattern) && !loadingBar.isVisible) {
try {
if (pluginNameField.text.toLowerCase() != pluginNameField.text) {
throw MinecraftSetupException("Forge modids need to be lowercase only", pluginNameField)
}
} catch (e: MinecraftSetupException) {
val message = e.error
JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, MessageType.ERROR, null)
.setFadeoutTime(4000)
.createBalloon()
.show(RelativePoint.getSouthWestOf(e.j), Balloon.Position.below)
return false
}
}
return true
}

override fun isStepVisible(): Boolean {
Expand Down