diff --git a/.idea/runConfigurations/Server.xml b/.idea/runConfigurations/Server.xml
deleted file mode 100644
index 08f12e9..0000000
--- a/.idea/runConfigurations/Server.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Readme.md b/Readme.md
index 70ba768..356d67b 100644
--- a/Readme.md
+++ b/Readme.md
@@ -58,9 +58,12 @@ The template or better boilerplate comes with a lot of features that are useful
* **Delete** the `CHANGELOG.md`. It will be generated on your [first release](#releasing-a-new-version-of-your-plugin).
* **Update** the `README` to point to your project and spigot resource id.
* **Rename** the java package and plugin to match your project.
-* Then execute the `Server` run configuration and the template will run the Spigot BuildTools to download and build spigot or paper for you.
+* Then execute the `prepareSpigotPlugins` gradle task this will try to download all plugin denpendencies and puts them into `debug/spigot/plugins/`.
+* **Start** the Minecraft server by executing the `debugPaper` task. This will start the server in the background and you can connect to it using the `localhost:25565` address.
* **Code away :)** - *and once you are ready, push your commit (in [conventional commit style](#commit-message-format)) to master.*
+![Gradle tasks](docs/gradle-tasks.png)
+
Please read the [Contributing Guidelines](CONTRIBUTING.md) before submitting any pull requests or opening issues.
> **NOTE**
diff --git a/build.gradle b/build.gradle
index 3c3d73e..b710184 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,9 +5,9 @@ buildscript {
}
plugins {
- id 'com.github.johnrengelman.shadow' version '7.1.0'
- id 'kr.entree.spigradle' version '2.2.4'
- id 'io.freefair.lombok' version '6.3.0'
+ id 'com.github.johnrengelman.shadow' version '7.1.2'
+ id 'kr.entree.spigradle' version '2.4.3'
+ id 'io.freefair.lombok' version '6.6.1'
id 'java'
id 'jacoco'
id 'idea'
@@ -36,6 +36,7 @@ spigot {
load = STARTUP
// depends = ['']
softDepends = ['Vault']
+ excludeLibraries = ['*']
}
compileJava {
@@ -51,39 +52,40 @@ repositories {
mavenLocal()
mavenCentral()
spigot()
- maven { url = 'https://jitpack.io' }
+ bungeecord()
+ paper()
+ essentialsX()
+ bStats()
+ enginehub()
+ protocolLib()
maven { url = 'https://repo.aikar.co/content/groups/aikar/' }
- maven { url = 'https://repo.dmulloy2.net/repository/public/' }
- maven { url 'https://hub.spigotmc.org/nexus/content/repositories/public/' }
- maven { url = 'https://oss.sonatype.org/content/repositories/snapshots/' }
+ jitpack()
}
dependencies {
- // using spigot-api
- implementation spigot(mcVersion)
- // or using paper-api
- // implementation "io.papermc.paper:paper-api:${mcVersion}-R0.1-SNAPSHOT"
+ // using using paper-api
+ implementation paper(mcVersion)
// Add your dependencies here
// Here are some opinionated dependencies that might help you with your plugin development:
// Annotation Command Framework: https://github.com/aikar/commands
- implementation "co.aikar:acf-paper:0.5.0-SNAPSHOT"
+ // Use shadow to shade the library into your plugin
+ shadow "co.aikar:acf-paper:0.5.1-SNAPSHOT"
// Vault (https://github.com/MilkBowl/VaultAPI) for economy, permissions and chat API
- implementation "com.github.MilkBowl:VaultAPI:1.7.1"
+ // this dependency needs to be present at runtime, meaning Vault.jar needs to be in your plugins folder
+ implementation vaultAll()
// Test dependencies
- testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
- testImplementation 'org.mockito:mockito-core:4.0.0'
- testImplementation 'com.github.seeseemelk:MockBukkit-v1.17:1.7.0'
- testImplementation 'org.assertj:assertj-core:3.21.0'
+ testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
+ testImplementation 'org.mockito:mockito-core:4.11.0'
+ testImplementation 'com.github.seeseemelk:MockBukkit-v1.19:2.144.3'
+ testImplementation 'org.assertj:assertj-core:3.24.1'
}
shadowJar {
classifier = ''
- dependencies {
- include(dependency('co.aikar:acf-paper:0.5.0-SNAPSHOT'))
- }
+ configurations = [project.configurations.runtimeClasspath, project.configurations.shadow]
relocate 'co.aikar.commands', "${packageName}.acf"
relocate 'co.aikar.locales', "${packageName}.locales"
}
diff --git a/docs/gradle-tasks.png b/docs/gradle-tasks.png
new file mode 100644
index 0000000..f1179b9
Binary files /dev/null and b/docs/gradle-tasks.png differ
diff --git a/docs/img.png b/docs/img.png
new file mode 100644
index 0000000..8c78431
Binary files /dev/null and b/docs/img.png differ
diff --git a/gradle.properties b/gradle.properties
index 8ffa632..2a73004 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,6 +2,6 @@ group = net.silthus
packageName = net.silthus.template
pluginName = PluginName
author = Silthus
-mcVersion = 1.17.1
-apiVersion = 1.17
+mcVersion = 1.19.3
+apiVersion = 1.13
version = 4.5.3
diff --git a/src/main/java/net/silthus/template/TemplatePlugin.java b/src/main/java/net/silthus/template/TemplatePlugin.java
index d27793a..bd95e70 100644
--- a/src/main/java/net/silthus/template/TemplatePlugin.java
+++ b/src/main/java/net/silthus/template/TemplatePlugin.java
@@ -15,7 +15,9 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.server.ServiceRegisterEvent;
import org.bukkit.plugin.PluginDescriptionFile;
+import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.java.JavaPluginLoader;
@@ -24,7 +26,6 @@
import java.util.Locale;
import java.util.Objects;
-@PluginMain
public class TemplatePlugin extends JavaPlugin implements Listener {
@Getter
@@ -60,11 +61,26 @@ public void onPlayerJoin(PlayerJoinEvent event) {
getLogger().info("Player joined.");
}
+ @EventHandler
+ public void onServiceRegistration(ServiceRegisterEvent event) {
+ if (event.getProvider().getService() == Economy.class) {
+ setVault(new VaultProvider((Economy) event.getProvider().getProvider()));
+ getLogger().info("Vault integration enabled.");
+ }
+ }
+
private void setupVaultIntegration() {
if (Bukkit.getPluginManager().isPluginEnabled("Vault")) {
- vault = new VaultProvider(Objects.requireNonNull(getServer().getServicesManager().getRegistration(Economy.class)).getProvider());
- } else {
+ final RegisteredServiceProvider serviceProvider = getServer().getServicesManager()
+ .getRegistration(Economy.class);
+ if (serviceProvider != null) {
+ vault = new VaultProvider(Objects.requireNonNull(serviceProvider).getProvider());
+ getLogger().info("Vault integration enabled.");
+ }
+ }
+ if (vault == null) {
vault = new VaultProvider();
+ getLogger().warning("Vault integration is not yet available.");
}
}