From 44dfe7fa24d7ac193304ff0c486ce937eae8b5a9 Mon Sep 17 00:00:00 2001 From: Restioson Date: Tue, 11 Jun 2024 14:57:42 +0200 Subject: [PATCH] fix: still show feedback if no regions affected by cmd --- .../creator_tools/command/MapMetadataCommand.java | 12 +++++++++--- .../data/nucleoid_creator_tools/lang/en_us.json | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/xyz/nucleoid/creator_tools/command/MapMetadataCommand.java b/src/main/java/xyz/nucleoid/creator_tools/command/MapMetadataCommand.java index 1d3b7b8..da92c66 100644 --- a/src/main/java/xyz/nucleoid/creator_tools/command/MapMetadataCommand.java +++ b/src/main/java/xyz/nucleoid/creator_tools/command/MapMetadataCommand.java @@ -279,7 +279,7 @@ private static boolean executeRegionDataGet(CommandContext context.getSource().sendFeedback(() -> withMapPrefix(map, Text.translatable("text.nucleoid_creator_tools.map.region.data.get", region.marker(), formatNbt(region.data())) ), false); - return false; + return true; } private static boolean executeRegionDataMerge(CommandContext context, MapWorkspace map, WorkspaceRegion region) { @@ -615,9 +615,15 @@ private static Command executeInRegions(String message, Reg } if (count > 0) { - int finalCount = count; - source.sendFeedback(() -> withMapPrefix(map, Text.literal(String.format(message, finalCount))), false); + if (!message.isEmpty()) { + int finalCount = count; + source.sendFeedback(() -> withMapPrefix(map, Text.literal(String.format(message, finalCount))), false); + } + } else { + var text = Text.translatable("text.nucleoid_creator_tools.map.region.none_affected"); + source.sendFeedback(() -> withMapPrefix(map, text), false); } + return 2; }; } diff --git a/src/main/resources/data/nucleoid_creator_tools/lang/en_us.json b/src/main/resources/data/nucleoid_creator_tools/lang/en_us.json index 8736cdc..e808d7b 100644 --- a/src/main/resources/data/nucleoid_creator_tools/lang/en_us.json +++ b/src/main/resources/data/nucleoid_creator_tools/lang/en_us.json @@ -47,6 +47,7 @@ "text.nucleoid_creator_tools.map.open.map_already_exists": "Map with id '%s' already exists!", "text.nucleoid_creator_tools.map.open.success": "Opened workspace '%s'! Use %s to join this map", "text.nucleoid_creator_tools.map.origin.set": "Updated origin for workspace", + "text.nucleoid_creator_tools.map.region.none_affected": "No regions affected.", "text.nucleoid_creator_tools.map.region.add.success": "Added region '%s'.", "text.nucleoid_creator_tools.map.region.add.success.excited": "Added region '%s'!", "text.nucleoid_creator_tools.map.region.bounds.get": "%s to %s",