Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion bukkit/paper.mcdev.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
"destination": "gradle/wrapper/gradle-wrapper.properties",
"condition": "$BUILD_SYSTEM=='Gradle'",
"properties": {
"GRADLE_VERSION": "9.3.0"
"GRADLE_VERSION": "9.4.0"
}
},
{
Expand Down
2 changes: 2 additions & 0 deletions messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ creator.ui.gradle_plugins.label=Gradle Plugins
creator.ui.use_datagen.label=Use Datagen:
creator.ui.use_paper_manifest.label=Use Paper Manifest:
creator.ui.use_paper_manifest.warning=Paper plugins are <a href='https://docs.papermc.io/paper/dev/getting-started/paper-plugins'>still experimental</a>, their usage is discouraged for general purpose development.
creator.ui.use_annotation_processor.label=Use velocity-plugin.json annotation processor:
creator.ui.use_build_constants_templating.label=Enable source templating for constants:

creator.ui.language.label=Language:

Expand Down
151 changes: 132 additions & 19 deletions velocity/.mcdev.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@
"Maven"
]
},
{
"name": "USE_VERSION_CATALOG",
"type": "boolean",
"default": false,
"visible": {
"dependsOn": [
"BUILD_SYSTEM"
],
"condition": "$BUILD_SYSTEM == 'Gradle'"
}
},
{
"name": "LANGUAGE",
"type": "string",
Expand All @@ -28,6 +39,7 @@
"type": "semantic_version",
"forceDropdown": true,
"options": [
"3.5.0-SNAPSHOT",
"3.4.0-SNAPSHOT",
"3.3.0-SNAPSHOT",
"3.2.0-SNAPSHOT",
Expand All @@ -46,10 +58,22 @@
"sourceUrl": "https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/maven-metadata.xml"
},
"visible": {
"dependsOn": ["LANGUAGE"],
"dependsOn": [
"LANGUAGE"
],
"condition": "$LANGUAGE == 'Kotlin'"
}
},
{
"name": "USE_ANNOTATION_PROCESSOR",
"type": "boolean",
"default": false
},
{
"name": "USE_BUILD_CONSTANTS_TEMPLATING",
"type": "boolean",
"default": "USE_ANNOTATION_PROCESSOR"
},
{
"name": "PLUGIN_NAME",
"type": "string",
Expand All @@ -60,7 +84,9 @@
"type": "string",
"validator": "[a-z][a-z0-9-_]{1,63}",
"derives": {
"parents": ["PROJECT_NAME"],
"parents": [
"PROJECT_NAME"
],
"method": "replace",
"parameters": {
"regex": "[^a-z0-9-_]+",
Expand All @@ -74,7 +100,10 @@
"name": "MAIN_CLASS",
"type": "class_fqn",
"derives": {
"parents": ["BUILD_COORDS", "PLUGIN_NAME"],
"parents": [
"BUILD_COORDS",
"PLUGIN_NAME"
],
"method": "suggestClassName"
}
},
Expand Down Expand Up @@ -102,16 +131,81 @@
}
]
},
{
"label": "creator.ui.gradle_plugins.label",
"collapsible": true,
"order": 2,
"visible": {
"dependsOn": [
"BUILD_SYSTEM"
],
"condition": "$BUILD_SYSTEM == 'Gradle'"
},
"groupProperties": [
{
"name": "RUN_VELOCITY_PLUGIN",
"type": "gradle_plugin",
"default": true,
"parameters": {
"sourceUrl": "https://plugins.gradle.org/m2/xyz/jpenilla/run-velocity/xyz.jpenilla.run-velocity.gradle.plugin/maven-metadata.xml"
}
},
{
"name": "SHADOW_PLUGIN",
"type": "gradle_plugin",
"default": "$LANGUAGE=='Kotlin'",
"parameters": {
"sourceUrl": "https://repo.maven.apache.org/maven2/com/gradleup/shadow/shadow-gradle-plugin/maven-metadata.xml"
},
"forceValue": {
"dependsOn": [
"LANGUAGE"
],
"condition": "$LANGUAGE == 'Kotlin'",
"value": "true"
}
},
{
"name": "RESOURCE_FACTORY_PLUGIN",
"type": "gradle_plugin",
"default": false,
"parameters": {
"sourceUrl": "https://plugins.gradle.org/m2/xyz/jpenilla/resource-factory/maven-metadata.xml"
},
"forceValue": {
"dependsOn": [
"USE_ANNOTATION_PROCESSOR"
],
"condition": "$USE_ANNOTATION_PROCESSOR",
"value": "false"
}
},
{
"name": "IDEA_EXT_PLUGIN",
"type": "gradle_plugin",
"parameters": {
"sourceUrl": "https://plugins.gradle.org/m2/org/jetbrains/gradle/plugin/idea-ext/org.jetbrains.gradle.plugin.idea-ext.gradle.plugin/maven-metadata.xml"
},
"visible": false
}
]
},
{
"name": "JAVA_VERSION",
"type": "integer",
"order": 20,
"default": 17,
"visible": false,
"derives": {
"parents": ["VELOCITY_VERSION"],
"parents": [
"VELOCITY_VERSION"
],
"default": 8,
"select": [
{
"condition": "$VELOCITY_VERSION.compareTo($semver.release(3, 5)) >= 0",
"value": 21
},
{
"condition": "$VELOCITY_VERSION.compareTo($semver.release(3, 3)) >= 0",
"value": 17
Expand All @@ -137,40 +231,48 @@
"condition": "$USE_GIT"
},
{
"template": "build.gradle.ft",
"destination": "build.gradle",
"condition": "$BUILD_SYSTEM=='Gradle' && $LANGUAGE=='Java'"
"template": "../.gitattributes.ft",
"destination": ".gitattributes",
"condition": "$USE_GIT"
},
{
"template": "settings.gradle.ft",
"destination": "settings.gradle",
"condition": "$BUILD_SYSTEM=='Gradle' && $LANGUAGE=='Java'"
"template": "../gradle-wrapper.properties.ft",
"destination": "gradle/wrapper/gradle-wrapper.properties",
"condition": "$BUILD_SYSTEM=='Gradle'",
"properties": {
"GRADLE_VERSION": "9.4.0"
}
},
{
"template": "build.gradle.kts.ft",
"destination": "build.gradle.kts",
"condition": "$BUILD_SYSTEM=='Gradle' && $LANGUAGE=='Kotlin'"
"condition": "$BUILD_SYSTEM=='Gradle'"
},
{
"template": "libs.versions.toml.ft",
"destination": "gradle/libs.versions.toml",
"condition": "$BUILD_SYSTEM=='Gradle' && $USE_VERSION_CATALOG"
},
{
"template": "settings.gradle.kts.ft",
"destination": "settings.gradle.kts",
"condition": "$BUILD_SYSTEM=='Gradle' && $LANGUAGE=='Kotlin'"
"condition": "$BUILD_SYSTEM=='Gradle'"
},
{
"template": "gradle.properties.ft",
"destination": "gradle.properties",
"condition": "$BUILD_SYSTEM=='Gradle'"
},
{
"template": "../gradle-wrapper.properties.ft",
"destination": "gradle/wrapper/gradle-wrapper.properties",
"condition": "$BUILD_SYSTEM=='Gradle'"
},
{
"template": "pom.xml.ft",
"destination": "pom.xml",
"condition": "$BUILD_SYSTEM=='Maven'"
},
{
"template": "velocity-plugin.json.ft",
"destination": "src/main/resources/velocity-plugin.json",
"condition": "!$USE_ANNOTATION_PROCESSOR && !$RESOURCE_FACTORY_PLUGIN.enabled"
},
{
"template": "MainClass.java.ft",
"destination": "src/main/java/${MAIN_CLASS.path}.java",
Expand All @@ -186,13 +288,15 @@
{
"template": "BuildConstants.java.ft",
"destination": "src/main/templates/${MAIN_CLASS.packagePath}/BuildConstants.java",
"condition": "$BUILD_SYSTEM=='Gradle'"
"condition": "$USE_BUILD_CONSTANTS_TEMPLATING"
}
],
"finalizers": [
{
"type": "run_gradle_tasks",
"tasks": ["wrapper"],
"tasks": [
"wrapper --gradle-version=latest"
],
"condition": "$BUILD_SYSTEM=='Gradle'"
},
{
Expand All @@ -207,6 +311,15 @@
"name": "Build",
"condition": "$BUILD_SYSTEM=='Gradle'"
},
{
"type": "add_gradle_run",
"tasks": [
"runVelocity"
],
"name": "Run",
"select": true,
"condition": "$RUN_VELOCITY_PLUGIN.enabled && $BUILD_SYSTEM=='Gradle'"
},
{
"type": "import_maven_project",
"condition": "$BUILD_SYSTEM=='Maven'"
Expand Down
3 changes: 1 addition & 2 deletions velocity/BuildConstants.java.ft
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ${MAIN_CLASS.packageName};

// The constants are replaced before compilation
// These constants are replaced before compilation
public class BuildConstants {

public static final String VERSION = "${version}";
}
7 changes: 6 additions & 1 deletion velocity/MainClass.java.ft
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ package ${MAIN_CLASS.packageName};
import com.google.inject.Inject;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.event.Subscribe;
#if ($USE_ANNOTATION_PROCESSOR)
import com.velocitypowered.api.plugin.Plugin;
#end
import org.slf4j.Logger;

#if ($USE_ANNOTATION_PROCESSOR)
@Plugin(
id = "${PLUGIN_ID}",
name = "${PLUGIN_NAME}",
#if ($BUILD_SYSTEM == 'Gradle')
version = BuildConstants.VERSION
version = #if ($USE_BUILD_CONSTANTS_TEMPLATING) BuildConstants.VERSION #else "$VERSION" #end
#elseif ($BUILD_SYSTEM == 'Maven')
version = "${BUILD_COORDS.version}"
#end
Expand All @@ -24,11 +27,13 @@ import org.slf4j.Logger;
,authors = {${AUTHORS.toString('", "', '"', '"')}}
#end
)
#end
public class ${MAIN_CLASS.className} {

@Inject private Logger logger;

@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
// Plugin initialization logic goes here
}
}
4 changes: 4 additions & 0 deletions velocity/MainClass.kt.ft
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ package ${MAIN_CLASS.packageName};
import com.google.inject.Inject
import com.velocitypowered.api.event.Subscribe
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent
#if ($USE_ANNOTATION_PROCESSOR)
import com.velocitypowered.api.plugin.Plugin
#end
import org.slf4j.Logger

#if ($USE_ANNOTATION_PROCESSOR)
@Plugin(
id = "${PLUGIN_ID}",
name = "${PLUGIN_NAME}",
Expand All @@ -24,6 +27,7 @@ import org.slf4j.Logger
,authors = [${AUTHORS.toString('", "', '"', '"')}]
#end
)
#end
class ${MAIN_CLASS.className} @Inject constructor(val logger: Logger) {

@Subscribe
Expand Down
59 changes: 0 additions & 59 deletions velocity/build.gradle.ft

This file was deleted.

Loading