mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 19:50:37 +00:00
commit
a23005546d
7 changed files with 95 additions and 17 deletions
|
@ -30,7 +30,7 @@ public class AddCommand extends PKCommand {
|
|||
if (!hasPermission(sender) || !isPlayer(sender)) {
|
||||
return;
|
||||
}
|
||||
add(sender, (Player) sender, args.get(0));
|
||||
add(sender, (Player) sender, args.get(0).toLowerCase());
|
||||
} else if (args.size() == 2) { //bending add element combo
|
||||
if (!hasPermission(sender, "others")) {
|
||||
return;
|
||||
|
@ -40,7 +40,7 @@ public class AddCommand extends PKCommand {
|
|||
sender.sendMessage(ChatColor.RED + "That player is not online.");
|
||||
return;
|
||||
}
|
||||
add(sender, player, args.get(1));
|
||||
add(sender, player, args.get(1).toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,16 +66,20 @@ public class AddCommand extends PKCommand {
|
|||
Element type = Element.getType(element);
|
||||
bPlayer.addElement(type);
|
||||
ChatColor color = GeneralMethods.getElementColor(type);
|
||||
if (element.charAt(0) == 'w' || element.charAt(0) == 'f' || element.charAt(0) == 'c') {
|
||||
if (element.charAt(0) == 'w' || element.charAt(0) == 'f') {
|
||||
target.sendMessage(color + "You are also a " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||
} else if (element.charAt(0) == 'e' || element.charAt(0) == 'a') {
|
||||
target.sendMessage(color + "You are also an " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||
} else if (element.equalsIgnoreCase("chi")) {
|
||||
target.sendMessage(color + "You are now a Chiblocker.");
|
||||
}
|
||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
||||
if (element.charAt(0) == 'w' || element.charAt(0) == 'f' || element.charAt(0) == 'c') {
|
||||
if (element.charAt(0) == 'w' || element.charAt(0) == 'f') {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is also a " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||
} else if (element.charAt(0) == 'e' || element.charAt(0) == 'a') {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is also an " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||
} else if (element.equalsIgnoreCase("chi")) {
|
||||
target.sendMessage(color + "You are now a Chiblocker.");
|
||||
}
|
||||
}
|
||||
GeneralMethods.saveElements(bPlayer);
|
||||
|
|
|
@ -47,7 +47,7 @@ public class ChooseCommand extends PKCommand {
|
|||
sender.sendMessage(ChatColor.RED + "You don't have permission to do that.");
|
||||
return;
|
||||
}
|
||||
String element = args.get(0);
|
||||
String element = args.get(0).toLowerCase();
|
||||
if (Arrays.asList(Commands.elementaliases).contains(element)) {
|
||||
if (!hasPermission(sender, element)) {
|
||||
return;
|
||||
|
@ -68,7 +68,7 @@ public class ChooseCommand extends PKCommand {
|
|||
sender.sendMessage(ChatColor.RED + "That player is not online.");
|
||||
return;
|
||||
}
|
||||
String element = args.get(0);
|
||||
String element = args.get(0).toLowerCase();
|
||||
if (Arrays.asList(Commands.elementaliases).contains(element)) {
|
||||
add(sender, target, element);
|
||||
return;
|
||||
|
@ -91,16 +91,20 @@ public class ChooseCommand extends PKCommand {
|
|||
BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(target);
|
||||
bPlayer.setElement(e);
|
||||
ChatColor color = GeneralMethods.getElementColor(e);
|
||||
if (element.charAt(0) == 'w' || element.charAt(0) == 'f' || element.charAt(0) == 'c') {
|
||||
if (element.charAt(0) == 'w' || element.charAt(0) == 'f') {
|
||||
target.sendMessage(color + "You are now a " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||
} else if (element.charAt(0) == 'e' || element.charAt(0) == 'a') {
|
||||
target.sendMessage(color + "You are now an " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||
} else if (element.equalsIgnoreCase("chi")) {
|
||||
target.sendMessage(color + "You are now a Chiblocker.");
|
||||
}
|
||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
||||
if (element.charAt(0) == 'w' || element.charAt(0) == 'f' || element.charAt(0) == 'c') {
|
||||
if (element.charAt(0) == 'w' || element.charAt(0) == 'f') {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is now a " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||
} else if (element.charAt(0) == 'e' || element.charAt(0) == 'a') {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is now an " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||
} else if (element.equalsIgnoreCase("chi")) {
|
||||
target.sendMessage(color + "You are now a Chiblocker.");
|
||||
}
|
||||
}
|
||||
GeneralMethods.removeUnusableAbilities(target.getName());
|
||||
|
|
|
@ -71,6 +71,9 @@ public class Commands {
|
|||
//Firebending
|
||||
public static String[] combustionaliases = { "combustionbending", "combustion", "cb" };
|
||||
public static String[] lightningaliases = { "lightningbending", "lightning" };
|
||||
|
||||
//Miscellaneous
|
||||
public static String[] commandaliases = { "b", "pk", "bending", "mtla", "tla", "korra", "bend" };
|
||||
|
||||
private void init() {
|
||||
PluginCommand projectkorra = plugin.getCommand("projectkorra");
|
||||
|
@ -105,7 +108,7 @@ public class Commands {
|
|||
args[i] = args[i];
|
||||
}
|
||||
|
||||
if (args.length == 0) {
|
||||
if (args.length == 0 && Arrays.asList(commandaliases).contains(label.toLowerCase())) {
|
||||
s.sendMessage(ChatColor.RED + "/bending help [Ability/Command] " + ChatColor.YELLOW + "Display help.");
|
||||
s.sendMessage(ChatColor.RED + "/bending choose [Element] " + ChatColor.YELLOW + "Choose an element.");
|
||||
s.sendMessage(ChatColor.RED + "/bending bind [Ability] # " + ChatColor.YELLOW + "Bind an ability.");
|
||||
|
@ -114,7 +117,7 @@ public class Commands {
|
|||
|
||||
List<String> sendingArgs = Arrays.asList(args).subList(1, args.length);
|
||||
for (PKCommand command : PKCommand.instances.values()) {
|
||||
if (Arrays.asList(command.getAliases()).contains(args[0])) {
|
||||
if (Arrays.asList(command.getAliases()).contains(args[0].toLowerCase())) {
|
||||
command.execute(s, sendingArgs);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.BendingPlayer;
|
|||
import com.projectkorra.projectkorra.Element;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.SubElement;
|
||||
import com.projectkorra.projectkorra.ability.combo.ComboManager;
|
||||
import com.projectkorra.projectkorra.airbending.AirMethods;
|
||||
import com.projectkorra.projectkorra.chiblocking.ChiMethods;
|
||||
|
@ -37,7 +38,7 @@ public class DisplayCommand extends PKCommand {
|
|||
|
||||
//bending display [Element]
|
||||
if (args.size() == 1) {
|
||||
String element = args.get(0);
|
||||
String element = args.get(0).toLowerCase();
|
||||
//combos
|
||||
if (Arrays.asList(Commands.comboaliases).contains(element)) {
|
||||
element = getElement(element);
|
||||
|
@ -68,7 +69,19 @@ public class DisplayCommand extends PKCommand {
|
|||
}
|
||||
|
||||
else {
|
||||
sender.sendMessage(ChatColor.RED + "Not a valid Element." + ChatColor.WHITE + " Elements: " + AirMethods.getAirColor() + "Air" + ChatColor.WHITE + " | " + WaterMethods.getWaterColor() + "Water" + ChatColor.WHITE + " | " + EarthMethods.getEarthColor() + "Earth" + ChatColor.WHITE + " | " + FireMethods.getFireColor() + "Fire" + ChatColor.WHITE + " | " + ChiMethods.getChiColor() + "Chi");
|
||||
ChatColor w = ChatColor.WHITE;
|
||||
sender.sendMessage(ChatColor.RED + "Not a valid argument." + ChatColor.WHITE + "\nElements: " + AirMethods.getAirColor() + "Air" + ChatColor.WHITE + " | " + WaterMethods.getWaterColor() + "Water" + ChatColor.WHITE + " | " + EarthMethods.getEarthColor() + "Earth" + ChatColor.WHITE + " | " + FireMethods.getFireColor() + "Fire" + ChatColor.WHITE + " | " + ChiMethods.getChiColor() + "Chi");
|
||||
sender.sendMessage(w + "SubElements: "
|
||||
+ w + "\n-" + GeneralMethods.getSubBendingColor(Element.Air) + " Flight"
|
||||
+ w + "\n-" + GeneralMethods.getSubBendingColor(Element.Earth) + " Lavabending"
|
||||
+ w + "\n-" + GeneralMethods.getSubBendingColor(Element.Earth) + " Metalbending"
|
||||
+ w + "\n-" + GeneralMethods.getSubBendingColor(Element.Earth) + " Sandbending"
|
||||
+ w + "\n-" + GeneralMethods.getSubBendingColor(Element.Fire) + " Combustion"
|
||||
+ w + "\n-" + GeneralMethods.getSubBendingColor(Element.Fire) + " Lightning"
|
||||
+ w + "\n-" + GeneralMethods.getSubBendingColor(Element.Water) + " Bloodbending"
|
||||
+ w + "\n-" + GeneralMethods.getSubBendingColor(Element.Water) + " Healing"
|
||||
+ w + "\n-" + GeneralMethods.getSubBendingColor(Element.Water) + " Icebending"
|
||||
+ w + "\n-" + GeneralMethods.getSubBendingColor(Element.Water) + " Plantbending");
|
||||
}
|
||||
}
|
||||
if (args.size() == 0) {
|
||||
|
@ -93,7 +106,7 @@ public class DisplayCommand extends PKCommand {
|
|||
sender.sendMessage(ChatColor.RED + "You must select a valid element.");
|
||||
return;
|
||||
} else if (abilities.isEmpty()) {
|
||||
sender.sendMessage(ChatColor.RED + "There are no " + element + " abilities enabled on the server.");
|
||||
sender.sendMessage(ChatColor.YELLOW + "There are no " + GeneralMethods.getElementColor(Element.valueOf(element)) + element + ChatColor.YELLOW + " abilities enabled on the server.");
|
||||
}
|
||||
for (String ability : abilities) {
|
||||
if (GeneralMethods.isSubAbility(ability))
|
||||
|
@ -102,6 +115,54 @@ public class DisplayCommand extends PKCommand {
|
|||
sender.sendMessage(GeneralMethods.getElementColor(Element.getType(element)) + ability);
|
||||
}
|
||||
}
|
||||
if (element.equalsIgnoreCase("earth")) {
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "Combos:" + ChatColor.GREEN + "/bending display earthcombo");
|
||||
if (sender.hasPermission("bending.earth.lavabending")) {
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "Lavabending abilities: " + ChatColor.GREEN + "/bending display lavabending");
|
||||
}
|
||||
if (sender.hasPermission("bending.earth.metalbending")) {
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "Metalbending abilities: " + ChatColor.GREEN + "/bending display metalbending");
|
||||
}
|
||||
if (sender.hasPermission("bending.earth.sandbending")) {
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "Sandbending abilities: " + ChatColor.GREEN + "/bending display sandbending");
|
||||
}
|
||||
}
|
||||
if (element.equalsIgnoreCase("air")) {
|
||||
sender.sendMessage(ChatColor.DARK_GRAY + "Combos:" + ChatColor.GRAY + "/bending display aircombo");
|
||||
if (sender.hasPermission("bending.air.flight")) {
|
||||
sender.sendMessage(ChatColor.DARK_GRAY + "Flight abilities: " + ChatColor.GRAY + "/bending display flight");
|
||||
}
|
||||
//if (sender.hasPermission("bending.air.spiritualprojection")) {
|
||||
// sender.sendMessage(ChatColor.DARK_GRAY + "SpiritualProjection abilities: " + ChatColor.GRAY + "/bending display spiritualprojection");
|
||||
//}
|
||||
}
|
||||
if (element.equalsIgnoreCase("fire")) {
|
||||
sender.sendMessage(ChatColor.DARK_RED + "Combos:" + ChatColor.RED + "/bending display firecombo");
|
||||
if (sender.hasPermission("bending.fire.lightningbending")) {
|
||||
sender.sendMessage(ChatColor.DARK_RED + "Lightning abilities: " + ChatColor.RED + "/bending display lightning");
|
||||
}
|
||||
if (sender.hasPermission("bending.fire.combustionbending")) {
|
||||
sender.sendMessage(ChatColor.DARK_RED + "Combustion abilities: " + ChatColor.RED + "/bending display combustion");
|
||||
}
|
||||
}
|
||||
if (element.equalsIgnoreCase("water")) {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + "Combos:" + ChatColor.AQUA + "/bending display watercombo");
|
||||
if (sender.hasPermission("bending.water.bloodbending")) {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + "Bloodbending abilities: " + ChatColor.AQUA + "/bending display bloodbending");
|
||||
}
|
||||
if (sender.hasPermission("bending.water.healing")) {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + "Healing abilities: " + ChatColor.AQUA + "/bending display healing");
|
||||
}
|
||||
if (sender.hasPermission("bending.water.icebending")) {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + "Icebending abilities: " + ChatColor.AQUA + "/bending display icebending");
|
||||
}
|
||||
if (sender.hasPermission("bending.water.plantbending")) {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + "Plantbending abilities: " + ChatColor.AQUA + "/bending display plantbending");
|
||||
}
|
||||
}
|
||||
if (element.equalsIgnoreCase("chi")) {
|
||||
sender.sendMessage(ChatColor.GOLD + "Combos: " + ChatColor.YELLOW + "/bending display chicombo");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,9 +173,15 @@ public class DisplayCommand extends PKCommand {
|
|||
*/
|
||||
private void displaySubElement(CommandSender sender, String element) {
|
||||
List<String> abilities = ProjectKorra.plugin.abManager.getAbilities(element);
|
||||
if (abilities.isEmpty()) {
|
||||
Element e = SubElement.getType(element.toLowerCase()).getMainElement();
|
||||
ChatColor color = GeneralMethods.getSubBendingColor(e);
|
||||
sender.sendMessage(ChatColor.YELLOW + "There are no " + color + element + ChatColor.YELLOW + " abilities installed!");
|
||||
return;
|
||||
}
|
||||
for (String ability : abilities) {
|
||||
if (!(sender instanceof Player) || GeneralMethods.canView((Player) sender, ability)) {
|
||||
sender.sendMessage(GeneralMethods.getSubBendingColor(Element.getType(getElement(getElement(element)))) + ability);
|
||||
sender.sendMessage(GeneralMethods.getSubBendingColor(Element.getType(getElement(element))) + ability);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class HelpCommand extends PKCommand {
|
|||
|
||||
String arg = args.get(0);
|
||||
|
||||
if (instances.keySet().contains(arg)) {//bending help command
|
||||
if (instances.keySet().contains(arg.toLowerCase())) {//bending help command
|
||||
instances.get(arg).help(sender, true);
|
||||
} else if (Arrays.asList(Commands.comboaliases).contains(arg)) { //bending help elementcombo
|
||||
sender.sendMessage(ChatColor.GOLD + "Proper Usage: " + ChatColor.RED + "/bending display " + arg + ChatColor.GOLD + " or " + ChatColor.RED + "/bending help <comboname>");
|
||||
|
|
|
@ -60,10 +60,10 @@ public class PermaremoveCommand extends PKCommand {
|
|||
sender.sendMessage(ChatColor.GREEN + "You have restored the bending of: " + ChatColor.DARK_AQUA + player.getName());
|
||||
} else {
|
||||
bPlayer.getElements().clear();
|
||||
GeneralMethods.removeUnusableAbilities(player.getName());
|
||||
GeneralMethods.saveElements(bPlayer);
|
||||
bPlayer.setPermaRemoved(true);
|
||||
GeneralMethods.savePermaRemoved(bPlayer);
|
||||
GeneralMethods.removeUnusableAbilities(player.getName());
|
||||
player.sendMessage(ChatColor.RED + "Your bending has been permanently removed.");
|
||||
if (!(sender instanceof Player) || sender.getName().equals(target))
|
||||
sender.sendMessage(ChatColor.RED + "You have permenantly removed the bending of: " + ChatColor.DARK_AQUA + player.getName());
|
||||
|
|
|
@ -38,9 +38,9 @@ public class RemoveCommand extends PKCommand {
|
|||
GeneralMethods.createBendingPlayer(player.getUniqueId(), player.getName());
|
||||
bPlayer = GeneralMethods.getBendingPlayer(player);
|
||||
}
|
||||
GeneralMethods.removeUnusableAbilities(player.getName());
|
||||
bPlayer.getElements().clear();
|
||||
GeneralMethods.saveElements(bPlayer);
|
||||
GeneralMethods.removeUnusableAbilities(player.getName());
|
||||
sender.sendMessage(ChatColor.GREEN + "You have removed the bending of " + ChatColor.DARK_AQUA + player.getName());
|
||||
player.sendMessage(ChatColor.GREEN + "Your bending has been removed by " + ChatColor.DARK_AQUA + sender.getName());
|
||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, null, Result.REMOVE));
|
||||
|
|
Loading…
Reference in a new issue