Files
ServerLite/src/main/java/de/npid7/serverlite/TabCompleters/PlaytimeCompleter.java

27 lines
828 B
Java
Raw Normal View History

package de.npid7.serverlite.TabCompleters;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
public class PlaytimeCompleter implements TabCompleter {
@Override
public List<String> onTabComplete(
CommandSender sender, Command command, String alias, String[] args) {
List<String> completions = new ArrayList<>();
if (command.getName().equalsIgnoreCase("playtime")) {
if (sender.hasPermission("d7.d7")) {
for (OfflinePlayer pl : Bukkit.getOfflinePlayers()) {
completions.add(pl.getName());
}
}
}
return completions;
}
}