mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-09-11 12:49:32 +00:00
Merge pull request #433 from jedk1/master
Add documentation and update Who command
This commit is contained in:
commit
99a74c6573
|
@ -334,9 +334,22 @@ public class BendingPlayer {
|
|||
return player.hasPermission("bending.air.spiritualprojection");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if a player can use Water Healing.
|
||||
* @return true If player has permission node "bending.water.healing"
|
||||
*/
|
||||
public boolean canWaterHeal() {
|
||||
return player.hasPermission("bending.water.healing");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if a player can bend a specific sub element. Used when checking addon sub elements.
|
||||
* @param sub SubElement to check for.
|
||||
* @return true If the player has permission to bend that subelement.
|
||||
*/
|
||||
public boolean canUseSubElement(SubElement sub) {
|
||||
return player.hasPermission("bending." + sub.getParentElement().getName().toLowerCase() + "." + sub.getName().toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the map of abilities that the {@link BendingPlayer} knows.
|
||||
|
|
|
@ -134,6 +134,10 @@ public class Element {
|
|||
return ALL_ELEMENTS.get(name.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all official and addon elements excluding subelements.
|
||||
* @return Array of all official and addon elements.
|
||||
*/
|
||||
public static Element[] getAllElements() {
|
||||
List<Element> ae = new ArrayList<Element>();
|
||||
ae.addAll(Arrays.asList(getMainElements()));
|
||||
|
@ -145,14 +149,26 @@ public class Element {
|
|||
return ae.toArray(new Element[ae.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all the official elements and subelements.
|
||||
* @return Array of all official elements and subelements.
|
||||
*/
|
||||
public static Element[] getElements() {
|
||||
return ELEMENTS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all the official elements.
|
||||
* @return Array of all official elements.
|
||||
*/
|
||||
public static Element[] getMainElements() {
|
||||
return MAIN_ELEMENTS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all the addon elements.
|
||||
* @return Array of all addon elements.
|
||||
*/
|
||||
public static Element[] getAddonElements() {
|
||||
List<Element> ae = new ArrayList<Element>();
|
||||
for (Element e : getAllElements()) {
|
||||
|
@ -164,6 +180,10 @@ public class Element {
|
|||
return ae.toArray(new Element[ae.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all subelements, official and addon.
|
||||
* @return Array of all the subelements.
|
||||
*/
|
||||
public static SubElement[] getAllSubElements() {
|
||||
List<SubElement> se = new ArrayList<SubElement>();
|
||||
se.addAll(Arrays.asList(getSubElements()));
|
||||
|
@ -175,10 +195,19 @@ public class Element {
|
|||
return se.toArray(new SubElement[se.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return official subelements.
|
||||
* @return Array of official subelements.
|
||||
*/
|
||||
public static SubElement[] getSubElements() {
|
||||
return SUB_ELEMENTS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all subelements belonging to a parent element.
|
||||
* @param element
|
||||
* @return Array of all subelements belonging to a parent element.
|
||||
*/
|
||||
public static SubElement[] getSubElements(Element element) {
|
||||
List<SubElement> se = new ArrayList<SubElement>();
|
||||
for (SubElement sub : getAllSubElements()) {
|
||||
|
@ -189,6 +218,10 @@ public class Element {
|
|||
return se.toArray(new SubElement[se.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all the addon subelements.
|
||||
* @return Array of all addon subelements.
|
||||
*/
|
||||
public static SubElement[] getAddonSubElements() {
|
||||
List<SubElement> ae = new ArrayList<SubElement>();
|
||||
for (SubElement e : getAllSubElements()) {
|
||||
|
@ -199,6 +232,21 @@ public class Element {
|
|||
return ae.toArray(new SubElement[ae.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns array of addon subelements belonging to a parent element.
|
||||
* @param element
|
||||
* @return Array of addon subelements belonging to a parent element.
|
||||
*/
|
||||
public static SubElement[] getAddonSubElements(Element element) {
|
||||
List<SubElement> se = new ArrayList<SubElement>();
|
||||
for (SubElement sub : getAllSubElements()) {
|
||||
if (sub.getParentElement().equals(element) && !Arrays.asList(getSubElements()).contains(sub)) {
|
||||
se.add(sub);
|
||||
}
|
||||
}
|
||||
return se.toArray(new SubElement[se.size()]);
|
||||
}
|
||||
|
||||
public static Element fromString(String element) {
|
||||
if (getElement(element) != null) {
|
||||
return getElement(element);
|
||||
|
|
|
@ -177,11 +177,18 @@ public class WhoCommand extends PKCommand {
|
|||
sender.sendMessage(Element.AIR.getColor() + "" + ChatColor.STRIKETHROUGH + "- Airbender");
|
||||
}
|
||||
|
||||
if (player_ != null && bPlayer.canUseFlight()) {
|
||||
sender.sendMessage(Element.FLIGHT.getColor() + " Can Fly");
|
||||
}
|
||||
if (player_ != null && bPlayer.canUseSpiritualProjection()) {
|
||||
sender.sendMessage(Element.SPIRITUAL.getColor() + " Can use Spiritual Projection");
|
||||
if (player_ != null) {
|
||||
if (bPlayer.canUseFlight()) {
|
||||
sender.sendMessage(Element.FLIGHT.getColor() + " Can Fly");
|
||||
}
|
||||
if (bPlayer.canUseSpiritualProjection()) {
|
||||
sender.sendMessage(Element.SPIRITUAL.getColor() + " Can use Spiritual Projection");
|
||||
}
|
||||
for (SubElement se : Element.getAddonSubElements(Element.AIR)) {
|
||||
if (bPlayer.canUseSubElement(se)) {
|
||||
sender.sendMessage(se.getColor() + " Can " + (!se.getType().equals(ElementType.NO_SUFFIX) ? "" : "use ") + se.getName() + se.getType().getBend());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bPlayer.hasElement(Element.WATER)) {
|
||||
|
@ -191,21 +198,28 @@ public class WhoCommand extends PKCommand {
|
|||
sender.sendMessage(Element.WATER.getColor() + "" + ChatColor.STRIKETHROUGH + "- Waterbender");
|
||||
}
|
||||
|
||||
if (player_ != null && bPlayer.canPlantbend()) {
|
||||
sender.sendMessage(Element.PLANT.getColor() + " Can Plantbend");
|
||||
}
|
||||
if (player_ != null && bPlayer.canBloodbend()) {
|
||||
if (bPlayer.canBloodbendAtAnytime()) {
|
||||
sender.sendMessage(Element.BLOOD.getColor() + " Can Bloodbend anytime, on any day");
|
||||
} else {
|
||||
sender.sendMessage(Element.BLOOD.getColor() + " Can Bloodbend");
|
||||
if (player_ != null) {
|
||||
if (bPlayer.canPlantbend()) {
|
||||
sender.sendMessage(Element.PLANT.getColor() + " Can Plantbend");
|
||||
}
|
||||
if (bPlayer.canBloodbend()) {
|
||||
if (bPlayer.canBloodbendAtAnytime()) {
|
||||
sender.sendMessage(Element.BLOOD.getColor() + " Can Bloodbend anytime, on any day");
|
||||
} else {
|
||||
sender.sendMessage(Element.BLOOD.getColor() + " Can Bloodbend");
|
||||
}
|
||||
}
|
||||
if (bPlayer.canIcebend()) {
|
||||
sender.sendMessage(Element.ICE.getColor() + " Can Icebend");
|
||||
}
|
||||
if (bPlayer.canWaterHeal()) {
|
||||
sender.sendMessage(Element.HEALING.getColor() + " Can Heal");
|
||||
}
|
||||
for (SubElement se : Element.getAddonSubElements(Element.WATER)) {
|
||||
if (bPlayer.canUseSubElement(se)) {
|
||||
sender.sendMessage(se.getColor() + " Can " + (!se.getType().equals(ElementType.NO_SUFFIX) ? "" : "use ") + se.getName() + se.getType().getBend());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (player_ != null && bPlayer.canIcebend()) {
|
||||
sender.sendMessage(Element.ICE.getColor() + " Can Icebend");
|
||||
}
|
||||
if (player_ != null && bPlayer.canWaterHeal()) {
|
||||
sender.sendMessage(Element.HEALING.getColor() + " Can Heal");
|
||||
}
|
||||
}
|
||||
if (bPlayer.hasElement(Element.EARTH)) {
|
||||
|
@ -215,14 +229,21 @@ public class WhoCommand extends PKCommand {
|
|||
sender.sendMessage(Element.EARTH.getColor() + "" + ChatColor.STRIKETHROUGH + "- Earthbender");
|
||||
}
|
||||
|
||||
if (player_ != null && bPlayer.canMetalbend()) {
|
||||
sender.sendMessage(Element.METAL.getColor() + " Can Metalbend");
|
||||
}
|
||||
if (player_ != null && bPlayer.canLavabend()) {
|
||||
sender.sendMessage(Element.LAVA.getColor() + " Can Lavabend");
|
||||
}
|
||||
if (player_ != null && bPlayer.canSandbend()) {
|
||||
sender.sendMessage(Element.SAND.getColor() + " Can Sandbend");
|
||||
if (player_ != null) {
|
||||
if (bPlayer.canMetalbend()) {
|
||||
sender.sendMessage(Element.METAL.getColor() + " Can Metalbend");
|
||||
}
|
||||
if (bPlayer.canLavabend()) {
|
||||
sender.sendMessage(Element.LAVA.getColor() + " Can Lavabend");
|
||||
}
|
||||
if (bPlayer.canSandbend()) {
|
||||
sender.sendMessage(Element.SAND.getColor() + " Can Sandbend");
|
||||
}
|
||||
for (SubElement se : Element.getAddonSubElements(Element.EARTH)) {
|
||||
if (bPlayer.canUseSubElement(se)) {
|
||||
sender.sendMessage(se.getColor() + " Can " + (!se.getType().equals(ElementType.NO_SUFFIX) ? "" : "use ") + se.getName() + se.getType().getBend());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bPlayer.hasElement(Element.FIRE)) {
|
||||
|
@ -232,11 +253,18 @@ public class WhoCommand extends PKCommand {
|
|||
sender.sendMessage(Element.FIRE.getColor() + "" + ChatColor.STRIKETHROUGH + "- Firebender");
|
||||
}
|
||||
|
||||
if (player_ != null && bPlayer.canCombustionbend()) {
|
||||
sender.sendMessage(Element.COMBUSTION.getColor() + " Can Combustionbend");
|
||||
}
|
||||
if (player_ != null && bPlayer.canLightningbend()) {
|
||||
sender.sendMessage(Element.LIGHTNING.getColor() + " Can Lightningbend");
|
||||
if (player_ != null) {
|
||||
if (bPlayer.canCombustionbend()) {
|
||||
sender.sendMessage(Element.COMBUSTION.getColor() + " Can Combustionbend");
|
||||
}
|
||||
if (bPlayer.canLightningbend()) {
|
||||
sender.sendMessage(Element.LIGHTNING.getColor() + " Can Lightningbend");
|
||||
}
|
||||
for (SubElement se : Element.getAddonSubElements(Element.FIRE)) {
|
||||
if (bPlayer.canUseSubElement(se)) {
|
||||
sender.sendMessage(se.getColor() + " Can " + (!se.getType().equals(ElementType.NO_SUFFIX) ? "" : "use ") + se.getName() + se.getType().getBend());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bPlayer.hasElement(Element.CHI)) {
|
||||
|
@ -251,7 +279,7 @@ public class WhoCommand extends PKCommand {
|
|||
sender.sendMessage(element.getColor() + "" + (bPlayer.isElementToggled(element) ? "" : ChatColor.STRIKETHROUGH) + "- " + element.getName() + (element.getType() != null ? element.getType().getBender() : ""));
|
||||
if (player_ != null) {
|
||||
for (SubElement subelement : Element.getSubElements(element)) {
|
||||
if (player_.hasPermission("bending." + element.getName().toLowerCase() + "." + subelement.getName().toLowerCase())) {
|
||||
if (bPlayer.canUseSubElement(subelement)) {
|
||||
sender.sendMessage(subelement.getColor() + " Can " + (!subelement.getType().equals(ElementType.NO_SUFFIX) ? "" : "use ") + subelement.getName() + subelement.getType().getBend());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue