From 912014a823ec38dd8d9d4b414b927d525b44500b Mon Sep 17 00:00:00 2001 From: peaqe <118134944+devpeaqe@users.noreply.github.com> Date: Sun, 3 Nov 2024 10:58:34 +0100 Subject: [PATCH] Fixed issue #72 (#152) * fixed issue #72 https://github.com/FancyMcPlugins/FancyHolograms/issues/72 * Issue #72 cancelt the running command if the provided text is empty implemented changes to the InsertBeforeCMD.java * Issue #72 removed command lines --------- Co-authored-by: peaqe --- .../fancyholograms/commands/hologram/InsertAfterCMD.java | 6 ++++++ .../fancyholograms/commands/hologram/InsertBeforeCMD.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/de/oliver/fancyholograms/commands/hologram/InsertAfterCMD.java b/src/main/java/de/oliver/fancyholograms/commands/hologram/InsertAfterCMD.java index a8145c38..7c70ea84 100644 --- a/src/main/java/de/oliver/fancyholograms/commands/hologram/InsertAfterCMD.java +++ b/src/main/java/de/oliver/fancyholograms/commands/hologram/InsertAfterCMD.java @@ -44,6 +44,12 @@ public boolean run(@NotNull CommandSender player, @Nullable Hologram hologram, @ for (int i = 4; i < args.length; i++) { text += args[i] + " "; } + + if (text.isEmpty()) { + MessageHelper.error(player, "You need to provide a text to insert"); + return true; + } + text = text.substring(0, text.length() - 1); final var lines = new ArrayList<>(textData.getText()); diff --git a/src/main/java/de/oliver/fancyholograms/commands/hologram/InsertBeforeCMD.java b/src/main/java/de/oliver/fancyholograms/commands/hologram/InsertBeforeCMD.java index 78f90b14..5fb50344 100644 --- a/src/main/java/de/oliver/fancyholograms/commands/hologram/InsertBeforeCMD.java +++ b/src/main/java/de/oliver/fancyholograms/commands/hologram/InsertBeforeCMD.java @@ -46,6 +46,12 @@ public boolean run(@NotNull CommandSender player, @Nullable Hologram hologram, @ for (int i = 4; i < args.length; i++) { text += args[i] + " "; } + + if (text.isEmpty()) { + MessageHelper.error(player, "You need to provide a text to insert"); + return true; + } + text = text.substring(0, text.length() - 1); final var lines = new ArrayList<>(textData.getText());