Skip to content

Commit

Permalink
Release 1.1.0 (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbowdashlabs authored Apr 7, 2023
2 parents 0f454f7 + 2e03fa4 commit 48f02a3
Show file tree
Hide file tree
Showing 16 changed files with 154 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish_to_nexus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3.3.0
- uses: actions/checkout@v3.5.0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3.3.0
- uses: actions/checkout@v3.5.0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
Expand Down
24 changes: 11 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
import de.chojo.Repo

plugins {
id("com.diffplug.spotless") version "6.15.0"
id("com.github.johnrengelman.shadow") version "7.1.2"
id("de.chojo.publishdata") version "1.0.9"
id("com.diffplug.spotless") version "6.18.0"
id("com.github.johnrengelman.shadow") version "8.1.1"
id("de.chojo.publishdata") version "1.2.4"
id("net.minecrell.plugin-yml.bukkit") version "0.5.3"
java
`maven-publish`
}

group = "de.eldoria"
version = "1.0.1"
version = "1.1.0"

repositories {
maven("https://eldonexus.de/repository/maven-public/")
maven("https://eldonexus.de/repository/maven-proxies/")
}

dependencies {
compileOnly("de.eldoria", "schematicbrushreborn-api", "2.4.1")
compileOnly("de.eldoria", "schematicbrushreborn-api", "2.5.0")
compileOnly("org.spigotmc", "spigot-api", "1.14.4-R0.1-SNAPSHOT")
compileOnly("com.sk89q.worldedit", "worldedit-bukkit", "7.2.13")
compileOnly("com.sk89q.worldedit", "worldedit-bukkit", "7.2.14")

testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2")
}

spotless{
java{
spotless {
java {
licenseHeaderFile(rootProject.file("HEADER.txt"))
target("**/*.java")
}
Expand All @@ -40,9 +40,8 @@ java {
}

publishData {
addRepo(Repo.main("", "https://eldonexus.de/repository/maven-releases/", false))
addRepo(Repo.dev("DEV", "https://eldonexus.de/repository/maven-dev/", true))
addRepo(Repo.snapshot("SNAPSHOT", "https://eldonexus.de/repository/maven-snapshots/", true))
addBuildData()
useEldoNexusRepos()
publishComponent("java")
}

Expand Down Expand Up @@ -85,7 +84,6 @@ tasks {
shadowJar {
relocate("de.eldoria.eldoutilities", "de.eldoria.schematicbrush.libs.eldoutilities")
relocate("de.eldoria.messageblocker", "de.eldoria.schematicbrush.libs.messageblocker")
relocate("net.kyori", "de.eldoria.schematicbrush.libs.kyori")
archiveBaseName.set("SchematicTools")
mergeServiceFiles()
}
Expand All @@ -109,7 +107,7 @@ tasks {
bukkit {
name = "SchematicTools"
main = "de.eldoria.schematictools.SchematicTools"
apiVersion = "1.14"
apiVersion = "1.16"
authors = listOf("RainbowDashLabs")
depend = listOf("SchematicBrushReborn")

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
24 changes: 22 additions & 2 deletions src/main/java/de/eldoria/schematictools/SchematicTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
*/
package de.eldoria.schematictools;

import de.eldoria.eldoutilities.config.template.PluginBaseConfiguration;
import de.eldoria.eldoutilities.localization.ILocalizer;
import de.eldoria.eldoutilities.messages.MessageSender;
import de.eldoria.eldoutilities.plugin.EldoPlugin;
import de.eldoria.eldoutilities.updater.lynaupdater.LynaUpdateChecker;
import de.eldoria.eldoutilities.updater.lynaupdater.LynaUpdateData;
import de.eldoria.messageblocker.MessageBlockerAPI;
import de.eldoria.schematicbrush.SchematicBrushReborn;
import de.eldoria.schematictools.commands.BaseCommand;
import de.eldoria.schematictools.configuration.Configuration;
import de.eldoria.schematictools.configuration.JacksonConfiguration;
import de.eldoria.schematictools.configuration.LegacyConfiguration;
import de.eldoria.schematictools.configuration.elements.Tool;
import de.eldoria.schematictools.configuration.elements.ToolRemoval;
import de.eldoria.schematictools.configuration.elements.Tools;
Expand All @@ -20,17 +25,32 @@
import org.bukkit.configuration.serialization.ConfigurationSerializable;

import java.util.List;
import java.util.logging.Level;

public class SchematicTools extends EldoPlugin {
private Configuration configuration;
private JacksonConfiguration configuration;

@Override
public void onPluginEnable() throws Throwable {
var sbr = SchematicBrushReborn.instance();
var messageSender = MessageSender.create(this, "§6[ST]");
var messageBlocker = MessageBlockerAPI.builder(this).addWhitelisted("[ST]").build();
ILocalizer.create(this, "en_US").setLocale("en_US");
configuration = new Configuration(this);
configuration = new JacksonConfiguration(this);
PluginBaseConfiguration base = configuration.secondary(PluginBaseConfiguration.KEY);
if (base.version() == 0) {
var legacyConfiguration = new LegacyConfiguration(this);
getLogger().log(Level.INFO, "Migrating configuration to jackson.");
configuration.main().toolRemoval(legacyConfiguration.toolRemoval());
configuration.replace(JacksonConfiguration.TOOLS, legacyConfiguration.tools());
base.version(1);
base.lastInstalledVersion(this);
configuration.save();
}

if (configuration.main().updateCheck()) {
LynaUpdateChecker.lyna(LynaUpdateData.builder(this, 6).build()).start();
}

registerCommand(new BaseCommand(this, sbr, configuration, messageBlocker));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import de.eldoria.schematicbrush.SchematicBrushReborn;
import de.eldoria.schematictools.commands.schematictools.util.BrushLoader;
import de.eldoria.schematictools.configuration.Configuration;
import de.eldoria.schematictools.configuration.elements.SchematicToolBuilder;
import de.eldoria.schematictools.configuration.builder.SchematicToolBuilder;
import de.eldoria.schematictools.util.Permissions;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static BrushContainer getContainer(Player player, Storage storage, String
var brushContainer = storage.brushes().containerByName(player, name);

UUID owner = null;
if (!brushContainer.isGlobalcontainer() && args.flags().hasValue("o")) {
if (!brushContainer.isGlobalContainer() && args.flags().hasValue("o")) {
var ownerArg = args.flags().get("o");
var optOwner = playerByName(ownerArg.asString()).map(OfflinePlayer::getUniqueId).or(() -> getAsUUID(ownerArg.asString()));
CommandAssertions.isTrue(optOwner.isPresent(), "Could not determine owner.");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
*
* Copyright (C) EldoriaRPG Team and Contributor
*/
package de.eldoria.schematictools.configuration;

import de.eldoria.schematictools.configuration.elements.ToolRemoval;

@SuppressWarnings("FieldMayBeFinal")
public class ConfigFile {
private boolean updateCheck = true;
private ToolRemoval toolRemoval = new ToolRemoval();

public ToolRemoval toolRemoval() {
return toolRemoval;
}

public void toolRemoval(ToolRemoval toolRemoval) {
this.toolRemoval = toolRemoval;
}

public boolean updateCheck() {
return updateCheck;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,13 @@
package de.eldoria.schematictools.configuration;

import de.eldoria.eldoutilities.configuration.EldoConfig;
import de.eldoria.eldoutilities.utils.Consumers;
import de.eldoria.schematictools.configuration.elements.ToolRemoval;
import de.eldoria.schematictools.configuration.elements.Tools;
import org.bukkit.plugin.Plugin;

public class Configuration extends EldoConfig {
private Tools tools;
private ToolRemoval toolRemoval;
public interface Configuration {

public Configuration(Plugin plugin) {
super(plugin);
}

@Override
protected void reloadConfigs() {
toolRemoval = getConfig().getObject("toolRemoval", ToolRemoval.class, new ToolRemoval());
tools = loadConfig("tools", Consumers.emptyConsumer(), false).getObject("tools", Tools.class, new Tools());
}

@Override
protected void saveConfigs() {
getConfig().set("toolRemoval", toolRemoval);
loadConfig("tools", Consumers.emptyConsumer(), false).set("tools", tools);
}

public Tools tools() {
return tools;
}

public ToolRemoval toolRemoval() {
return toolRemoval;
}
void save();
Tools tools();
ToolRemoval toolRemoval();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
*
* Copyright (C) EldoriaRPG Team and Contributor
*/
package de.eldoria.schematictools.configuration;

import de.eldoria.eldoutilities.config.ConfigKey;
import de.eldoria.eldoutilities.config.JacksonConfig;
import de.eldoria.schematictools.configuration.elements.ToolRemoval;
import de.eldoria.schematictools.configuration.elements.Tools;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;

import java.nio.file.Path;

public class JacksonConfiguration extends JacksonConfig<ConfigFile> implements Configuration {
public static final ConfigKey<Tools> TOOLS = ConfigKey.of("Tools", Path.of("tools.yml"), Tools.class, Tools::new);

public JacksonConfiguration(@NotNull Plugin plugin) {
super(plugin, ConfigKey.defaultConfig(ConfigFile.class, ConfigFile::new));
}

@Override
public Tools tools() {
return secondary(TOOLS);
}

@Override
public ToolRemoval toolRemoval() {
return main().toolRemoval();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
*
* Copyright (C) EldoriaRPG Team and Contributor
*/
package de.eldoria.schematictools.configuration;

import de.eldoria.eldoutilities.configuration.EldoConfig;
import de.eldoria.eldoutilities.utils.Consumers;
import de.eldoria.schematictools.configuration.elements.ToolRemoval;
import de.eldoria.schematictools.configuration.elements.Tools;
import org.bukkit.plugin.Plugin;

public class LegacyConfiguration extends EldoConfig implements Configuration {
private Tools tools;
private ToolRemoval toolRemoval;

public LegacyConfiguration(Plugin plugin) {
super(plugin);
}

@Override
protected void reloadConfigs() {
toolRemoval = getConfig().getObject("toolRemoval", ToolRemoval.class, new ToolRemoval());
tools = loadConfig("tools", Consumers.emptyConsumer(), false).getObject("tools", Tools.class, new Tools());
}

@Override
protected void saveConfigs() {
getConfig().set("toolRemoval", toolRemoval);
loadConfig("tools", Consumers.emptyConsumer(), false).set("tools", tools);
}

@Override
public Tools tools() {
return tools;
}

@Override
public ToolRemoval toolRemoval() {
return toolRemoval;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
*
* Copyright (C) EldoriaRPG Team and Contributor
*/
package de.eldoria.schematictools.configuration.elements;
package de.eldoria.schematictools.configuration.builder;

import de.eldoria.schematictools.configuration.elements.Tool;

import java.util.UUID;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class Tool implements ConfigurationSerializable {
/**
* The unique numeric id of the brush
*/
private final int id;
private int id;
/**
* The owner of the underlying brush
*/
Expand All @@ -46,6 +46,9 @@ public class Tool implements ConfigurationSerializable {
private String permission;
private int usages;

public Tool() {
}

public Tool(UUID owner, String name, String brushName, int id, String permission, int usages) {
this.owner = owner;
this.name = name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package de.eldoria.schematictools.configuration.elements;

import de.eldoria.eldoutilities.serialization.SerializationUtil;
import de.eldoria.schematictools.configuration.builder.SchematicToolBuilder;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.SerializableAs;
import org.jetbrains.annotations.NotNull;
Expand Down

0 comments on commit 48f02a3

Please sign in to comment.