mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 10:36:09 +01:00
Tab complete applicable quests only
This commit is contained in:
parent
684a3ebbdb
commit
2d3592a89c
@ -1595,7 +1595,7 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the player a list of their quests
|
* Show the player a list of their available quests
|
||||||
*
|
*
|
||||||
* @param quester Quester to show the list
|
* @param quester Quester to show the list
|
||||||
* @param page Page to display, with 7 quests per page
|
* @param page Page to display, with 7 quests per page
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package me.blackvein.quests.commands.questadmin.subcommands;
|
package me.blackvein.quests.commands.questadmin.subcommands;
|
||||||
|
|
||||||
|
import me.blackvein.quests.Quester;
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.commands.QuestsSubCommand;
|
import me.blackvein.quests.commands.QuestsSubCommand;
|
||||||
import me.blackvein.quests.player.IQuester;
|
import me.blackvein.quests.player.IQuester;
|
||||||
@ -114,11 +115,23 @@ public class QuestadminFinishCommand extends QuestsSubCommand {
|
|||||||
return null; // Shows online players
|
return null; // Shows online players
|
||||||
} else if (args.length == 3) {
|
} else if (args.length == 3) {
|
||||||
final List<String> results = new ArrayList<>();
|
final List<String> results = new ArrayList<>();
|
||||||
|
final Player player = Bukkit.getPlayer(args[1]);
|
||||||
|
if (player != null) {
|
||||||
|
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||||
|
if (quester != null) {
|
||||||
|
for (final IQuest quest : quester.getCurrentQuests().keySet()) {
|
||||||
|
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
||||||
|
results.add(ChatColor.stripColor(quest.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
for (final IQuest quest : plugin.getLoadedQuests()) {
|
for (final IQuest quest : plugin.getLoadedQuests()) {
|
||||||
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
||||||
results.add(ChatColor.stripColor(quest.getName()));
|
results.add(ChatColor.stripColor(quest.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package me.blackvein.quests.commands.questadmin.subcommands;
|
package me.blackvein.quests.commands.questadmin.subcommands;
|
||||||
|
|
||||||
|
import me.blackvein.quests.Quester;
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.commands.QuestsSubCommand;
|
import me.blackvein.quests.commands.QuestsSubCommand;
|
||||||
import me.blackvein.quests.player.IQuester;
|
import me.blackvein.quests.player.IQuester;
|
||||||
@ -114,11 +115,23 @@ public class QuestadminNextstageCommand extends QuestsSubCommand {
|
|||||||
return null; // Shows online players
|
return null; // Shows online players
|
||||||
} else if (args.length == 3) {
|
} else if (args.length == 3) {
|
||||||
final List<String> results = new ArrayList<>();
|
final List<String> results = new ArrayList<>();
|
||||||
|
final Player player = Bukkit.getPlayer(args[1]);
|
||||||
|
if (player != null) {
|
||||||
|
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||||
|
if (quester != null) {
|
||||||
|
for (final IQuest quest : quester.getCurrentQuests().keySet()) {
|
||||||
|
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
||||||
|
results.add(ChatColor.stripColor(quest.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
for (final IQuest quest : plugin.getLoadedQuests()) {
|
for (final IQuest quest : plugin.getLoadedQuests()) {
|
||||||
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
||||||
results.add(ChatColor.stripColor(quest.getName()));
|
results.add(ChatColor.stripColor(quest.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package me.blackvein.quests.commands.questadmin.subcommands;
|
package me.blackvein.quests.commands.questadmin.subcommands;
|
||||||
|
|
||||||
|
import me.blackvein.quests.Quester;
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.commands.QuestsSubCommand;
|
import me.blackvein.quests.commands.QuestsSubCommand;
|
||||||
import me.blackvein.quests.player.IQuester;
|
import me.blackvein.quests.player.IQuester;
|
||||||
@ -109,11 +110,23 @@ public class QuestadminQuitCommand extends QuestsSubCommand {
|
|||||||
return null; // Shows online players
|
return null; // Shows online players
|
||||||
} else if (args.length == 3) {
|
} else if (args.length == 3) {
|
||||||
final List<String> results = new ArrayList<>();
|
final List<String> results = new ArrayList<>();
|
||||||
|
final Player player = Bukkit.getPlayer(args[1]);
|
||||||
|
if (player != null) {
|
||||||
|
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||||
|
if (quester != null) {
|
||||||
|
for (final IQuest quest : quester.getCurrentQuests().keySet()) {
|
||||||
|
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
||||||
|
results.add(ChatColor.stripColor(quest.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
for (final IQuest quest : plugin.getLoadedQuests()) {
|
for (final IQuest quest : plugin.getLoadedQuests()) {
|
||||||
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
||||||
results.add(ChatColor.stripColor(quest.getName()));
|
results.add(ChatColor.stripColor(quest.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package me.blackvein.quests.commands.questadmin.subcommands;
|
package me.blackvein.quests.commands.questadmin.subcommands;
|
||||||
|
|
||||||
|
import me.blackvein.quests.Quester;
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.commands.QuestsSubCommand;
|
import me.blackvein.quests.commands.QuestsSubCommand;
|
||||||
import me.blackvein.quests.player.IQuester;
|
import me.blackvein.quests.player.IQuester;
|
||||||
@ -21,6 +22,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -89,7 +91,7 @@ public class QuestadminRemoveCommand extends QuestsSubCommand {
|
|||||||
} else {
|
} else {
|
||||||
msg = msg.replace("<player>", ChatColor.GREEN + args[1] + ChatColor.GOLD);
|
msg = msg.replace("<player>", ChatColor.GREEN + args[1] + ChatColor.GOLD);
|
||||||
}
|
}
|
||||||
msg = msg.replace("<quest>", ChatColor.DARK_PURPLE + toRemove.getName() + ChatColor.AQUA);
|
msg = msg.replace("<quest>", ChatColor.DARK_PURPLE + toRemove.getName() + ChatColor.GOLD);
|
||||||
cs.sendMessage(ChatColor.GOLD + msg);
|
cs.sendMessage(ChatColor.GOLD + msg);
|
||||||
cs.sendMessage(ChatColor.DARK_PURPLE + " UUID: " + ChatColor.DARK_AQUA + quester.getUUID().toString());
|
cs.sendMessage(ChatColor.DARK_PURPLE + " UUID: " + ChatColor.DARK_AQUA + quester.getUUID().toString());
|
||||||
quester.hardRemove(toRemove);
|
quester.hardRemove(toRemove);
|
||||||
@ -106,11 +108,23 @@ public class QuestadminRemoveCommand extends QuestsSubCommand {
|
|||||||
return null; // Shows online players
|
return null; // Shows online players
|
||||||
} else if (args.length == 3) {
|
} else if (args.length == 3) {
|
||||||
final List<String> results = new ArrayList<>();
|
final List<String> results = new ArrayList<>();
|
||||||
|
final Player player = Bukkit.getPlayer(args[1]);
|
||||||
|
if (player != null) {
|
||||||
|
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||||
|
if (quester != null) {
|
||||||
|
for (final IQuest quest : quester.getCompletedQuests()) {
|
||||||
|
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
||||||
|
results.add(ChatColor.stripColor(quest.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
for (final IQuest quest : plugin.getLoadedQuests()) {
|
for (final IQuest quest : plugin.getLoadedQuests()) {
|
||||||
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
||||||
results.add(ChatColor.stripColor(quest.getName()));
|
results.add(ChatColor.stripColor(quest.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
package me.blackvein.quests.commands.questadmin.subcommands;
|
package me.blackvein.quests.commands.questadmin.subcommands;
|
||||||
|
|
||||||
import me.blackvein.quests.Quest;
|
import me.blackvein.quests.Quest;
|
||||||
|
import me.blackvein.quests.Quester;
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.commands.QuestsSubCommand;
|
import me.blackvein.quests.commands.QuestsSubCommand;
|
||||||
import me.blackvein.quests.player.IQuester;
|
import me.blackvein.quests.player.IQuester;
|
||||||
@ -22,6 +23,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -134,9 +136,21 @@ public class QuestadminSetstageCommand extends QuestsSubCommand {
|
|||||||
return null; // Shows online players
|
return null; // Shows online players
|
||||||
} else if (args.length == 3) {
|
} else if (args.length == 3) {
|
||||||
final List<String> results = new ArrayList<>();
|
final List<String> results = new ArrayList<>();
|
||||||
|
final Player player = Bukkit.getPlayer(args[1]);
|
||||||
|
if (player != null) {
|
||||||
|
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||||
|
if (quester != null) {
|
||||||
|
for (final IQuest quest : quester.getCurrentQuests().keySet()) {
|
||||||
|
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
||||||
|
results.add(ChatColor.stripColor(quest.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
for (final IQuest quest : plugin.getLoadedQuests()) {
|
for (final IQuest quest : plugin.getLoadedQuests()) {
|
||||||
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
||||||
results.add(quest.getName());
|
results.add(ChatColor.stripColor(quest.getName()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package me.blackvein.quests.commands.quests.subcommands;
|
package me.blackvein.quests.commands.quests.subcommands;
|
||||||
|
|
||||||
|
import me.blackvein.quests.Quester;
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.commands.QuestsSubCommand;
|
import me.blackvein.quests.commands.QuestsSubCommand;
|
||||||
import me.blackvein.quests.player.IQuester;
|
import me.blackvein.quests.player.IQuester;
|
||||||
@ -100,11 +101,22 @@ public class QuestsQuitCommand extends QuestsSubCommand {
|
|||||||
public List<String> tabComplete(CommandSender commandSender, String[] args) {
|
public List<String> tabComplete(CommandSender commandSender, String[] args) {
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
final List<String> results = new ArrayList<>();
|
final List<String> results = new ArrayList<>();
|
||||||
|
if (commandSender instanceof Player) {
|
||||||
|
final Quester quester = plugin.getQuester(((Player) commandSender).getUniqueId());
|
||||||
|
if (quester != null) {
|
||||||
|
for (final IQuest quest : quester.getCurrentQuests().keySet()) {
|
||||||
|
if (quest.getName().toLowerCase().startsWith(args[1].toLowerCase())) {
|
||||||
|
results.add(ChatColor.stripColor(quest.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
for (final IQuest quest : plugin.getLoadedQuests()) {
|
for (final IQuest quest : plugin.getLoadedQuests()) {
|
||||||
if (quest.getName().toLowerCase().startsWith(args[1].toLowerCase())) {
|
if (quest.getName().toLowerCase().startsWith(args[1].toLowerCase())) {
|
||||||
results.add(ChatColor.stripColor(quest.getName()));
|
results.add(ChatColor.stripColor(quest.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
Loading…
Reference in New Issue
Block a user