Update BukkitQuestCommandHandler.java

Added new permission node to hide tab suggestion
This commit is contained in:
Dragsio 2024-02-29 14:41:18 +01:00 committed by GitHub
parent 9a5b5725bb
commit 1ef4ae30ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 8 deletions

View File

@ -80,16 +80,20 @@ public class BukkitQuestCommandHandler {
}
public List<String> suggest(final CommandSender cs, final String[] args) {
if (args.length != 1) {
if (cs.hasPermission("quests.quest.tab")) {
if (args.length != 1) {
return Collections.emptyList();
}
final List<String> results = new ArrayList<>();
for (final Quest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[0].toLowerCase())) {
results.add(ChatColor.stripColor(quest.getName()));
}
}
return results;
} else {
return Collections.emptyList();
}
final List<String> results = new ArrayList<>();
for (final Quest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[0].toLowerCase())) {
results.add(ChatColor.stripColor(quest.getName()));
}
}
return results;
}
private void showQuestDetails(final CommandSender cs, final String[] args) {