diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index b58fa9e75..ad3a6b91c 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -3,7 +3,7 @@ object Versions { const val SPIGOT_API = "1.19.4-R0.1-SNAPSHOT" const val PAPER_API = "1.19.4-R0.1-SNAPSHOT" - const val ETERNALCODE_COMMONS = "1.1.3" + const val ETERNALCODE_COMMONS = "1.1.4-SNAPSHOT" const val MULTIFICATION = "1.1.3" const val JETBRAINS_ANNOTATIONS = "24.1.0" @@ -13,7 +13,7 @@ object Versions { const val PAPERLIB = "1.0.8" const val ADVENTURE_PLATFORM = "4.3.4" - const val ADVENTURE_TEXT_MINIMESSAGE = "4.18.0-SNAPSHOT" + const val ADVENTURE_TEXT_MINIMESSAGE = "4.17.0" const val ADVENTURE_PLATFORM_FACET = "4.3.4" const val CDN_CONFIGS = "1.14.5" diff --git a/buildSrc/src/main/kotlin/eternalcore-repositories.gradle.kts b/buildSrc/src/main/kotlin/eternalcore-repositories.gradle.kts index 016e3ceed..2809a6cab 100644 --- a/buildSrc/src/main/kotlin/eternalcore-repositories.gradle.kts +++ b/buildSrc/src/main/kotlin/eternalcore-repositories.gradle.kts @@ -8,6 +8,7 @@ repositories { maven { url = uri("https://repo.papermc.io/repository/maven-public/") } maven { url = uri("https://repo.panda-lang.org/releases/") } maven { url = uri("https://repo.eternalcode.pl/releases/") } + maven { url = uri("https://repo.eternalcode.pl/snapshots/") } maven { url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/") } maven("https://repo.stellardrift.ca/repository/snapshots/") } diff --git a/eternalcore-core/build.gradle.kts b/eternalcore-core/build.gradle.kts index 46f8c7993..772282633 100644 --- a/eternalcore-core/build.gradle.kts +++ b/eternalcore-core/build.gradle.kts @@ -29,6 +29,10 @@ dependencies { implementation("net.kyori:adventure-text-minimessage:${Versions.ADVENTURE_TEXT_MINIMESSAGE}") testImplementation("com.eternalcode:eternalcode-commons-bukkit:${Versions.ETERNALCODE_COMMONS}") + + implementation("com.eternalcode:eternalcode-commons-bukkit:${Versions.ETERNALCODE_COMMONS}") + implementation("com.eternalcode:eternalcode-commons-folia:${Versions.ETERNALCODE_COMMONS}") + implementation("com.eternalcode:eternalcode-commons-adventure:${Versions.ETERNALCODE_COMMONS}") } eternalShadow { @@ -54,8 +58,6 @@ eternalShadow { ) // EternalCode Commons - library("com.eternalcode:eternalcode-commons-bukkit:${Versions.ETERNALCODE_COMMONS}") - library("com.eternalcode:eternalcode-commons-adventure:${Versions.ETERNALCODE_COMMONS}") libraryRelocate( "com.eternalcode.commons", ) diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/item/SkullCommand.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/item/SkullCommand.java index 80e6b4bbd..27d84c083 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/item/SkullCommand.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/item/SkullCommand.java @@ -4,14 +4,13 @@ import com.eternalcode.core.injector.annotations.Inject; import com.eternalcode.core.notice.NoticeService; import dev.rollczi.litecommands.annotations.argument.Arg; +import dev.rollczi.litecommands.annotations.command.Command; import dev.rollczi.litecommands.annotations.context.Context; import dev.rollczi.litecommands.annotations.execute.Execute; import dev.rollczi.litecommands.annotations.permission.Permission; -import dev.rollczi.litecommands.annotations.command.Command; import dev.rollczi.liteskullapi.SkullAPI; import dev.triumphteam.gui.builder.item.ItemBuilder; import net.kyori.adventure.text.Component; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/sudo/SudoCommand.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/sudo/SudoCommand.java index e9eb0bacb..e372a5ab9 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/sudo/SudoCommand.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/sudo/SudoCommand.java @@ -2,6 +2,7 @@ import com.eternalcode.annotations.scan.command.DescriptionDocs; import com.eternalcode.annotations.scan.feature.FeatureDocs; +import com.eternalcode.commons.scheduler.Scheduler; import com.eternalcode.core.injector.annotations.Inject; import com.eternalcode.core.notice.NoticeService; import com.eternalcode.core.viewer.Viewer; @@ -20,18 +21,20 @@ public class SudoCommand { private final Server server; private final NoticeService noticeService; + private final Scheduler scheduler; @Inject - public SudoCommand(Server server, NoticeService noticeService) { + public SudoCommand(Server server, NoticeService noticeService, Scheduler scheduler) { this.server = server; this.noticeService = noticeService; + this.scheduler = scheduler; } @Execute(name = "-console") @Permission("eternalcore.sudo.console") @DescriptionDocs(description = "Execute command as console", arguments = "") void console(@Context Viewer viewer, @Join String command) { - this.server.dispatchCommand(this.server.getConsoleSender(), command); + this.scheduler.sync(() -> this.server.dispatchCommand(this.server.getConsoleSender(), command)); this.sendSudoSpy(viewer, command); } @@ -39,7 +42,7 @@ void console(@Context Viewer viewer, @Join String command) { @Permission("eternalcore.sudo.player") @DescriptionDocs(description = "Execute command as player", arguments = " ") void player(@Context Viewer viewer, @Arg Player target, @Join String command) { - this.server.dispatchCommand(target, command); + this.scheduler.sync(() -> this.server.dispatchCommand(target, command)); this.sendSudoSpy(viewer, command); } @@ -53,6 +56,7 @@ private void sendSudoSpy(Viewer viewer, String command) { this.server.getOnlinePlayers().stream() .filter(player -> player.hasPermission("eternalcore.sudo.spy")) + .filter(player -> !player.getUniqueId().equals(viewer.getUniqueId())) .forEach(player -> this.noticeService.create() .notice(translation -> translation.sudo().sudoMessage()) .placeholder("{COMMAND}", command) diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/time/DayCommand.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/time/DayCommand.java index 04a12d3e2..6cade9bd5 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/time/DayCommand.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/time/DayCommand.java @@ -1,14 +1,15 @@ package com.eternalcode.core.feature.essentials.time; import com.eternalcode.annotations.scan.command.DescriptionDocs; +import com.eternalcode.commons.scheduler.Scheduler; import com.eternalcode.core.injector.annotations.Inject; import com.eternalcode.core.notice.NoticeService; import com.eternalcode.core.viewer.Viewer; import dev.rollczi.litecommands.annotations.argument.Arg; +import dev.rollczi.litecommands.annotations.command.Command; import dev.rollczi.litecommands.annotations.context.Context; import dev.rollczi.litecommands.annotations.execute.Execute; import dev.rollczi.litecommands.annotations.permission.Permission; -import dev.rollczi.litecommands.annotations.command.Command; import org.bukkit.World; @Command(name = "day") @@ -16,10 +17,12 @@ class DayCommand { private final NoticeService noticeService; + private final Scheduler scheduler; @Inject - DayCommand(NoticeService noticeService) { + DayCommand(NoticeService noticeService, Scheduler scheduler) { this.noticeService = noticeService; + this.scheduler = scheduler; } @Execute @@ -35,7 +38,9 @@ void dayWorld(@Context Viewer viewer, @Arg World world) { } private void setDay(Viewer viewer, World world) { - world.setTime(100); + this.scheduler.sync(() -> { + world.setTime(100); + }); this.noticeService.create() .viewer(viewer) diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/time/NightCommand.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/time/NightCommand.java index fd83d23c2..4e6d8b6ed 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/time/NightCommand.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/time/NightCommand.java @@ -1,14 +1,15 @@ package com.eternalcode.core.feature.essentials.time; import com.eternalcode.annotations.scan.command.DescriptionDocs; +import com.eternalcode.commons.scheduler.Scheduler; import com.eternalcode.core.injector.annotations.Inject; import com.eternalcode.core.notice.NoticeService; import com.eternalcode.core.viewer.Viewer; import dev.rollczi.litecommands.annotations.argument.Arg; +import dev.rollczi.litecommands.annotations.command.Command; import dev.rollczi.litecommands.annotations.context.Context; import dev.rollczi.litecommands.annotations.execute.Execute; import dev.rollczi.litecommands.annotations.permission.Permission; -import dev.rollczi.litecommands.annotations.command.Command; import org.bukkit.World; @Command(name = "night") @@ -16,10 +17,12 @@ class NightCommand { private final NoticeService noticeService; + private final Scheduler scheduler; @Inject - NightCommand(NoticeService noticeService) { + NightCommand(NoticeService noticeService, Scheduler scheduler) { this.noticeService = noticeService; + this.scheduler = scheduler; } @Execute @@ -35,7 +38,9 @@ void nightWorld(@Context Viewer viewer, @Arg World world) { } private void setNight(Viewer viewer, World world) { - world.setTime(13700); + this.scheduler.sync(() -> { + world.setTime(13700); + }); this.noticeService.create() .viewer(viewer) diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/time/TimeCommand.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/time/TimeCommand.java index d31ebfd91..d0b81ec4b 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/time/TimeCommand.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/essentials/time/TimeCommand.java @@ -1,6 +1,7 @@ package com.eternalcode.core.feature.essentials.time; import com.eternalcode.annotations.scan.command.DescriptionDocs; +import com.eternalcode.commons.scheduler.Scheduler; import com.eternalcode.core.injector.annotations.Inject; import com.eternalcode.core.notice.NoticeService; import com.eternalcode.core.viewer.Viewer; @@ -17,10 +18,12 @@ class TimeCommand { private final NoticeService noticeService; + private final Scheduler scheduler; @Inject - TimeCommand(NoticeService noticeService) { + TimeCommand(NoticeService noticeService, Scheduler scheduler) { this.noticeService = noticeService; + this.scheduler = scheduler; } @Execute(name = "add") @@ -32,7 +35,9 @@ void add(@Context Player player, @Context Viewer viewer, @Arg(TimeArgument.KEY) @Execute(name = "add") @DescriptionDocs(description = "Add specified amount of time to specified world", arguments = "