File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
src/main/kotlin/com/demonwav/mcdev/creator Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -38,23 +38,27 @@ abstract class MinecraftModuleWizardStep : ModuleWizardStep() {
3838 throw EmptyInputSetupException (pluginVersionField)
3939 }
4040
41- if (mainClassField.text.trim { it <= ' ' }.isEmpty()) { // empty
41+ // empty
42+ if (mainClassField.text.trim { it <= ' ' }.isEmpty()) {
4243 throw EmptyInputSetupException (mainClassField)
4344 }
44- if (! mainClassField.text.contains(' .' )) { // default package
45+ // default package
46+ if (! mainClassField.text.contains(' .' )) {
4547 throw InvalidMainClassNameException (mainClassField)
4648 }
47- if (mainClassField.text.contains(" \\ s+" .toRegex())) { // whitespace
49+ // crazy dots
50+ if (mainClassField.text.split(' .' ).any { it.isEmpty() } ||
51+ mainClassField.text.first() == ' .' || mainClassField.text.last() == ' .' ) {
4852 throw InvalidMainClassNameException (mainClassField)
4953 }
50- if (mainClassField.text.first().isJavaIdentifierStart() && // invalid character
51- mainClassField.text.asSequence().drop(1 ).all { it.isJavaIdentifierPart() }) {
54+ // invalid character
55+ if (mainClassField.text.split(' .' ).any {
56+ ! it.first().isJavaIdentifierStart() || ! it.asSequence().drop(1 ).all { it.isJavaIdentifierPart() }
57+ }) {
5258 throw InvalidMainClassNameException (mainClassField)
5359 }
54- if (mainClassField.text.first() == ' .' ) { // idk why this doesn't fail in the above check, but w/e
55- throw InvalidMainClassNameException (mainClassField)
56- }
57- if (mainClassField.text.split(' .' ).any { keywords.contains(it) }) { // keyword identifier
60+ // keyword identifier
61+ if (mainClassField.text.split(' .' ).any { keywords.contains(it) }) {
5862 throw InvalidMainClassNameException (mainClassField)
5963 }
6064
You can’t perform that action at this time.
0 commit comments