From 73d492cdf02c5adff52604a466b8450206d9f95a Mon Sep 17 00:00:00 2001 From: Zeanon Date: Fri, 2 Apr 2021 17:13:27 +0200 Subject: [PATCH] updated bau toggle-commands tab completion to tab complete adequately for executing user --- .../bausystem/commands/CommandBau.java | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandBau.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandBau.java index 4bdc212..a02e6bb 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandBau.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandBau.java @@ -27,7 +27,6 @@ import de.steamwar.command.TypeMapper; import de.steamwar.sql.BauweltMember; import de.steamwar.sql.SteamwarUser; import java.util.stream.Collectors; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -51,19 +50,25 @@ public class CommandBau extends SWCommand { @Register("togglebuild") public void toggleBuildCommand(Player p, SteamwarUser user) { - if (!permissionCheck(p)) return; + if (!permissionCheck(p)) { + return; + } onToggleBD(p, user); } @Register("togglewe") public void toggleWECommand(Player p, SteamwarUser user) { - if (!permissionCheck(p)) return; + if (!permissionCheck(p)) { + return; + } onToggleWE(p, user); } @Register("toggleworld") public void toggleWorldCommand(Player p, SteamwarUser user) { - if (!permissionCheck(p)) return; + if (!permissionCheck(p)) { + return; + } onToggleWorld(p, user); } @@ -128,9 +133,15 @@ public class CommandBau extends SWCommand { .filter(u -> u.getUserName().equals(s)) .findFirst() .orElse(null), - s -> BauweltMember.getMembers(BauSystem.getOwnerID()) - .stream() - .map(m -> SteamwarUser.get(m.getMemberID()).getUserName()) - .collect(Collectors.toList())); + (c, s) -> { + if (!(c instanceof Player)) { + return null; + } + Player p = (Player) c; + return BauweltMember.getMembers(SteamwarUser.get(p.getUniqueId()).getId()) + .stream() + .map(m -> SteamwarUser.get(m.getMemberID()).getUserName()) + .collect(Collectors.toList()); + }); } } \ No newline at end of file