|
6 | 6 | import me.william278.husktowns.cache.ClaimCache;
|
7 | 7 | import me.william278.husktowns.cache.PlayerCache;
|
8 | 8 | import me.william278.husktowns.chunk.ClaimedChunk;
|
| 9 | +import me.william278.husktowns.util.NameAutoCompleter; |
9 | 10 | import org.bukkit.Bukkit;
|
10 | 11 | import org.bukkit.Location;
|
11 | 12 | import org.bukkit.command.Command;
|
@@ -127,7 +128,7 @@ protected void onCommand(Player player, Command command, String label, String[]
|
127 | 128 | if (args.length == 2) {
|
128 | 129 | final String playerToAdd = args[1];
|
129 | 130 | ClaimedChunk chunk = HuskTowns.getClaimCache().getChunkAt(playerLocation.getChunk().getX(), playerLocation.getChunk().getZ(), player.getWorld().getName());
|
130 |
| - DataManager.addPlotMember(player, chunk, playerToAdd); |
| 131 | + DataManager.addPlotMember(player, chunk, NameAutoCompleter.getAutoCompletedName(playerToAdd)); |
131 | 132 | } else {
|
132 | 133 | MessageManager.sendMessage(player, "error_invalid_syntax", "/plot trust <player>");
|
133 | 134 | }
|
@@ -196,10 +197,7 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
|
196 | 197 | case "trust":
|
197 | 198 | case "add":
|
198 | 199 | case "addmember":
|
199 |
| - final HashSet<String> onlinePlayers = new HashSet<>(); |
200 |
| - for (Player onlinePlayer : Bukkit.getOnlinePlayers()) { |
201 |
| - onlinePlayers.add(onlinePlayer.getName()); |
202 |
| - } |
| 200 | + final HashSet<String> onlinePlayers = new HashSet<>(HuskTowns.getPlayerList().getPlayers()); |
203 | 201 | if (onlinePlayers.isEmpty()) {
|
204 | 202 | return Collections.emptyList();
|
205 | 203 | }
|
|
0 commit comments