Skip to content

Commit

Permalink
Make paper build compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbowdashlabs committed Jul 27, 2024
1 parent 5fb7144 commit 3ee219d
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 23 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use nix
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
9 changes: 5 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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("io.github.goooler.shadow") version "8.1.8"
id("de.chojo.publishdata") version "1.4.0"
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
java
Expand All @@ -20,7 +20,7 @@ repositories {
}

dependencies {
compileOnly("de.eldoria", "schematicbrushreborn-api", "2.6.0")
compileOnly("de.eldoria", "schematicbrushreborn-api", "2.7.1-DEV")
compileOnly("org.spigotmc", "spigot-api", "1.16.5-R0.1-SNAPSHOT")
compileOnly("com.sk89q.worldedit", "worldedit-bukkit", "7.3.0")
// PlotSquared Core API
Expand Down Expand Up @@ -53,9 +53,11 @@ license {
}

java {
toolchain{
languageVersion = JavaLanguageVersion.of(21)
}
withSourcesJar()
withJavadocJar()
sourceCompatibility = JavaVersion.VERSION_17
}

publishData {
Expand Down Expand Up @@ -101,7 +103,6 @@ tasks {
}

shadowJar {
relocate("de.eldoria.eldoutilities", "de.eldoria.schematicbrush.libs.eldoutilities")
relocate("de.eldoria.messageblocker", "de.eldoria.schematicbrush.libs.messageblocker")
mergeServiceFiles()
archiveClassifier.set("all")
Expand Down
11 changes: 11 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{ pkgs ? import <nixpkgs> {}, ... }:

let
jdk = pkgs.jdk21;
gradle= pkgs.gradle.override { java = jdk; };
in
pkgs.mkShell
{
packages = with pkgs; [jdk gradle];
}

31 changes: 28 additions & 3 deletions src/main/java/de/eldoria/gridselector/GridSelector.java
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

package de.eldoria.gridselector.command.grid.cluster.modify;

import de.eldoria.eldoutilities.commands.Completion;
import de.eldoria.eldoutilities.commands.command.AdvancedCommand;
import de.eldoria.eldoutilities.commands.command.CommandMeta;
import de.eldoria.eldoutilities.commands.command.util.Arguments;
import de.eldoria.eldoutilities.commands.exceptions.CommandException;
import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor;
import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil;
import de.eldoria.gridselector.command.grid.cluster.Sessions;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
Expand All @@ -38,6 +38,6 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar

@Override
public @Nullable List<String> onTabComplete(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) throws CommandException {
return TabCompleteUtil.completeMaterial(args.asString(0), true);
return Completion.completeMaterial(args.asString(0), true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

package de.eldoria.gridselector.command.grid.cluster.modify;

import de.eldoria.eldoutilities.commands.Completion;
import de.eldoria.eldoutilities.commands.command.AdvancedCommand;
import de.eldoria.eldoutilities.commands.command.CommandMeta;
import de.eldoria.eldoutilities.commands.command.util.Arguments;
import de.eldoria.eldoutilities.commands.command.util.CommandAssertions;
import de.eldoria.eldoutilities.commands.exceptions.CommandException;
import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor;
import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil;
import de.eldoria.gridselector.command.grid.cluster.Sessions;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
Expand Down Expand Up @@ -40,6 +40,6 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar

@Override
public @Nullable List<String> onTabComplete(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) throws CommandException {
return TabCompleteUtil.completeMinInt(args.asString(0), 1);
return Completion.completeMinInt(args.asString(0), 1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

package de.eldoria.gridselector.command.grid.cluster.modify;

import de.eldoria.eldoutilities.commands.Completion;
import de.eldoria.eldoutilities.commands.command.AdvancedCommand;
import de.eldoria.eldoutilities.commands.command.CommandMeta;
import de.eldoria.eldoutilities.commands.command.util.Arguments;
import de.eldoria.eldoutilities.commands.exceptions.CommandException;
import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor;
import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil;
import de.eldoria.gridselector.command.grid.cluster.Sessions;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
Expand All @@ -38,6 +38,6 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar

@Override
public @Nullable List<String> onTabComplete(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) throws CommandException {
return TabCompleteUtil.completeMaterial(args.asString(0), true);
return Completion.completeMaterial(args.asString(0), true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

package de.eldoria.gridselector.command.grid.cluster.modify;

import de.eldoria.eldoutilities.commands.Completion;
import de.eldoria.eldoutilities.commands.command.AdvancedCommand;
import de.eldoria.eldoutilities.commands.command.CommandMeta;
import de.eldoria.eldoutilities.commands.command.util.Arguments;
import de.eldoria.eldoutilities.commands.command.util.CommandAssertions;
import de.eldoria.eldoutilities.commands.exceptions.CommandException;
import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor;
import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil;
import de.eldoria.gridselector.command.grid.cluster.Sessions;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
Expand Down Expand Up @@ -40,6 +40,6 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar

@Override
public @Nullable List<String> onTabComplete(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) throws CommandException {
return TabCompleteUtil.completeMinInt(args.asString(0), 0);
return Completion.completeMinInt(args.asString(0), 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

package de.eldoria.gridselector.command.grid.cluster.modify;

import de.eldoria.eldoutilities.commands.Completion;
import de.eldoria.eldoutilities.commands.command.AdvancedCommand;
import de.eldoria.eldoutilities.commands.command.CommandMeta;
import de.eldoria.eldoutilities.commands.command.util.Arguments;
import de.eldoria.eldoutilities.commands.exceptions.CommandException;
import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor;
import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil;
import de.eldoria.gridselector.command.grid.cluster.Sessions;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
Expand All @@ -38,6 +38,6 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar

@Override
public @Nullable List<String> onTabComplete(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) throws CommandException {
return TabCompleteUtil.completeMaterial(args.asString(0), true);
return Completion.completeMaterial(args.asString(0), true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

package de.eldoria.gridselector.command.grid.cluster.modify;

import de.eldoria.eldoutilities.commands.Completion;
import de.eldoria.eldoutilities.commands.command.AdvancedCommand;
import de.eldoria.eldoutilities.commands.command.CommandMeta;
import de.eldoria.eldoutilities.commands.command.util.Arguments;
import de.eldoria.eldoutilities.commands.command.util.CommandAssertions;
import de.eldoria.eldoutilities.commands.exceptions.CommandException;
import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor;
import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil;
import de.eldoria.gridselector.command.grid.cluster.Sessions;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
Expand Down Expand Up @@ -40,6 +40,6 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar

@Override
public @Nullable List<String> onTabComplete(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) throws CommandException {
return TabCompleteUtil.completeMinInt(args.asString(0), 1);
return Completion.completeMinInt(args.asString(0), 1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

package de.eldoria.gridselector.command.grid.cluster.modify;

import de.eldoria.eldoutilities.commands.Completion;
import de.eldoria.eldoutilities.commands.command.AdvancedCommand;
import de.eldoria.eldoutilities.commands.command.CommandMeta;
import de.eldoria.eldoutilities.commands.command.util.Arguments;
import de.eldoria.eldoutilities.commands.command.util.CommandAssertions;
import de.eldoria.eldoutilities.commands.exceptions.CommandException;
import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor;
import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil;
import de.eldoria.gridselector.command.grid.cluster.Sessions;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
Expand Down Expand Up @@ -40,6 +40,6 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar

@Override
public @Nullable List<String> onTabComplete(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) throws CommandException {
return TabCompleteUtil.completeMinInt(args.asString(0), 0);
return Completion.completeMinInt(args.asString(0), 0);
}
}

0 comments on commit 3ee219d

Please sign in to comment.