mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-09-11 04:39:32 +00:00
Merge remote-tracking branch 'refs/remotes/ProjectKorra/master'
This commit is contained in:
commit
a1b2c1f0ad
|
@ -14,6 +14,7 @@ import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -145,4 +146,41 @@ public class AddCommand extends PKCommand {
|
||||||
public static boolean isVowel(char c) {
|
public static boolean isVowel(char c) {
|
||||||
return "AEIOUaeiou".indexOf(c) != -1;
|
return "AEIOUaeiou".indexOf(c) != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getTabCompletion(CommandSender sender, List<String> args) {
|
||||||
|
if (args.size() >= 2 || !sender.hasPermission("bending.command.add")) return new ArrayList<String>();
|
||||||
|
List<String> l = new ArrayList<String>();
|
||||||
|
if (args.size() == 0) {
|
||||||
|
|
||||||
|
l.add("Air");
|
||||||
|
l.add("Earth");
|
||||||
|
l.add("Fire");
|
||||||
|
l.add("Water");
|
||||||
|
l.add("Chi");
|
||||||
|
for (Element e : Element.getAddonElements()) {
|
||||||
|
l.add(e.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
l.add("Blood");
|
||||||
|
l.add("Combustion");
|
||||||
|
l.add("Flight");
|
||||||
|
l.add("Healing");
|
||||||
|
l.add("Ice");
|
||||||
|
l.add("Lava");
|
||||||
|
l.add("Lightning");
|
||||||
|
l.add("Metal");
|
||||||
|
l.add("Plant");
|
||||||
|
l.add("Sand");
|
||||||
|
l.add("Spiritual");
|
||||||
|
for (SubElement e : Element.getAddonSubElements()) {
|
||||||
|
l.add(e.getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
|
l.add(p.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return l;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,8 @@
|
||||||
package com.projectkorra.projectkorra.command;
|
package com.projectkorra.projectkorra.command;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
|
||||||
import com.projectkorra.projectkorra.Element;
|
|
||||||
import com.projectkorra.projectkorra.Element.SubElement;
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
|
||||||
import com.projectkorra.projectkorra.object.Preset;
|
|
||||||
import com.projectkorra.rpg.commands.RPGCommand;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabCompleter;
|
import org.bukkit.command.TabCompleter;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -25,290 +15,24 @@ import java.util.List;
|
||||||
* @author StrangeOne101
|
* @author StrangeOne101
|
||||||
* */
|
* */
|
||||||
public class BendingTabComplete implements TabCompleter {
|
public class BendingTabComplete implements TabCompleter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
if (args.length == 0 || args[0].equals(""))
|
if (args.length == 0 || args.length == 1)
|
||||||
return getPossibleCompletionsForGivenArgs(args, getCommandsForUser(sender));
|
return getPossibleCompletions(args, getCommandsForUser(sender));
|
||||||
|
else if (args.length > 1){
|
||||||
if (args.length >= 2) {
|
for (PKCommand cmd : PKCommand.instances.values()) {
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(sender.getName());
|
if (Arrays.asList(cmd.getAliases()).contains(args[0].toLowerCase()) && sender.hasPermission("bending.command." + cmd.getName())) {
|
||||||
|
List<String> newargs = new ArrayList<String>();
|
||||||
if (args[0].equalsIgnoreCase("bind") || args[0].equalsIgnoreCase("b")) {
|
for (int i = 1; i < args.length - 1; i++) {
|
||||||
if (args.length > 3 || !sender.hasPermission("bending.command.bind") || !(sender instanceof Player))
|
if (!(args[i].equals("") || args[i].equals(" ")) && args.length >= 1)
|
||||||
return new ArrayList<String>();
|
newargs.add(args[i]);
|
||||||
|
|
||||||
List<String> abilities = new ArrayList<String>();
|
|
||||||
if (args.length == 2) {
|
|
||||||
if (bPlayer != null) {
|
|
||||||
for (CoreAbility coreAbil : CoreAbility.getAbilities()) {
|
|
||||||
if (!coreAbil.isHiddenAbility() && bPlayer.canBind(coreAbil)) {
|
|
||||||
abilities.add(coreAbil.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = 1; i < 10; i++) {
|
|
||||||
abilities.add("" + i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Collections.sort(abilities);
|
|
||||||
return getPossibleCompletionsForGivenArgs(args, abilities);
|
|
||||||
} else if (args[0].equalsIgnoreCase("display") || args[0].equalsIgnoreCase("d")) {
|
|
||||||
if (args.length > 2 || !sender.hasPermission("bending.command.display"))
|
|
||||||
return new ArrayList<String>();
|
|
||||||
List<String> list = new ArrayList<String>();
|
|
||||||
list.add("Air");
|
|
||||||
list.add("Earth");
|
|
||||||
list.add("Fire");
|
|
||||||
list.add("Water");
|
|
||||||
list.add("Chi");
|
|
||||||
list.add("Bloodbending");
|
|
||||||
list.add("Combustion");
|
|
||||||
list.add("Flight");
|
|
||||||
list.add("Healing");
|
|
||||||
list.add("Ice");
|
|
||||||
list.add("Lava");
|
|
||||||
list.add("Lightning");
|
|
||||||
list.add("Metal");
|
|
||||||
list.add("Plantbending");
|
|
||||||
list.add("Sand");
|
|
||||||
list.add("SpiritualProjection");
|
|
||||||
list.add("AirCombos");
|
|
||||||
list.add("EarthCombos");
|
|
||||||
list.add("FireCombos");
|
|
||||||
list.add("WaterCombos");
|
|
||||||
list.add("ChiCombos");
|
|
||||||
list.add("Avatar");
|
|
||||||
for (Element e : Element.getAddonElements()) {
|
|
||||||
list.add(e.getName());
|
|
||||||
}
|
|
||||||
for (SubElement se : Element.getAddonSubElements()) {
|
|
||||||
list.add(se.getName());
|
|
||||||
}
|
|
||||||
return getPossibleCompletionsForGivenArgs(args, list);
|
|
||||||
} else if (args[0].equalsIgnoreCase("add") || args[0].equalsIgnoreCase("a") || args[0].equalsIgnoreCase("choose") || args[0].equalsIgnoreCase("ch")) {
|
|
||||||
if (args.length > 3) return new ArrayList<String>();
|
|
||||||
if ((args[0].equalsIgnoreCase("add") || args[0].equalsIgnoreCase("a")) && !sender.hasPermission("bending.command.add")) return new ArrayList<String>();
|
|
||||||
if ((args[0].equalsIgnoreCase("choose") || args[0].equalsIgnoreCase("ch")) && !sender.hasPermission("bending.command.choose")) return new ArrayList<String>();
|
|
||||||
|
|
||||||
List<String> l = new ArrayList<String>();
|
|
||||||
if (args.length == 2)
|
|
||||||
{
|
|
||||||
l.add("Air");
|
|
||||||
l.add("Earth");
|
|
||||||
l.add("Fire");
|
|
||||||
l.add("Water");
|
|
||||||
l.add("Chi");
|
|
||||||
for (Element e : Element.getAddonElements()) {
|
|
||||||
l.add(e.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("add") || args[0].equalsIgnoreCase("a")) {
|
|
||||||
l.add("Blood");
|
|
||||||
l.add("Combustion");
|
|
||||||
l.add("Flight");
|
|
||||||
l.add("Healing");
|
|
||||||
l.add("Ice");
|
|
||||||
l.add("Lava");
|
|
||||||
l.add("Lightning");
|
|
||||||
l.add("Metal");
|
|
||||||
l.add("Plant");
|
|
||||||
l.add("Sand");
|
|
||||||
l.add("Spiritual");
|
|
||||||
for (SubElement e : Element.getAddonSubElements()) {
|
|
||||||
l.add(e.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
|
||||||
l.add(p.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return getPossibleCompletionsForGivenArgs(args, l);
|
|
||||||
} else if (args[0].equalsIgnoreCase("clear") || args[0].equalsIgnoreCase("cl") || args[0].equalsIgnoreCase("c")) {
|
|
||||||
if (args.length > 2 || !sender.hasPermission("bending.command.clear"))
|
|
||||||
return new ArrayList<String>();
|
|
||||||
List<String> l = new ArrayList<String>();
|
|
||||||
for (int i = 1; i < 10; i++) {
|
|
||||||
l.add("" + i);
|
|
||||||
}
|
|
||||||
return l;
|
|
||||||
} else if (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("h")) {
|
|
||||||
if (args.length > 2 || !sender.hasPermission("bending.command.help"))
|
|
||||||
return new ArrayList<String>();
|
|
||||||
List<String> list = new ArrayList<String>();
|
|
||||||
for (Element e : Element.getElements()) {
|
|
||||||
list.add(e.getName());
|
|
||||||
}
|
|
||||||
List<String> abils = new ArrayList<String>();
|
|
||||||
for (CoreAbility coreAbil : CoreAbility.getAbilities()) {
|
|
||||||
if (bPlayer.canBind(coreAbil) && !coreAbil.getName().toLowerCase().contains("click")) {
|
|
||||||
abils.add(coreAbil.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Collections.sort(abils);
|
|
||||||
list.addAll(abils);
|
|
||||||
return getPossibleCompletionsForGivenArgs(args, list);
|
|
||||||
} else if (args[0].equalsIgnoreCase("permaremove") || args[0].equalsIgnoreCase("pr") || args[0].equalsIgnoreCase("premove") || args[0].equalsIgnoreCase("permremove")) {
|
|
||||||
if (args.length > 2 || !sender.hasPermission("bending.command.permaremove"))
|
|
||||||
return new ArrayList<String>();
|
|
||||||
List<String> players = new ArrayList<String>();
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
|
||||||
players.add(p.getName());
|
|
||||||
}
|
|
||||||
return getPossibleCompletionsForGivenArgs(args, players);
|
|
||||||
} else if (args[0].equalsIgnoreCase("preset") || args[0].equalsIgnoreCase("presets") || args[0].equalsIgnoreCase("pre") || args[0].equalsIgnoreCase("set") || args[0].equalsIgnoreCase("p")) {
|
|
||||||
if (args.length > 4 || !sender.hasPermission("bending.command.preset") || !(sender instanceof Player))
|
|
||||||
return new ArrayList<String>();
|
|
||||||
List<String> l = new ArrayList<String>();
|
|
||||||
if (args.length == 2) {
|
|
||||||
l.add("create");
|
|
||||||
l.add("delete");
|
|
||||||
l.add("list");
|
|
||||||
l.add("bind");
|
|
||||||
return getPossibleCompletionsForGivenArgs(args, l);
|
|
||||||
} else if (args.length == 3 && Arrays.asList(new String[] { "delete", "d", "del", "bind", "b" }).contains(args[1].toLowerCase())) {
|
|
||||||
List<Preset> presets = Preset.presets.get(((Player) sender).getUniqueId());
|
|
||||||
List<String> presetNames = new ArrayList<String>();
|
|
||||||
if (presets != null && presets.size() != 0) {
|
|
||||||
for (Preset preset : presets) {
|
|
||||||
presetNames.add(preset.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (sender.hasPermission("bending.command.preset.bind.external")) {
|
|
||||||
if (Preset.externalPresets.keySet().size() > 0) {
|
|
||||||
for (String externalPreset : Preset.externalPresets.keySet()) {
|
|
||||||
presetNames.add(externalPreset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (presetNames.size() == 0)
|
|
||||||
return new ArrayList<String>();
|
|
||||||
return getPossibleCompletionsForGivenArgs(args, presetNames);
|
|
||||||
} else if (args.length == 4 && Arrays.asList(new String[] {"bind", "b"}).contains(args[1].toLowerCase())) {
|
|
||||||
if (!sender.hasPermission("bending.command.preset.bind.assign") || (Preset.externalPresets.keySet().contains(args[2].toLowerCase())) && !sender.hasPermission("bending.command.preset.bind.external.other")) {
|
|
||||||
return new ArrayList<String>();
|
|
||||||
}
|
|
||||||
List<String> players = new ArrayList<String>();
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
|
||||||
players.add(p.getName());
|
|
||||||
}
|
|
||||||
return getPossibleCompletionsForGivenArgs(args, players);
|
|
||||||
}
|
|
||||||
return new ArrayList<String>();
|
|
||||||
} else if (args[0].equalsIgnoreCase("remove") || args[0].equalsIgnoreCase("rm")) {
|
|
||||||
if (args.length > 3 || !sender.hasPermission("bending.command.remove"))
|
|
||||||
return new ArrayList<String>();
|
|
||||||
List<String> l = new ArrayList<String>();
|
|
||||||
if (args.length == 2) {
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
|
||||||
l.add(p.getName());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
l.add("Air");
|
|
||||||
l.add("Earth");
|
|
||||||
l.add("Fire");
|
|
||||||
l.add("Water");
|
|
||||||
l.add("Chi");
|
|
||||||
for (Element e : Element.getAddonElements()) {
|
|
||||||
l.add(e.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
l.add("Blood");
|
|
||||||
l.add("Combustion");
|
|
||||||
l.add("Flight");
|
|
||||||
l.add("Healing");
|
|
||||||
l.add("Ice");
|
|
||||||
l.add("Lava");
|
|
||||||
l.add("Lightning");
|
|
||||||
l.add("Metal");
|
|
||||||
l.add("Plant");
|
|
||||||
l.add("Sand");
|
|
||||||
l.add("Spiritual");
|
|
||||||
|
|
||||||
for (SubElement e : Element.getAddonSubElements()) {
|
|
||||||
l.add(e.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return getPossibleCompletionsForGivenArgs(args, l);
|
|
||||||
} else if (args[0].equalsIgnoreCase("who") || args[0].equalsIgnoreCase("w")) {
|
|
||||||
if (args.length > 2 || !sender.hasPermission("bending.command.who"))
|
|
||||||
return new ArrayList<String>();
|
|
||||||
List<String> l = new ArrayList<String>();
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
|
||||||
l.add(p.getName());
|
|
||||||
}
|
|
||||||
return getPossibleCompletionsForGivenArgs(args, l);
|
|
||||||
} else if (args[0].equalsIgnoreCase("copy") || args[0].equalsIgnoreCase("co")) {
|
|
||||||
//If they can't use the command, have over 3 args (copy <player> <player>), or if have over 2 args and can't assign to other players
|
|
||||||
if (!sender.hasPermission("bending.command.copy") || args.length > 4 || (args.length > 3 && !sender.hasPermission("bending.command.copy.assign")))
|
|
||||||
return new ArrayList<String>(); //Return nothing
|
|
||||||
List<String> l = new ArrayList<String>();
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
|
||||||
l.add(p.getName());
|
|
||||||
}
|
|
||||||
return getPossibleCompletionsForGivenArgs(args, l);
|
|
||||||
} else if (GeneralMethods.hasRPG()) {
|
|
||||||
if (args[0].equalsIgnoreCase("rpg")) {
|
|
||||||
if (sender.hasPermission("bending.command.rpg") && args.length <= 4) {
|
|
||||||
if (args.length == 2) {
|
|
||||||
List<String> l = new ArrayList<>();
|
|
||||||
l.addAll(RPGCommand.instances.keySet());
|
|
||||||
Collections.sort(l);
|
|
||||||
return getPossibleCompletionsForGivenArgs(args, l);
|
|
||||||
} else if (args.length == 3) {
|
|
||||||
List<String> l = new ArrayList<>();
|
|
||||||
if (Arrays.asList(RPGCommand.instances.get("avatar").getAliases()).contains(args[1].toLowerCase()) && sender.hasPermission("bending.command.rpg.avatar")) {
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
|
||||||
l.add(p.getName());
|
|
||||||
}
|
|
||||||
} else if (Arrays.asList(RPGCommand.instances.get("worldevent").getAliases()).contains(args[1].toLowerCase()) && sender.hasPermission("bending.command.rpg.worldevent")) {
|
|
||||||
l.add("start");
|
|
||||||
l.add("end");
|
|
||||||
l.add("help");
|
|
||||||
l.add("skip");
|
|
||||||
l.add("current");
|
|
||||||
} else if (Arrays.asList(RPGCommand.instances.get("help").getAliases()).contains(args[1].toLowerCase()) && sender.hasPermission("bending.command.rpg.help")) {
|
|
||||||
l.add("lunareclipse");
|
|
||||||
l.add("solareclipse");
|
|
||||||
l.add("sozinscomet");
|
|
||||||
l.add("fullmoon");
|
|
||||||
for (String rpg : RPGCommand.instances.keySet()) {
|
|
||||||
if (!rpg.equalsIgnoreCase("help")) {
|
|
||||||
l.add(rpg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Collections.sort(l);
|
|
||||||
return getPossibleCompletionsForGivenArgs(args, l);
|
|
||||||
} else if (args.length == 4) {
|
|
||||||
List<String> l = new ArrayList<>();
|
|
||||||
String[] start = {"start", "st", "strt", "begin"};
|
|
||||||
if (Arrays.asList(RPGCommand.instances.get("worldevent").getAliases()).contains(args[1].toLowerCase()) && sender.hasPermission("bending.command.rpg.worldevent")) {
|
|
||||||
if (Arrays.asList(start).contains(args[2].toLowerCase())) {
|
|
||||||
l.add("lunareclipse");
|
|
||||||
l.add("solareclipse");
|
|
||||||
l.add("sozinscomet");
|
|
||||||
l.add("fullmoon");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Collections.sort(l);
|
|
||||||
return getPossibleCompletionsForGivenArgs(args, l);
|
|
||||||
}
|
}
|
||||||
|
return getPossibleCompletions(args, cmd.getTabCompletion(sender, newargs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!PKCommand.instances.keySet().contains(args[0].toLowerCase())) {
|
|
||||||
return new ArrayList<String>();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return getPossibleCompletionsForGivenArgs(args, getCommandsForUser(sender));
|
|
||||||
}
|
|
||||||
return new ArrayList<String>();
|
return new ArrayList<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +48,7 @@ public class BendingTabComplete implements TabCompleter {
|
||||||
* @param args Args of the command. Provide all of them.
|
* @param args Args of the command. Provide all of them.
|
||||||
* @param possibilitiesOfCompletion List of things that can be given
|
* @param possibilitiesOfCompletion List of things that can be given
|
||||||
*/
|
*/
|
||||||
public static List<String> getPossibleCompletionsForGivenArgs(String[] args, List<String> possibilitiesOfCompletion) {
|
public static List<String> getPossibleCompletions(String[] args, List<String> possibilitiesOfCompletion) {
|
||||||
String argumentToFindCompletionFor = args[args.length - 1];
|
String argumentToFindCompletionFor = args[args.length - 1];
|
||||||
|
|
||||||
List<String> listOfPossibleCompletions = new ArrayList<String>();
|
List<String> listOfPossibleCompletions = new ArrayList<String>();
|
||||||
|
@ -337,8 +61,8 @@ public class BendingTabComplete implements TabCompleter {
|
||||||
return listOfPossibleCompletions;
|
return listOfPossibleCompletions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> getPossibleCompletionsForGivenArgs(String[] args, String[] possibilitiesOfCompletion) {
|
public static List<String> getPossibleCompletions(String[] args, String[] possibilitiesOfCompletion) {
|
||||||
return getPossibleCompletionsForGivenArgs(args, Arrays.asList(possibilitiesOfCompletion));
|
return getPossibleCompletions(args, Arrays.asList(possibilitiesOfCompletion));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a list of subcommands the sender can use. */
|
/** Returns a list of subcommands the sender can use. */
|
||||||
|
|
|
@ -9,6 +9,9 @@ import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,4 +79,26 @@ public class BindCommand extends PKCommand {
|
||||||
String name = coreAbil != null ? coreAbil.getName() : null;
|
String name = coreAbil != null ? coreAbil.getName() : null;
|
||||||
GeneralMethods.bindAbility((Player) sender, name, slot);
|
GeneralMethods.bindAbility((Player) sender, name, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getTabCompletion(CommandSender sender, List<String> args) {
|
||||||
|
if (args.size() >= 2 || !sender.hasPermission("bending.command.bind") || !(sender instanceof Player)) return new ArrayList<String>();
|
||||||
|
|
||||||
|
List<String> abilities = new ArrayList<String>();
|
||||||
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(sender.getName());
|
||||||
|
if (args.size() == 0) {
|
||||||
|
if (bPlayer != null) {
|
||||||
|
for (CoreAbility coreAbil : CoreAbility.getAbilities()) {
|
||||||
|
if (!coreAbil.isHiddenAbility() && bPlayer.canBind(coreAbil)) {
|
||||||
|
abilities.add(coreAbil.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
abilities = Arrays.asList("123456789".split(""));
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.sort(abilities);
|
||||||
|
return abilities;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -151,4 +152,27 @@ public class ChooseCommand extends PKCommand {
|
||||||
public static boolean isVowel(char c) {
|
public static boolean isVowel(char c) {
|
||||||
return "AEIOUaeiou".indexOf(c) != -1;
|
return "AEIOUaeiou".indexOf(c) != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getTabCompletion(CommandSender sender, List<String> args) {
|
||||||
|
if (args.size() >= 2 || !sender.hasPermission("bending.command.choose")) return new ArrayList<String>();
|
||||||
|
|
||||||
|
List<String> l = new ArrayList<String>();
|
||||||
|
if (args.size() == 0) {
|
||||||
|
|
||||||
|
l.add("Air");
|
||||||
|
l.add("Earth");
|
||||||
|
l.add("Fire");
|
||||||
|
l.add("Water");
|
||||||
|
l.add("Chi");
|
||||||
|
for (Element e : Element.getAddonElements()) {
|
||||||
|
l.add(e.getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
|
l.add(p.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return l;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,4 +73,10 @@ public class ClearCommand extends PKCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getTabCompletion(CommandSender sender, List<String> args) {
|
||||||
|
if (args.size() >= 1 || !sender.hasPermission("bending.command.clear")) return new ArrayList<String>();
|
||||||
|
return Arrays.asList("123456789".split(""));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -111,4 +112,14 @@ public class CopyCommand extends PKCommand {
|
||||||
return boundAll;
|
return boundAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getTabCompletion(CommandSender sender, List<String> args) {
|
||||||
|
if (!sender.hasPermission("bending.command.copy") || args.size() >= 2 || (args.size() >= 1 && !sender.hasPermission("bending.command.copy.assign"))) return new ArrayList<String>(); //Return nothing
|
||||||
|
List<String> l = new ArrayList<String>();
|
||||||
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
|
l.add(p.getName());
|
||||||
|
}
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -213,4 +213,44 @@ public class DisplayCommand extends PKCommand {
|
||||||
sender.sendMessage(i + " - " + coreAbil.getElement().getColor() + ability);
|
sender.sendMessage(i + " - " + coreAbil.getElement().getColor() + ability);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getTabCompletion(CommandSender sender, List<String> args) {
|
||||||
|
if (args.size() >= 1 || !sender.hasPermission("bending.command.display")) return new ArrayList<String>();
|
||||||
|
List<String> list = new ArrayList<String>();
|
||||||
|
list.add("Air");
|
||||||
|
list.add("Earth");
|
||||||
|
list.add("Fire");
|
||||||
|
list.add("Water");
|
||||||
|
list.add("Chi");
|
||||||
|
|
||||||
|
for (Element e : Element.getAddonElements()) {
|
||||||
|
list.add(e.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
list.add("Bloodbending");
|
||||||
|
list.add("Combustion");
|
||||||
|
list.add("Flight");
|
||||||
|
list.add("Healing");
|
||||||
|
list.add("Ice");
|
||||||
|
list.add("Lava");
|
||||||
|
list.add("Lightning");
|
||||||
|
list.add("Metal");
|
||||||
|
list.add("Plantbending");
|
||||||
|
list.add("Sand");
|
||||||
|
list.add("SpiritualProjection");
|
||||||
|
|
||||||
|
for (SubElement se : Element.getAddonSubElements()) {
|
||||||
|
list.add(se.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
list.add("AirCombos");
|
||||||
|
list.add("EarthCombos");
|
||||||
|
list.add("FireCombos");
|
||||||
|
list.add("WaterCombos");
|
||||||
|
list.add("ChiCombos");
|
||||||
|
list.add("Avatar");
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.projectkorra.projectkorra.command;
|
package com.projectkorra.projectkorra.command;
|
||||||
|
|
||||||
import com.projectkorra.items.command.PKICommand;
|
import com.projectkorra.items.command.PKICommand;
|
||||||
|
import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
import com.projectkorra.projectkorra.Element;
|
import com.projectkorra.projectkorra.Element;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.ComboAbility;
|
import com.projectkorra.projectkorra.ability.ComboAbility;
|
||||||
|
@ -11,6 +12,7 @@ import com.projectkorra.rpg.commands.RPGCommand;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
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.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -149,4 +151,23 @@ public class HelpCommand extends PKCommand {
|
||||||
sender.sendMessage(ChatColor.RED + invalidTopic);
|
sender.sendMessage(ChatColor.RED + invalidTopic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getTabCompletion(CommandSender sender, List<String> args) {
|
||||||
|
if (args.size() >= 1 || !sender.hasPermission("bending.command.help")) return new ArrayList<String>();
|
||||||
|
List<String> list = new ArrayList<String>();
|
||||||
|
for (Element e : Element.getAllElements()) {
|
||||||
|
list.add(e.getName());
|
||||||
|
}
|
||||||
|
List<String> abils = new ArrayList<String>();
|
||||||
|
for (CoreAbility coreAbil : CoreAbility.getAbilities()) {
|
||||||
|
if ((!(sender instanceof Player) || BendingPlayer.getBendingPlayer(sender.getName()).canBind(coreAbil)) && !coreAbil.getName().toLowerCase().contains("click")) {
|
||||||
|
abils.add(coreAbil.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.sort(abils);
|
||||||
|
list.addAll(abils);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,4 +247,10 @@ public abstract class PKCommand implements SubCommand {
|
||||||
return strings;
|
return strings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**Gets a list of valid arguments that can be used in tabbing.*/
|
||||||
|
protected List<String> getTabCompletion(CommandSender sender, List<String> args)
|
||||||
|
{
|
||||||
|
return new ArrayList<String>();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,4 +99,14 @@ public class PermaremoveCommand extends PKCommand {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getTabCompletion(CommandSender sender, List<String> args) {
|
||||||
|
if (args.size() >= 1 || !sender.hasPermission("bending.command.permaremove")) return new ArrayList<String>();
|
||||||
|
List<String> players = new ArrayList<String>();
|
||||||
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
|
players.add(p.getName());
|
||||||
|
}
|
||||||
|
return players;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,4 +218,35 @@ public class PresetCommand extends PKCommand {
|
||||||
help(sender, false);
|
help(sender, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getTabCompletion(CommandSender sender, List<String> args) {
|
||||||
|
if (args.size() >= 3 || !sender.hasPermission("bending.command.preset") || !(sender instanceof Player))
|
||||||
|
return new ArrayList<String>();
|
||||||
|
List<String> l = new ArrayList<String>();
|
||||||
|
if (args.size() == 0) {
|
||||||
|
l.add("create");
|
||||||
|
l.add("delete");
|
||||||
|
l.add("list");
|
||||||
|
l.add("bind");
|
||||||
|
return l;
|
||||||
|
} else if (args.size() == 2 && Arrays.asList(new String[] { "delete", "d", "del", "bind", "b" }).contains(args.get(0).toLowerCase())) {
|
||||||
|
List<Preset> presets = Preset.presets.get(((Player) sender).getUniqueId());
|
||||||
|
List<String> presetNames = new ArrayList<String>();
|
||||||
|
if (presets != null && presets.size() != 0) {
|
||||||
|
for (Preset preset : presets) {
|
||||||
|
presetNames.add(preset.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sender.hasPermission("bending.command.preset.bind.external")) {
|
||||||
|
if (Preset.externalPresets.keySet().size() > 0) {
|
||||||
|
for (String externalPreset : Preset.externalPresets.keySet()) {
|
||||||
|
presetNames.add(externalPreset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (presetNames.size() == 0) return new ArrayList<String>();
|
||||||
|
}
|
||||||
|
return l;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -15,6 +15,7 @@ import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -134,4 +135,41 @@ public class RemoveCommand extends PKCommand {
|
||||||
sender.sendMessage(super.noPermissionMessage);
|
sender.sendMessage(super.noPermissionMessage);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getTabCompletion(CommandSender sender, List<String> args) {
|
||||||
|
if (args.size() >= 2 || !sender.hasPermission("bending.command.remove")) return new ArrayList<String>();
|
||||||
|
List<String> l = new ArrayList<String>();
|
||||||
|
if (args.size() == 1) {
|
||||||
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
|
l.add(p.getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
l.add("Air");
|
||||||
|
l.add("Earth");
|
||||||
|
l.add("Fire");
|
||||||
|
l.add("Water");
|
||||||
|
l.add("Chi");
|
||||||
|
for (Element e : Element.getAddonElements()) {
|
||||||
|
l.add(e.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
l.add("Blood");
|
||||||
|
l.add("Combustion");
|
||||||
|
l.add("Flight");
|
||||||
|
l.add("Healing");
|
||||||
|
l.add("Ice");
|
||||||
|
l.add("Lava");
|
||||||
|
l.add("Lightning");
|
||||||
|
l.add("Metal");
|
||||||
|
l.add("Plant");
|
||||||
|
l.add("Sand");
|
||||||
|
l.add("Spiritual");
|
||||||
|
|
||||||
|
for (SubElement e : Element.getAddonSubElements()) {
|
||||||
|
l.add(e.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return l;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@ import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -142,4 +144,24 @@ public class ToggleCommand extends PKCommand {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getTabCompletion(CommandSender sender, List<String> args) {
|
||||||
|
if (args.size() >= 2 || !sender.hasPermission("bending.command.toggle.others")) return new ArrayList<String>();
|
||||||
|
List<String> l = new ArrayList<String>();
|
||||||
|
if (args.size() == 0) {
|
||||||
|
List<String> elements = new ArrayList<String>();
|
||||||
|
for (Element e : Element.getAllElements()) {
|
||||||
|
elements.add(e.getName());
|
||||||
|
}
|
||||||
|
Collections.sort(elements);
|
||||||
|
l.add("All");
|
||||||
|
l.addAll(elements);
|
||||||
|
} else {
|
||||||
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
|
l.add(p.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return l;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,5 +331,16 @@ public class WhoCommand extends PKCommand {
|
||||||
sender.sendMessage(staff.get(uuid.toString()));
|
sender.sendMessage(staff.get(uuid.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getTabCompletion(CommandSender sender, List<String> args) {
|
||||||
|
if (args.size() >= 1 || !sender.hasPermission("bending.command.who")) return new ArrayList<String>();
|
||||||
|
List<String> l = new ArrayList<String>();
|
||||||
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
|
l.add(p.getName());
|
||||||
|
}
|
||||||
|
return l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue