From 8a474997c6836dc947970815cf1fa5891d428c34 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 22 Apr 2023 15:40:12 +0200 Subject: [PATCH] Fix Search Click --- .../commands/schematiccommand/SchematicCommandUtils.java | 5 +++-- .../commands/schematiccommand/parts/SearchPart.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommandUtils.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommandUtils.java index e3594c5..753cd3b 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommandUtils.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommandUtils.java @@ -146,10 +146,10 @@ public class SchematicCommandUtils { if (node.isDir()) { schematics.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(SchematicSystem.MESSAGE.parse("UTIL_LIST_OPEN_DIR", player)).create())); - schematics.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (behavior.isPublics() ? "public " : "") + breadcrumbs + node.getName() + "/")); + schematics.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (behavior.isPublics() ? "public " : "") + (behavior.nonCachedBreadcrumbs ? node.generateBreadcrumbs() : breadcrumbs + node.getName() + "/"))); } else { schematics.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(SchematicSystem.MESSAGE.parse("UTIL_LIST_OPEN_SCHEM", player)).create())); - schematics.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem info " + (behavior.isPublics() ? "public " : "") + breadcrumbs + node.getName())); + schematics.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem info " + (behavior.isPublics() ? "public " : "") + (behavior.nonCachedBreadcrumbs ? node.generateBreadcrumbs() : breadcrumbs + node.getName()))); } player.spigot().sendMessage(schematics); @@ -194,6 +194,7 @@ public class SchematicCommandUtils { @Builder.Default private boolean showPath = true; @Builder.Default private boolean publics = false; + @Builder.Default private boolean nonCachedBreadcrumbs = false; @Builder.Default private UnaryOperator renderHook = s -> s; @Builder.Default private IntFunction pageCommandGen = value -> "/schem list " + value; } diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/SearchPart.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/SearchPart.java index 8187139..8abace2 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/SearchPart.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/SearchPart.java @@ -127,7 +127,7 @@ public class SearchPart extends SWCommand { s = s.replace(ss, "§e§l" + ss + "§7"); } return "§7" + s; - }).build()); + }).setNonCachedBreadcrumbs(true).build()); } @Mapper(value = "searchMapper", local = true) -- 2.39.2