Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/paper legacy builds #164

Merged
merged 5 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use nix
4 changes: 2 additions & 2 deletions .github/workflows/publish_to_nexus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 17
java-version: 21
- name: Build with Gradle
run: ./gradlew --build-cache build
- name: Test with Gradle
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 17
java-version: 21
- name: Build with Gradle
run: ./gradlew --build-cache build
- name: Test with Gradle
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.direnv
176 changes: 29 additions & 147 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,171 +1,53 @@
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription.Permission.Default

plugins {
id("org.cadixdev.licenser") version "0.6.1"
id("com.github.johnrengelman.shadow") version "8.1.1"
id("de.chojo.publishdata") version "1.4.0"
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
java
`maven-publish`
}

group = "de.eldoria"
version = "1.3.0"
val shadebase = "de.eldoria." + rootProject.name + ".libs."

repositories {
mavenCentral()
maven("https://eldonexus.de/repository/maven-public/")
maven("https://eldonexus.de/repository/maven-proxies/")
}
group = "de.eldoria.gridselector"
version = "1.3.1"

dependencies {
compileOnly("de.eldoria", "schematicbrushreborn-api", "2.6.0")
compileOnly("org.spigotmc", "spigot-api", "1.16.5-R0.1-SNAPSHOT")
compileOnly("com.sk89q.worldedit", "worldedit-bukkit", "7.3.0")
// PlotSquared Core API
compileOnly("com.plotsquared", "PlotSquared-Core", "6.11.1") {
exclude("com.intellectualsites.paster", "Paster")
exclude("org.apache.logging.log4j", "log4j-api")
exclude("com.intellectualsites.informative-annotations", "informative-annotations")
allprojects {
apply {
plugin<JavaPlugin>()
}
compileOnly("com.plotsquared", "PlotSquared-Bukkit", "6.11.1") { isTransitive = false } // PlotSquared Bukkit API
compileOnly("com.sk89q.worldguard", "worldguard-bukkit", "7.0.9")
compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Core:2.9.2") {
exclude("com.intellectualsites.paster")
exclude("org.yaml")
}
compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit:2.9.2") {
isTransitive = false
exclude("org.yaml")
}

testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.11.0")
testImplementation("com.sk89q.worldedit", "worldedit-bukkit", "7.3.0")
testImplementation("org.spigotmc", "spigot-api", "1.16.5-R0.1-SNAPSHOT")
testImplementation("de.eldoria", "eldo-util", "1.14.4")
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine")
}

license {
header(rootProject.file("HEADER.txt"))
include("**/*.java")
}

java {
withSourcesJar()
withJavadocJar()
sourceCompatibility = JavaVersion.VERSION_17
}

publishData {
addBuildData()
useEldoNexusRepos()
publishComponent("java")
}

publishing {
publications.create<MavenPublication>("maven") {
publishData.configurePublication(this)
}
group = rootProject.group
version = rootProject.version

repositories {
maven {
authentication {
credentials(PasswordCredentials::class) {
username = System.getenv("NEXUS_USERNAME")
password = System.getenv("NEXUS_PASSWORD")
}
}

setUrl(publishData.getRepository())
name = "EldoNexus"
}
}
}

tasks {
compileJava {
options.encoding = "UTF-8"
mavenCentral()
maven("https://eldonexus.de/repository/maven-public/")
maven("https://eldonexus.de/repository/maven-proxies/")
}

compileTestJava {
options.encoding = "UTF-8"
}

test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
withSourcesJar()
withJavadocJar()
}

shadowJar {
relocate("de.eldoria.eldoutilities", "de.eldoria.schematicbrush.libs.eldoutilities")
relocate("de.eldoria.messageblocker", "de.eldoria.schematicbrush.libs.messageblocker")
mergeServiceFiles()
archiveClassifier.set("all")
archiveBaseName.set("GridSelector")
}

