Merge pull request 'Update SchematicCommand.schemSearch' (#110) from EvenBetterSearching into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #110 Reviewed-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Commit
a2e5a7b320
@ -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<Enum<?>>) 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++;
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren