Skip to content

Commit

Permalink
Improve tab completion and name auto-completion for plot trust command
Browse files Browse the repository at this point in the history
Signed-off-by: William <[email protected]>
  • Loading branch information
WiIIiam278 committed Jan 2, 2022
1 parent dad07c2 commit 374afdf
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import me.william278.husktowns.cache.ClaimCache;
import me.william278.husktowns.cache.PlayerCache;
import me.william278.husktowns.chunk.ClaimedChunk;
import me.william278.husktowns.util.NameAutoCompleter;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.command.Command;
Expand Down Expand Up @@ -127,7 +128,7 @@ protected void onCommand(Player player, Command command, String label, String[]
if (args.length == 2) {
final String playerToAdd = args[1];
ClaimedChunk chunk = HuskTowns.getClaimCache().getChunkAt(playerLocation.getChunk().getX(), playerLocation.getChunk().getZ(), player.getWorld().getName());
DataManager.addPlotMember(player, chunk, playerToAdd);
DataManager.addPlotMember(player, chunk, NameAutoCompleter.getAutoCompletedName(playerToAdd));
} else {
MessageManager.sendMessage(player, "error_invalid_syntax", "/plot trust <player>");
}
Expand Down Expand Up @@ -196,10 +197,7 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
case "trust":
case "add":
case "addmember":
final HashSet<String> onlinePlayers = new HashSet<>();
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
onlinePlayers.add(onlinePlayer.getName());
}
final HashSet<String> onlinePlayers = new HashSet<>(HuskTowns.getPlayerList().getPlayers());
if (onlinePlayers.isEmpty()) {
return Collections.emptyList();
}
Expand Down

0 comments on commit 374afdf

Please sign in to comment.