Proof of concept, now to figure out how it works!
This commit is contained in:
49
SentinelPlugin/build.gradle
Normal file
49
SentinelPlugin/build.gradle
Normal 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
|
||||
}
|
||||
}
|
||||
0
SentinelPlugin/gradle.properties
Normal file
0
SentinelPlugin/gradle.properties
Normal file
1
SentinelPlugin/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
1
SentinelPlugin/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1 @@
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
1
SentinelPlugin/settings.gradle
Normal file
1
SentinelPlugin/settings.gradle
Normal file
@@ -0,0 +1 @@
|
||||
rootProject.name = 'SentinelPlugin'
|
||||
@@ -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;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user