Skip to content

Commit

Permalink
feat: plugin.yml for plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Nov 5, 2024
1 parent b3f378e commit 12cdb5a
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ yarn_mappings=1.21.1+build.3
loader_version=0.16.7

# Mod Properties
version=2.2.0
version=2.2.1
group=net.mcbrawls.inject
id=inject
14 changes: 14 additions & 0 deletions paper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ plugins {

fun prop(name: String) = project.rootProject.property(name) as String

val isPublishing = gradle.startParameter.taskNames.any { it.contains("publish") }

group = prop("group")
version = prop("version")

Expand Down Expand Up @@ -71,6 +73,18 @@ tasks {
}
}

tasks.processResources {
inputs.property("version", project.version)

filesMatching("plugin.yml") {
if (isPublishing) {
exclude()
} else {
expand("version" to project.version)
}
}
}

runPaper {
disablePluginJarDetection()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
import net.kyori.adventure.key.Key;
import net.mcbrawls.inject.api.InjectPlatform;
import net.mcbrawls.inject.api.Injector;
import org.bukkit.plugin.java.JavaPlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

public class InjectPaper implements InjectPlatform {
public class InjectPaper extends JavaPlugin implements InjectPlatform {
private static final Logger LOGGER = LoggerFactory.getLogger("inject");
public static InjectPaper INSTANCE = new InjectPaper();
private static final List<Injector> injectors = new ArrayList<>();
Expand Down
3 changes: 3 additions & 0 deletions paper/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: Inject
main: net.mcbrawls.inject.paper.InjectPaper
version: ${version}
14 changes: 14 additions & 0 deletions spigot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ plugins {

fun prop(name: String) = project.rootProject.property(name) as String

val isPublishing = gradle.startParameter.taskNames.any { it.contains("publish") }

group = prop("group")
version = prop("version")

Expand Down Expand Up @@ -61,6 +63,18 @@ tasks {
}
}

tasks.processResources {
inputs.property("version", project.version)

filesMatching("plugin.yml") {
if (isPublishing) {
exclude()
} else {
expand("version" to project.version)
}
}
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
import net.mcbrawls.inject.api.InjectPlatform;
import net.mcbrawls.inject.api.Injector;
import net.mcbrawls.inject.spigot.interceptor.ClientConnectionInterceptor;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

public class InjectSpigot implements InjectPlatform {
public class InjectSpigot extends JavaPlugin implements InjectPlatform {
private static final Logger LOGGER = Logger.getLogger("inject");
public static InjectSpigot INSTANCE = new InjectSpigot();
private static final List<Injector> injectors = new ArrayList<>();
Expand Down Expand Up @@ -45,4 +46,4 @@ public void registerInjector(Injector injector) {
LOGGER.info("Inject initialized");
}
}
}
}
3 changes: 3 additions & 0 deletions spigot/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: Inject
main: net.mcbrawls.inject.spigot.InjectSpigot
version: ${version}

0 comments on commit 12cdb5a

Please sign in to comment.