diff --git a/build.gradle.kts b/build.gradle.kts index 67c4df65..bc421b2e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,12 +7,24 @@ plugins { id("xyz.jpenilla.resource-factory-bukkit-convention") version "1.1.1" // Generates plugin.yml based on the Gradle config } -fun underscoreCase(string: String): String { - return string.lowercase().replace(' ', '_') +fun capitaliseFirstLetter(string: String): String { + return string.first().uppercase() + string.slice(IntRange(1, string.length - 1)) } -fun pascalCase(string: String): String { - return string.replace(" ", "") +fun underscoreCase(kebabCaseString: String): String { + return kebabCaseString.lowercase().replace('-', '_') +} + +fun pascalCase(kebabCaseString: String): String { + var pascalCaseString = "" + + val splitString = kebabCaseString.split("-") + + for (part in splitString) { + pascalCaseString += capitaliseFirstLetter(part) + } + + return pascalCaseString } val author = "Slqmy" diff --git a/settings.gradle.kts b/settings.gradle.kts index 26fa97b0..8d192e30 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,4 +2,4 @@ plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" } -rootProject.name = "Template Paper Plugin" +rootProject.name = "template-paper-plugin"