processResources {
from(sourceSets.main.get().resources.srcDirs) {
filesMatching("plugin.yml") {
expand(
"version" to publishData.getVersion(true)
)
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
tasks {
compileJava {
options.encoding = "UTF-8"
}
}

register<Copy>("copyToServer") {
val path = project.property("targetDir") ?: "";
if (path.toString().isEmpty()) {
println("targetDir is not set in gradle properties")
return@register
compileTestJava {
options.encoding = "UTF-8"
}
println("Copying jar to $path")
from(shadowJar)
destinationDir = File(path.toString())
}

build {
dependsOn(shadowJar)
}
}

bukkit {
name = "GridSelector"
main = "de.eldoria.gridselector.GridSelector"
apiVersion = "1.16"
version = publishData.getVersion(true)
authors = listOf("RainbowDashLabs")
depend = listOf("SchematicBrushReborn")
softDepend = listOf("PlotSquared", "WorldGuard")

commands {
register("schematicbrushgrid") {
aliases = listOf("sbrg")
permission = "gridselector.use"
test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
}
}

permissions {
register("gridselector.export") {
default = Default.FALSE
}
register("gridselector.export.global") {
default = Default.FALSE
}
register("gridselector.cluster.create") {
default = Default.FALSE
}
register("gridselector.cluster.remove") {
default = Default.FALSE
}
register("gridselector.cluster.repair") {
default = Default.FALSE
}
}
license {
header(rootProject.file("HEADER.txt"))
include("**/*.java")
}
73 changes: 73 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription.Permission.Default.FALSE

plugins {
alias(libs.plugins.pluginyml)
alias(libs.plugins.publishdata)
}

dependencies {
compileOnly("de.eldoria", "schematicbrushreborn-api", "2.7.1")
compileOnly("org.spigotmc", "spigot-api", "1.16.5-R0.1-SNAPSHOT")
compileOnly("com.sk89q.worldedit", "worldedit-bukkit", "7.3.0")
// PlotSquared Core API
compileOnly("com.plotsquared", "PlotSquared-Core", "6.11.1") {
exclude("com.intellectualsites.paster", "Paster")
exclude("org.apache.logging.log4j", "log4j-api")
exclude("com.intellectualsites.informative-annotations", "informative-annotations")
}
compileOnly("com.plotsquared", "PlotSquared-Bukkit", "6.11.1") { isTransitive = false } // PlotSquared Bukkit API
compileOnly("com.sk89q.worldguard", "worldguard-bukkit", "7.0.9")
compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Core:2.9.2") {
exclude("com.intellectualsites.paster")
exclude("org.yaml")
}
compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit:2.9.2") {
isTransitive = false
exclude("org.yaml")
}

testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.10.2")
testImplementation("com.sk89q.worldedit", "worldedit-bukkit", "7.3.0")
testImplementation("org.spigotmc", "spigot-api", "1.16.5-R0.1-SNAPSHOT")
testImplementation("de.eldoria", "eldo-util", "1.14.4")
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine")
}

publishData {
useEldoNexusRepos()
}

bukkit {
name = "GridSelector"
main = "de.eldoria.gridselector.GridSelector"
apiVersion = "1.16"
version = publishData.getVersion(true)
authors = listOf("RainbowDashLabs")
depend = listOf("SchematicBrushReborn")
softDepend = listOf("PlotSquared", "WorldGuard")

commands {
register("schematicbrushgrid") {
aliases = listOf("sbrg")
permission = "gridselector.use"
}
}

permissions {
register("gridselector.export") {
default = FALSE
}
register("gridselector.export.global") {
default = FALSE
}
register("gridselector.cluster.create") {
default = FALSE
}
register("gridselector.cluster.remove") {
default = FALSE
}
register("gridselector.cluster.repair") {
default = FALSE
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.plotsquared.core.PlotSquared;
import de.eldoria.eldoutilities.config.template.PluginBaseConfiguration;
import de.eldoria.eldoutilities.localization.ILocalizer;
import de.eldoria.eldoutilities.localization.Localizer;
import de.eldoria.eldoutilities.messages.MessageSender;
import de.eldoria.eldoutilities.plugin.EldoPlugin;
import de.eldoria.eldoutilities.updater.lynaupdater.LynaUpdateChecker;
Expand All @@ -36,7 +37,11 @@
import de.eldoria.messageblocker.MessageBlockerAPI;
import de.eldoria.schematicbrush.SchematicBrushReborn;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPluginLoader;
import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
Expand All @@ -45,6 +50,15 @@ public class GridSelector extends EldoPlugin {

private JacksonConfiguration configuration;

public GridSelector() {
this.configuration = new JacksonConfiguration(this);
}

public GridSelector(@NotNull JavaPluginLoader loader, @NotNull PluginDescriptionFile description, @NotNull File dataFolder, @NotNull File file) {
super(loader, description, dataFolder, file);
this.configuration = new JacksonConfiguration(this);
}

@Override
public void onPluginEnable() throws Throwable {

Expand All @@ -63,13 +77,19 @@ public void onPluginEnable() throws Throwable {

var sbr = SchematicBrushReborn.instance();

var messageSender = MessageSender.create(this, "§3[GS]");
var iLocalizer = Localizer.builder(this, "en_US")
.setIncludedLocales("en_US")
.build();
ILocalizer.getPluginLocalizer(SchematicBrushReborn.class).registerChild(iLocalizer);
var messageSender = MessageSender.builder(this)
.prefix("<gold>[GS]")
.localizer(iLocalizer)
.register();

var messageBlocker = MessageBlockerAPI.builder(this).addWhitelisted("[GS]").build();

var gridSchematics = new GridSchematics(this);

var iLocalizer = ILocalizer.create(this, "en_US");
iLocalizer.setLocale("en_US");
sbr.brushSettingsRegistry().registerSelector(new GridProvider(sbr.schematics()));
sbr.schematics().register(GridSchematics.KEY, gridSchematics);

Expand Down Expand Up @@ -106,6 +126,11 @@ public Configuration configuration() {
return configuration;
}

@Override
public Level getLogLevel() {
return configuration.secondary(PluginBaseConfiguration.KEY).logLevel();
}

@Override
public List<Class<? extends ConfigurationSerializable>> getConfigSerialization() {
return List.of(GridCluster.class, Plot.class, ClusterWorld.class, ClusterWorlds.class, Highlight.class, General.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import de.eldoria.gridselector.command.grid.cluster.Repair;
import de.eldoria.gridselector.command.grid.cluster.Sessions;
import de.eldoria.gridselector.config.Configuration;
import de.eldoria.gridselector.config.LegacyConfiguration;
import de.eldoria.gridselector.util.Permissions;
import de.eldoria.messageblocker.blocker.MessageBlocker;
import org.bukkit.plugin.Plugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor;
import de.eldoria.gridselector.adapter.worldguard.IWorldGuardAdapter;
import de.eldoria.gridselector.config.Configuration;
import de.eldoria.gridselector.config.LegacyConfiguration;
import de.eldoria.gridselector.config.elements.cluster.GridCluster;
import de.eldoria.gridselector.util.Permissions;
import org.bukkit.entity.Player;
Expand Down
Loading