Proof of concept, now to figure out how it works!

This commit is contained in:
thetrouper
2025-03-25 06:15:10 -05:00
parent 8a755bd642
commit 96c758edd0
23 changed files with 608 additions and 18 deletions

View File

@@ -0,0 +1,49 @@
plugins {
id 'java'
}
group = 'me.trouper.sentinel'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
maven {
name = "papermc-repo"
url = "https://repo.papermc.io/repository/maven-public/"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
}
dependencies {
compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")
}
def targetJavaVersion = 21
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release.set(targetJavaVersion)
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('paper-plugin.yml') {
expand props
}
}

View File

View File

@@ -0,0 +1 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip

View File

@@ -0,0 +1 @@
rootProject.name = 'SentinelPlugin'

View File

@@ -0,0 +1,25 @@
package me.trouper.sentinel.plugin;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandMap;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.defaults.BukkitCommand;
import org.bukkit.plugin.java.JavaPlugin;
public final class SentinelPlugin extends JavaPlugin {
public static void initialize(JavaPlugin loaderPlugin) {
loaderPlugin.getLogger().info("Hello from dynamically loaded Plugin!");
Bukkit.getScheduler().runTask(loaderPlugin, () -> {
PluginCommand command = Bukkit.getPluginCommand("demo");
if (command != null) {
command.setExecutor((sender, cmd, label, args) -> {
sender.sendMessage("Hello from dynamically loaded plugin!");
return true;
});
}
});
}
}