Update example module to make it better suited as a templaet

This commit is contained in:
Telesphoreo 2022-04-01 00:14:49 -05:00
parent e3d4fa6102
commit 538c9d3230
8 changed files with 73 additions and 52 deletions

View File

@ -1,49 +0,0 @@
plugins {
id "java"
id "maven-publish"
}
repositories {
maven {
url = uri("https://papermc.io/repo/repository/maven-public/")
}
maven {
url = uri("https://nexus.telesphoreo.me/repository/plex")
}
mavenCentral()
}
dependencies {
compileOnly "org.projectlombok:lombok:1.18.22"
annotationProcessor "org.projectlombok:lombok:1.18.22"
compileOnly "io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT"
compileOnly 'dev.plex:Plex:0.8'
}
group = "dev.plex"
version = "1.0"
description = "ExampleModule"
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
tasks {
javadoc {
options.memberLevel = JavadocMemberLevel.PRIVATE
}
}

50
build.gradle.kts Normal file
View File

@ -0,0 +1,50 @@
plugins {
java
`maven-publish`
}
repositories {
maven {
url = uri("https://papermc.io/repo/repository/maven-public/")
}
maven {
url = uri("https://nexus.telesphoreo.me/repository/plex/")
}
mavenCentral()
}
dependencies {
compileOnly("org.projectlombok:lombok:1.18.22")
annotationProcessor("org.projectlombok:lombok:1.18.22")
compileOnly("io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT")
compileOnly("dev.plex:Plex:0.9")
}
group = "dev.plex"
version = "1.0"
description = "ExampleModule"
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}
tasks.getByName<Jar>("jar") {
archiveBaseName.set("Plex-ExampleModule")
archiveVersion.set("")
}
tasks {
javadoc {
options.memberLevel = JavadocMemberLevel.PRIVATE
}
}

Binary file not shown.

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -1,2 +0,0 @@
rootProject.name = 'plexmodule-template'

2
settings.gradle.kts Normal file
View File

@ -0,0 +1,2 @@
rootProject.name = "plexmodule-template"

View File

@ -1,6 +1,7 @@
package dev.plex;
import dev.plex.command.ExampleCommand;
import dev.plex.listener.ExampleListener;
import dev.plex.module.PlexModule;
public class ExampleModule extends PlexModule
@ -9,10 +10,12 @@ public class ExampleModule extends PlexModule
public void enable()
{
registerCommand(new ExampleCommand());
registerListener(new ExampleListener());
}
@Override
public void disable()
{
// Unregistering listeners / commands is handled by Plex
}
}

View File

@ -0,0 +1,17 @@
package dev.plex.listener;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
public class ExampleListener extends PlexListener
{
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
player.sendMessage(Component.text("This is a message from Plex's example module!").color(NamedTextColor.GOLD));
}
}