From f16f260c965d2b18776f8d8f624d6e7ad5d94c40 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 4 Feb 2022 09:12:38 +0100 Subject: [PATCH] Update SchematicCommand.schemSearch --- .../commands/SchematicCommand.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index f170b37..67fb20e 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -24,8 +24,8 @@ import de.steamwar.command.SWCommandUtils; import de.steamwar.command.TypeMapper; import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SchematicSelector; -import de.steamwar.schematicsystem.SafeSchematicNode; import de.steamwar.providers.BauServerInfo; +import de.steamwar.schematicsystem.SafeSchematicNode; import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.sql.*; import net.md_5.bungee.api.ChatColor; @@ -57,6 +57,9 @@ public class SchematicCommand extends SWCommand { Class clazz = Material.class; searchMapper.put("-item", SWCommandUtils.createEnumMapper((Class>) clazz)); searchMapper.put("-public", null); + searchMapper.put("-exclude", SWCommandUtils.createMapper(Function.identity(), (commandSender, s) -> Collections.singletonList(s))); + searchMapper.put("-excludeType", SWCommandUtils.createMapper(SchematicType.values().stream().map(SchematicType::name).toArray(String[]::new))); + searchMapper.put("-excludeOwner", SWCommandUtils.createMapper(Function.identity(), (commandSender, s) -> Collections.singletonList(s))); } public SchematicCommand() { @@ -313,6 +316,21 @@ public class SchematicCommand extends SWCommand { return; } predicates.add(node -> node.getOwner() == steamwarUser.getId()); + break; + case "-exclude": + predicates.add(node -> !node.getName().contains(query[finalI + 1])); + break; + case "-excludeType": + predicates.add(node -> !node.getSchemtype().name().equalsIgnoreCase(query[finalI + 1])); + break; + case "-excludeOwner": + SteamwarUser steamwarUser1 = SteamwarUser.get(query[finalI + 1]); + if (steamwarUser1 == null) { + player.sendMessage(SchematicSystem.PREFIX + "§cDer Spieler §e" + query[finalI + 1] + " §cexistiert nicht"); + return; + } + predicates.add(node -> node.getOwner() != steamwarUser1.getId()); + break; } i++; } -- 2.39.2