From 3e2b22be0268ee274c37ef0b4a5d0f3be69af73e Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 11 Sep 2022 21:24:23 +0200 Subject: [PATCH] Fix some MultiReplaceCommand stuff Signed-off-by: yoyosource --- .../bausystem/features/worldedit/MultiReplaceCommand.java | 4 ++-- .../steamwar/bausystem/features/worldedit/SpecialReplace.java | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/MultiReplaceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/MultiReplaceCommand.java index 3462cbab..1ddda8c1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/MultiReplaceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/MultiReplaceCommand.java @@ -61,7 +61,7 @@ public class MultiReplaceCommand extends SWCommand { Map stringReplacements = new HashMap<>(); for (Replacement replacement : replacements) { - stringReplacements.put(replacement.from.name(), replacement.to.name()); + stringReplacements.put("minecraft:" + replacement.from.name().toLowerCase(), "minecraft:" + replacement.to.name().toLowerCase()); } Region region = WorldEditUtils.getRegion(player); @@ -96,7 +96,7 @@ public class MultiReplaceCommand extends SWCommand { public Collection tabCompletes(CommandSender commandSender, String[] strings, String s) { int index = s.indexOf(":"); if (index != -1 && index == s.lastIndexOf(":")) { - return materials.stream().map(Material::name).map(t -> s + t).collect(Collectors.toList()); + return materials.stream().map(Material::name).map(t -> s.substring(0, index + 1) + t).collect(Collectors.toList()); } else if (index == -1) { return materials.stream().map(Material::name).collect(Collectors.toList()); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/SpecialReplace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/SpecialReplace.java index a7205aef..6e3ad8a1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/SpecialReplace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/SpecialReplace.java @@ -30,8 +30,6 @@ import org.bukkit.Bukkit; import javax.annotation.Nullable; import java.util.Map; -import java.util.Set; -import java.util.function.Function; public class SpecialReplace implements Mask, Pattern {