diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/command/DelWarpCommand.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/command/DelWarpCommand.java index 2ddad1e9f..c76774b25 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/command/DelWarpCommand.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/command/DelWarpCommand.java @@ -40,8 +40,8 @@ private void removeWarp(Player player, String name) { if (!this.warpService.warpExists(name)) { this.noticeService.create() .player(player.getUniqueId()) - .placeholder("{WARP}", name) .notice(translation -> translation.warp().notExist()) + .placeholder("{WARP}", name) .send(); return; diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/command/SetWarpCommand.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/command/SetWarpCommand.java index e5b2ecdef..a0f29e53b 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/command/SetWarpCommand.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/command/SetWarpCommand.java @@ -46,8 +46,8 @@ private void createWarp(Player player, String warp, UUID uniqueId) { if (this.warpService.warpExists(warp)) { this.noticeService.create() .player(uniqueId) - .placeholder("{WARP}", warp) .notice(translation -> translation.warp().warpAlreadyExists()) + .placeholder("{WARP}", warp) .send(); return; @@ -62,9 +62,7 @@ private void createWarp(Player player, String warp, UUID uniqueId) { .send(); if (this.config.warp.autoAddNewWarps) { - if (this.warpService.getNamesOfWarps().size() <= MAX_WARPS_IN_GUI) { - this.warpInventory.addWarp(createdWarp); this.noticeService.create() @@ -80,7 +78,6 @@ private void createWarp(Player player, String warp, UUID uniqueId) { .notice(translation -> translation.warp().itemLimit()) .placeholder("{LIMIT}", String.valueOf(MAX_WARPS_IN_GUI)) .send(); - } } } diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/command/WarpArgument.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/command/WarpArgument.java index c10b2291b..5b5b6946b 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/command/WarpArgument.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/command/WarpArgument.java @@ -5,8 +5,11 @@ import com.eternalcode.core.feature.warp.WarpService; import com.eternalcode.core.injector.annotations.Inject; import com.eternalcode.core.injector.annotations.lite.LiteArgument; +import com.eternalcode.core.notice.EternalCoreBroadcast; +import com.eternalcode.core.notice.NoticeService; import com.eternalcode.core.translation.Translation; import com.eternalcode.core.translation.TranslationManager; +import com.eternalcode.core.viewer.Viewer; import com.eternalcode.core.viewer.ViewerService; import dev.rollczi.litecommands.argument.Argument; import dev.rollczi.litecommands.argument.parser.ParseResult; @@ -20,11 +23,18 @@ class WarpArgument extends AbstractViewerArgument { private final WarpService warpService; + private final NoticeService noticeService; @Inject - WarpArgument(WarpService warpService, TranslationManager translationManager, ViewerService viewerService) { + WarpArgument( + WarpService warpService, + TranslationManager translationManager, + ViewerService viewerService, + NoticeService noticeService + ) { super(viewerService, translationManager); this.warpService = warpService; + this.noticeService = noticeService; } @Override @@ -32,7 +42,14 @@ public ParseResult parse(Invocation invocation, String argu Optional warpOption = this.warpService.findWarp(argument); return warpOption.map(ParseResult::success) - .orElseGet(() -> ParseResult.failure(translation.warp().notExist())); + .orElseGet(() -> { + EternalCoreBroadcast warpNotExistNotice = this.noticeService.create() + .sender(invocation.sender()) + .notice(translation.warp().notExist()) + .placeholder("{WARP}", argument); + + return ParseResult.failure(warpNotExistNotice); + }); } @Override