Skip to content

Commit

Permalink
Release 0.12.0 (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbowdashlabs authored Feb 3, 2025
2 parents df11252 + 86b2545 commit 720c70f
Show file tree
Hide file tree
Showing 74 changed files with 1,806 additions and 2,035 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use nix
6 changes: 3 additions & 3 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
uses: actions/setup-java@v3
- 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
6 changes: 3 additions & 3 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
uses: actions/setup-java@v3
- 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
8 changes: 0 additions & 8 deletions BloodNight-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
plugins {
id("de.eldoria.library-conventions")
}

description = "BloodNight-api"

java {
withJavadocJar()
}

publishData {
useEldoNexusRepos()
publishComponent("java")
Expand Down
1 change: 1 addition & 0 deletions BloodNight-core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
run/
71 changes: 36 additions & 35 deletions BloodNight-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
plugins {
id("de.eldoria.library-conventions")
id("com.github.johnrengelman.shadow") version "8.1.1"
alias(libs.plugins.shadow)
alias(libs.plugins.pluginyml)
alias(libs.plugins.runpaper)
}

dependencies {
implementation(project(":BloodNight-api"))
implementation("de.eldoria", "eldo-util", "1.10.2-SNAPSHOT")
implementation("net.kyori", "adventure-platform-bukkit", "4.3.1")
testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.10.1")
implementation("org.bstats", "bstats-bukkit", "3.1.0")
bukkitLibrary(libs.bundles.eldoutil)
bukkitLibrary("net.kyori", "adventure-platform-bukkit", "4.3.4")
testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.11.4")
testImplementation("junit", "junit", "4.13.2")
testImplementation("org.mockito", "mockito-core", "5.7.0")
compileOnly("io.lumine", "Mythic-Dist", "5.4.1")
compileOnly("me.clip", "placeholderapi", "2.11.5")
testImplementation("org.mockito", "mockito-core", "5.15.2")
compileOnly("io.lumine", "Mythic-Dist", "5.7.2")
compileOnly("me.clip", "placeholderapi", "2.11.6")
compileOnly("com.onarandombox.multiversecore", "Multiverse-Core", "4.3.1")
compileOnly("se.hyperver.hyperverse", "Core", "0.10.0")
}

configurations {
all {
resolutionStrategy{
cacheChangingModulesFor(0, "SECONDS")
}
}
}

description = "BloodNight-core"
val shadebase = project.group as String + ".bloodnight."

java {
withJavadocJar()
}

publishData {
addBuildData()
useEldoNexusRepos()
Expand Down Expand Up @@ -61,28 +51,16 @@ publishing {

tasks {
shadowJar {
relocate("de.eldoria.eldoutilities", shadebase + "eldoutilities")
relocate("net.kyori", shadebase + "kyori")
relocate("org.bstats", "de.eldoria.bloodnight.libs.bstats")
mergeServiceFiles()
archiveBaseName.set(project.parent?.name)
}

processResources {
from(sourceSets.main.get().resources.srcDirs) {
filesMatching("plugin.yml") {
expand(
"version" to publishData.getVersion(true)
)
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}

build{
build {
dependsOn(shadowJar)
}

register<Copy>("copyToServer") {
register<Copy>("copyToServer") {
val path = project.property("targetDir") ?: "";
if (path.toString().isEmpty()) {
println("targetDir is not set in gradle properties")
Expand All @@ -91,4 +69,27 @@ tasks {
from(shadowJar)
destinationDir = File(path.toString())
}

runServer{
minecraftVersion("1.21.1")
}
}

bukkit {
name = "BloodNight"
description = "Make your nights a nightmare again"
authors = listOf("RainbowDashLabs")
version = publishData.getVersion(true)
main = "de.eldoria.bloodnight.core.BloodNight"
website = "https://www.spigotmc.org/resources/85095"
apiVersion = "1.16"
softDepend = listOf("Multiverse-Core", "Hyperverse", "MythicMobs", "PlaceholderAPI")

commands {
register("bloodnight") {
description = "Main Blood Night command"
usage = "/bloodnight help"
aliases = listOf("bn", "bnight")
}
}
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,48 @@
package de.eldoria.bloodnight.command;

import de.eldoria.bloodnight.command.bloodnight.*;
import de.eldoria.bloodnight.command.bloodnight.CancelNight;
import de.eldoria.bloodnight.command.bloodnight.ForceNight;
import de.eldoria.bloodnight.command.bloodnight.Help;
import de.eldoria.bloodnight.command.bloodnight.ManageDeathActions;
import de.eldoria.bloodnight.command.bloodnight.ManageMob;
import de.eldoria.bloodnight.command.bloodnight.ManageMobs;
import de.eldoria.bloodnight.command.bloodnight.ManageNight;
import de.eldoria.bloodnight.command.bloodnight.ManageNightSelection;
import de.eldoria.bloodnight.command.bloodnight.ManageWorlds;
import de.eldoria.bloodnight.command.bloodnight.Reload;
import de.eldoria.bloodnight.command.bloodnight.SpawnMob;
import de.eldoria.bloodnight.config.Configuration;
import de.eldoria.bloodnight.core.manager.mobmanager.MobManager;
import de.eldoria.bloodnight.core.manager.nightmanager.NightManager;
import de.eldoria.bloodnight.util.Permissions;
import de.eldoria.eldoutilities.simplecommands.EldoCommand;
import de.eldoria.eldoutilities.simplecommands.commands.DefaultDebug;
import de.eldoria.eldoutilities.commands.command.AdvancedCommand;
import de.eldoria.eldoutilities.commands.command.CommandMeta;
import de.eldoria.eldoutilities.commands.defaultcommands.DefaultAbout;
import de.eldoria.eldoutilities.commands.defaultcommands.DefaultDebug;
import org.bukkit.plugin.Plugin;

public class BloodNightCommand extends EldoCommand {
public class BloodNightCommand extends AdvancedCommand {

public BloodNightCommand(Configuration configuration, Plugin plugin,
NightManager nightManager, MobManager mobManager, InventoryListener inventoryListener) {
super(plugin);
Help help = new Help(plugin);
setDefaultCommand(help);
registerCommand("help", help);
registerCommand("about", new About(plugin));
registerCommand("spawnMob", new SpawnMob(plugin, nightManager, mobManager));
registerCommand("cancelNight", new CancelNight(plugin, nightManager, configuration));
registerCommand("forceNight", new ForceNight(plugin, nightManager, configuration));
registerCommand("manageWorlds", new ManageWorlds(plugin, configuration));
registerCommand("manageMob", new ManageMob(plugin, configuration, inventoryListener));
registerCommand("manageNight", new ManageNight(plugin, configuration));
registerCommand("manageMobs", new ManageMobs(plugin, configuration, inventoryListener));
registerCommand("nightSelection", new ManageNightSelection(plugin, configuration, inventoryListener));
registerCommand("deathActions", new ManageDeathActions(plugin, configuration));
registerCommand("reload", new Reload(plugin));
registerCommand("debug", new DefaultDebug(plugin, Permissions.Admin.RELOAD));
meta(CommandMeta.builder("bloodnight")
.withDefaultCommand(help)
.withSubCommand(help)
.withSubCommand(new DefaultAbout(plugin, "https://bn.discord.eldoria.de", "commands.about"))
.withSubCommand(new SpawnMob(plugin, nightManager, mobManager))
.withSubCommand(new CancelNight(plugin, nightManager, configuration))
.withSubCommand(new ForceNight(plugin, nightManager, configuration))
.withSubCommand(new ManageWorlds(plugin, configuration))
.withSubCommand(new ManageMob(plugin, configuration, inventoryListener))
.withSubCommand(new ManageNight(plugin, configuration))
.withSubCommand(new ManageMobs(plugin, configuration, inventoryListener))
.withSubCommand(new ManageNightSelection(plugin, configuration, inventoryListener))
.withSubCommand(new ManageDeathActions(plugin, configuration))
.withSubCommand(new Reload(plugin))
.withSubCommand(new DefaultDebug(plugin, Permissions.Admin.RELOAD))
.build()
);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
import de.eldoria.bloodnight.config.Configuration;
import de.eldoria.bloodnight.core.manager.nightmanager.NightManager;
import de.eldoria.bloodnight.util.Permissions;
import de.eldoria.eldoutilities.localization.Replacement;
import de.eldoria.eldoutilities.simplecommands.EldoCommand;
import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil;
import de.eldoria.eldoutilities.utils.ArgumentUtils;
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.Argument;
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.ITabExecutor;
import de.eldoria.eldoutilities.messages.Replacement;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
Expand All @@ -18,60 +22,42 @@
import java.util.Collections;
import java.util.List;

public class CancelNight extends EldoCommand {
public class CancelNight extends AdvancedCommand implements ITabExecutor {
private final NightManager nightManager;
private final Configuration configuration;

public CancelNight(Plugin plugin, NightManager nightManager, Configuration configuration) {
super(plugin);
super(plugin, CommandMeta.builder("cancelNight")
.withPermission(Permissions.Admin.CANCEL_NIGHT)
.addArgument("syntax.worldName", false)
.build());
this.nightManager = nightManager;
this.configuration = configuration;
}

@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (denyAccess(sender, Permissions.Admin.CANCEL_NIGHT)) {
return true;
}

public void onCommand(@NotNull CommandSender sender, @NotNull String alias, @NotNull Arguments args) throws CommandException {
World world = null;
if (sender instanceof Player player) {
world = player.getWorld();
} else {
if (argumentsInvalid(sender, args, 1, "[" + localizer().getMessage("syntax.worldName") + "]")) {
return true;
}
CommandAssertions.invalidArguments(args, Argument.input("syntax.worldName", true));
}

world = ArgumentUtils.getOrDefault(args, 0, ArgumentUtils::getWorld, world);

if (world == null) {
messageSender().sendError(sender, localizer().getMessage("error.invalidWorld"));
return true;
}
world = args.asWorld(0, world);

boolean enabled = configuration.getWorldSettings(world).isEnabled();
if (!enabled) {
messageSender().sendLocalizedError(sender, "error.worldNotEnabled",
Replacement.create("WORLD", world.getName(), '6'));
return true;
}
if (nightManager.isBloodNightActive(world)) {
nightManager.cancelNight(world);
messageSender().sendMessage(sender, localizer().getMessage("cancelNight.canceled",
Replacement.create("WORLD", world.getName()).addFormatting('6')));
} else {
messageSender().sendError(sender, localizer().getMessage("cancelNight.notActive",
Replacement.create("WORLD", world.getName()).addFormatting('6')));
}
return true;
CommandAssertions.isTrue(!enabled, "error.worldNotEnabled", Replacement.create("WORLD", world));
CommandAssertions.isTrue(nightManager.isBloodNightActive(world), "cancelNight.notActive", Replacement.create("WORLD", world));
nightManager.cancelNight(world);
messageSender().sendMessage(sender, "cancelNight.canceled",
Replacement.create("WORLD", world.getName()));
}

@Override
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command
command, @NotNull String alias, @NotNull String[] args) {
if (args.length == 1) {
return TabCompleteUtil.completeWorlds(args[0]);
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull Arguments args) throws CommandException {
if (args.sizeIs(1)) {
return Completion.completeWorlds(args.asString(0));
}
return Collections.emptyList();
}
Expand Down
Loading

0 comments on commit 720c70f

Please sign in to comment.