Fixes bending with weapons (#678)

This commit is contained in:
Christopher Martin 2017-01-05 17:57:39 -08:00 committed by GitHub
parent 4ac9b8fb6e
commit 7a67becb58
2 changed files with 263 additions and 278 deletions

View file

@ -256,6 +256,24 @@ public class BendingPlayer {
return true; return true;
} }
public boolean canCurrentlyBendWithWeapons() {
if (getBoundAbility() != null && player.getInventory().getItemInMainHand() != null) {
boolean hasWeapon = GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType());
boolean noWeaponElement = GeneralMethods.getElementsWithNoWeaponBending().contains(getBoundAbility().getElement());
if (hasWeapon) {
if(noWeaponElement) {
return false;
} else {
return true;
}
}
return true;
}
return false;
}
/** /**
* Checks to see if {@link BendingPlayer} can be slowed. * Checks to see if {@link BendingPlayer} can be slowed.
* *

View file

@ -71,6 +71,7 @@ import org.bukkit.util.Vector;
import com.projectkorra.projectkorra.ability.Ability; import com.projectkorra.projectkorra.ability.Ability;
import com.projectkorra.projectkorra.ability.AddonAbility; import com.projectkorra.projectkorra.ability.AddonAbility;
import com.projectkorra.projectkorra.ability.AirAbility; import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.AvatarAbility;
import com.projectkorra.projectkorra.ability.ChiAbility; import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.EarthAbility;
@ -896,45 +897,26 @@ public class PKListener implements Listener {
if (sourceBPlayer.canBendPassive(Element.CHI)) { if (sourceBPlayer.canBendPassive(Element.CHI)) {
if (e.getCause() == DamageCause.ENTITY_ATTACK && e.getDamage() == 1) { if (e.getCause() == DamageCause.ENTITY_ATTACK && e.getDamage() == 1) {
if (sourceBPlayer.getBoundAbility() instanceof ChiAbility) { if (sourceBPlayer.getBoundAbility() instanceof ChiAbility) {
if (sourceBPlayer.getBoundAbility() != null && sourcePlayer.getInventory().getItemInMainHand() != null && GeneralMethods.isWeapon(sourcePlayer.getInventory().getItemInMainHand().getType()) if (sourceBPlayer.canCurrentlyBendWithWeapons()) {
&& !plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) { if (sourceBPlayer.isElementToggled(Element.CHI) == true) {
return; if (boundAbil.equalsIgnoreCase("Paralyze")) {
} new Paralyze(sourcePlayer, targetPlayer);
if (sourceBPlayer.isElementToggled(Element.CHI) == true) { } else if (boundAbil.equalsIgnoreCase("QuickStrike")) {
if (boundAbil.equalsIgnoreCase("Paralyze")) { new QuickStrike(sourcePlayer, targetPlayer);
new Paralyze(sourcePlayer, targetPlayer); } else if (boundAbil.equalsIgnoreCase("SwiftKick")) {
} else if (boundAbil.equalsIgnoreCase("QuickStrike")) { new SwiftKick(sourcePlayer, targetPlayer);
new QuickStrike(sourcePlayer, targetPlayer); } else if (boundAbil.equalsIgnoreCase("RapidPunch")) {
} else if (boundAbil.equalsIgnoreCase("SwiftKick")) { new RapidPunch(sourcePlayer, targetPlayer);
new SwiftKick(sourcePlayer, targetPlayer); } else {
} if (ChiPassive.willChiBlock(sourcePlayer, targetPlayer)) {
else if (boundAbil.equalsIgnoreCase("RapidPunch")) { ChiPassive.blockChi(targetPlayer);
new RapidPunch(sourcePlayer, targetPlayer); }
}
else {
if (ChiPassive.willChiBlock(sourcePlayer, targetPlayer)) {
ChiPassive.blockChi(targetPlayer);
} }
} }
} }
} }
} }
} }
if (sourceBPlayer.canBendPassive(Element.CHI)) {
if (sourcePlayer.getInventory().getItemInMainHand() != null && GeneralMethods.isWeapon(sourcePlayer.getInventory().getItemInMainHand().getType())
&& !ProjectKorra.plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
return;
}
if (e.getCause() == DamageCause.ENTITY_ATTACK
&& sourceBPlayer.isElementToggled(Element.CHI) == true) {
if (boundAbil.equalsIgnoreCase("Paralyze") && e.getDamage() == 1) {
if (sourcePlayer.getWorld().equals(targetPlayer.getWorld())
&& Math.abs(sourcePlayer.getLocation().distance(targetPlayer.getLocation())) < 3) {
new Paralyze(sourcePlayer, targetPlayer);
}
}
}
}
} }
} }
} }
@ -1025,7 +1007,7 @@ public class PKListener implements Listener {
}.runTaskLater(plugin, 5); }.runTaskLater(plugin, 5);
if (event.getHand() == EquipmentSlot.HAND) { if (event.getHand() == EquipmentSlot.HAND) {
if (bPlayer.getBoundAbility() != null && player.getInventory().getItemInMainHand() != null && !GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) && GeneralMethods.getElementsWithNoWeaponBending().contains(bPlayer.getBoundAbility().getElement())) { if (bPlayer.canCurrentlyBendWithWeapons()) {
if (event.getClickedBlock() != null) { if (event.getClickedBlock() != null) {
ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK_BLOCK); ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK_BLOCK);
} else { } else {
@ -1053,7 +1035,7 @@ public class PKListener implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer.getBoundAbility() != null && player.getInventory().getItemInMainHand() != null && !GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) && GeneralMethods.getElementsWithNoWeaponBending().contains(bPlayer.getBoundAbility().getElement())) { if (bPlayer.canCurrentlyBendWithWeapons()) {
ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK_ENTITY); ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK_ENTITY);
} }
@ -1263,7 +1245,7 @@ public class PKListener implements Listener {
return; return;
} }
if (bPlayer.getBoundAbility() != null && player.getInventory().getItemInMainHand() != null && !GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) && GeneralMethods.getElementsWithNoWeaponBending().contains(bPlayer.getBoundAbility().getElement())) { if (bPlayer.canCurrentlyBendWithWeapons()) {
if (player.isSneaking()) { if (player.isSneaking()) {
ComboManager.addComboAbility(player, ClickType.SHIFT_UP); ComboManager.addComboAbility(player, ClickType.SHIFT_UP);
} else { } else {
@ -1308,126 +1290,118 @@ public class PKListener implements Listener {
return; return;
} }
if (coreAbil instanceof AirAbility && bPlayer.isElementToggled(Element.AIR) == true) { if (coreAbil instanceof AirAbility && bPlayer.isElementToggled(Element.AIR) == true) {
if (player.getInventory().getItemInMainHand() != null && GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) if (bPlayer.canCurrentlyBendWithWeapons()) {
&& !plugin.getConfig().getBoolean("Properties.Air.CanBendWithWeapons")) { if (abil.equalsIgnoreCase("Tornado")) {
return; new Tornado(player);
} } else if (abil.equalsIgnoreCase("AirBlast")) {
if (abil.equalsIgnoreCase("Tornado")) { AirBlast.setOrigin(player);
new Tornado(player); } else if (abil.equalsIgnoreCase("AirBurst")) {
} else if (abil.equalsIgnoreCase("AirBlast")) { new AirBurst(player, false);
AirBlast.setOrigin(player); } else if (abil.equalsIgnoreCase("AirSuction")) {
} else if (abil.equalsIgnoreCase("AirBurst")) { AirSuction.setOrigin(player);
new AirBurst(player, false); } else if (abil.equalsIgnoreCase("AirSwipe")) {
} else if (abil.equalsIgnoreCase("AirSuction")) { new AirSwipe(player, true);
AirSuction.setOrigin(player); } else if (abil.equalsIgnoreCase("AirShield")) {
} else if (abil.equalsIgnoreCase("AirSwipe")) { new AirShield(player);
new AirSwipe(player, true); } else if (abil.equalsIgnoreCase("Suffocate")) {
} else if (abil.equalsIgnoreCase("AirShield")) { new Suffocate(player);
new AirShield(player); } else if (abil.equalsIgnoreCase("Flight")) {
} else if (abil.equalsIgnoreCase("Suffocate")) { if (player.isSneaking() || !bPlayer.canUseFlight()) {
new Suffocate(player); return;
} else if (abil.equalsIgnoreCase("Flight")) { }
if (player.isSneaking() || !bPlayer.canUseFlight()) { new AirFlight(player);
return;
} }
new AirFlight(player);
} }
} }
if (coreAbil instanceof WaterAbility && bPlayer.isElementToggled(Element.WATER) == true) { if (coreAbil instanceof WaterAbility && bPlayer.isElementToggled(Element.WATER) == true) {
if (player.getInventory().getItemInMainHand() != null && GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) if (bPlayer.canCurrentlyBendWithWeapons()) {
&& !plugin.getConfig().getBoolean("Properties.Water.CanBendWithWeapons")) { if (abil.equalsIgnoreCase("Bloodbending")) {
return; new Bloodbending(player);
} } else if (abil.equalsIgnoreCase("IceBlast")) {
if (abil.equalsIgnoreCase("Bloodbending")) { new IceBlast(player);
new Bloodbending(player); } else if (abil.equalsIgnoreCase("IceSpike")) {
} else if (abil.equalsIgnoreCase("IceBlast")) { new IceSpikeBlast(player);
new IceBlast(player); } else if (abil.equalsIgnoreCase("OctopusForm")) {
} else if (abil.equalsIgnoreCase("IceSpike")) { OctopusForm.form(player);
new IceSpikeBlast(player); } else if (abil.equalsIgnoreCase("PhaseChange")) {
} else if (abil.equalsIgnoreCase("OctopusForm")) { if (!CoreAbility.hasAbility(player, PhaseChange.class)) {
OctopusForm.form(player); new PhaseChange(player, PhaseChangeType.MELT);
} else if (abil.equalsIgnoreCase("PhaseChange")) { } else {
if (!CoreAbility.hasAbility(player, PhaseChange.class)) { PhaseChange pc = CoreAbility.getAbility(player, PhaseChange.class);
new PhaseChange(player, PhaseChangeType.MELT); pc.startNewType(PhaseChangeType.MELT);
} else { }
PhaseChange pc = CoreAbility.getAbility(player, PhaseChange.class); } else if (abil.equalsIgnoreCase("WaterManipulation")) {
pc.startNewType(PhaseChangeType.MELT); new WaterManipulation(player);
} else if (abil.equalsIgnoreCase("Surge")) {
SurgeWall.form(player);
} else if (abil.equalsIgnoreCase("Torrent")) {
Torrent.create(player);
} else if (abil.equalsIgnoreCase("WaterArms")) {
new WaterArms(player);
}
if (abil.equalsIgnoreCase("HealingWaters")) {
new HealingWaters(player);
} }
} else if (abil.equalsIgnoreCase("WaterManipulation")) {
new WaterManipulation(player);
} else if (abil.equalsIgnoreCase("Surge")) {
SurgeWall.form(player);
} else if (abil.equalsIgnoreCase("Torrent")) {
Torrent.create(player);
} else if (abil.equalsIgnoreCase("WaterArms")) {
new WaterArms(player);
}
if (abil.equalsIgnoreCase("HealingWaters")) {
new HealingWaters(player);
} }
} }
if (coreAbil instanceof EarthAbility && bPlayer.isElementToggled(Element.EARTH) == true) { if (coreAbil instanceof EarthAbility && bPlayer.isElementToggled(Element.EARTH) == true) {
if (player.getInventory().getItemInMainHand() != null && GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) if (bPlayer.canCurrentlyBendWithWeapons()) {
&& !plugin.getConfig().getBoolean("Properties.Earth.CanBendWithWeapons")) { if (abil.equalsIgnoreCase("EarthBlast")) {
return; new EarthBlast(player);
} } else if (abil.equalsIgnoreCase("EarthArmor")) {
if (abil.equalsIgnoreCase("EarthBlast")) { new EarthArmor(player);
new EarthBlast(player); } else if (abil.equalsIgnoreCase("RaiseEarth")) {
} else if (abil.equalsIgnoreCase("EarthArmor")) { new RaiseEarthWall(player);
new EarthArmor(player); } else if (abil.equalsIgnoreCase("Collapse")) {
} else if (abil.equalsIgnoreCase("RaiseEarth")) { new CollapseWall(player);
new RaiseEarthWall(player); } else if (abil.equalsIgnoreCase("Shockwave")) {
} else if (abil.equalsIgnoreCase("Collapse")) { new Shockwave(player, false);
new CollapseWall(player); } else if (abil.equalsIgnoreCase("EarthTunnel")) {
} else if (abil.equalsIgnoreCase("Shockwave")) { new EarthTunnel(player);
new Shockwave(player, false); } else if (abil.equalsIgnoreCase("Tremorsense")) {
} else if (abil.equalsIgnoreCase("EarthTunnel")) { bPlayer.toggleTremorSense();
new EarthTunnel(player); } else if (abil.equalsIgnoreCase("Extraction")) {
} else if (abil.equalsIgnoreCase("Tremorsense")) { new Extraction(player);
bPlayer.toggleTremorSense(); } else if (abil.equalsIgnoreCase("MetalClips")) {
} else if (abil.equalsIgnoreCase("Extraction")) { MetalClips clips = CoreAbility.getAbility(player, MetalClips.class);
new Extraction(player); if (clips != null) {
} else if (abil.equalsIgnoreCase("MetalClips")) { if (clips.getTargetEntity() == null) {
MetalClips clips = CoreAbility.getAbility(player, MetalClips.class); clips.setMagnetized(true);
if (clips != null) { } else {
if (clips.getTargetEntity() == null) { clips.setControlling(true);
clips.setMagnetized(true); }
} else { } else {
clips.setControlling(true); new MetalClips(player, 1);
} }
} else {
new MetalClips(player, 1);
} }
}
else if (abil.equalsIgnoreCase("LavaFlow")) { else if (abil.equalsIgnoreCase("LavaFlow")) {
new LavaFlow(player, LavaFlow.AbilityType.SHIFT); new LavaFlow(player, LavaFlow.AbilityType.SHIFT);
} else if (abil.equalsIgnoreCase("EarthSmash")) { } else if (abil.equalsIgnoreCase("EarthSmash")) {
new EarthSmash(player, ClickType.SHIFT_DOWN); new EarthSmash(player, ClickType.SHIFT_DOWN);
}
} }
} }
if (coreAbil instanceof FireAbility && bPlayer.isElementToggled(Element.FIRE) == true) { if (coreAbil instanceof FireAbility && bPlayer.isElementToggled(Element.FIRE) == true) {
if (player.getInventory().getItemInMainHand() != null && GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) if (bPlayer.canCurrentlyBendWithWeapons()) {
&& !plugin.getConfig().getBoolean("Properties.Fire.CanBendWithWeapons")) { if (abil.equalsIgnoreCase("Blaze")) {
return; new BlazeRing(player);
} } else if (abil.equalsIgnoreCase("FireBlast")) {
if (abil.equalsIgnoreCase("Blaze")) { new FireBlastCharged(player);
new BlazeRing(player); } else if (abil.equalsIgnoreCase("HeatControl")) {
} else if (abil.equalsIgnoreCase("FireBlast")) { new HeatControl(player, HeatControlType.COOK);
new FireBlastCharged(player); } else if (abil.equalsIgnoreCase("FireBurst")) {
} else if (abil.equalsIgnoreCase("HeatControl")) { new FireBurst(player);
new HeatControl(player, HeatControlType.COOK); } else if (abil.equalsIgnoreCase("FireShield")) {
} else if (abil.equalsIgnoreCase("FireBurst")) { new FireShield(player, true);
new FireBurst(player); } else if (abil.equalsIgnoreCase("Lightning")) {
} else if (abil.equalsIgnoreCase("FireShield")) { new Lightning(player);
new FireShield(player, true); } else if (abil.equalsIgnoreCase("Combustion")) {
} else if (abil.equalsIgnoreCase("Lightning")) { new Combustion(player);
new Lightning(player); }
} else if (abil.equalsIgnoreCase("Combustion")) {
new Combustion(player);
} }
} }
} }
@ -1467,7 +1441,7 @@ public class PKListener implements Listener {
Entity target = GeneralMethods.getTargetedEntity(player, 3); Entity target = GeneralMethods.getTargetedEntity(player, 3);
if(bPlayer.getBoundAbility() != null && player.getInventory().getItemInMainHand() != null && !GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) && GeneralMethods.getElementsWithNoWeaponBending().contains(bPlayer.getBoundAbility().getElement())) { if(bPlayer.canCurrentlyBendWithWeapons()) {
if (target != null && !(target.equals(player)) && target instanceof LivingEntity) { if (target != null && !(target.equals(player)) && target instanceof LivingEntity) {
ComboManager.addComboAbility(player, ClickType.LEFT_CLICK_ENTITY); ComboManager.addComboAbility(player, ClickType.LEFT_CLICK_ENTITY);
@ -1506,168 +1480,161 @@ public class PKListener implements Listener {
} }
if (coreAbil instanceof AirAbility && bPlayer.isElementToggled(Element.AIR) == true) { if (coreAbil instanceof AirAbility && bPlayer.isElementToggled(Element.AIR) == true) {
if (bPlayer.getBoundAbility() != null && player.getInventory().getItemInMainHand() != null && GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) if (bPlayer.canCurrentlyBendWithWeapons()) {
&& !plugin.getConfig().getBoolean("Properties.Air.CanBendWithWeapons")) { if (abil.equalsIgnoreCase("AirBlast")) {
return; new AirBlast(player);
} } else if (abil.equalsIgnoreCase("AirSuction")) {
if (abil.equalsIgnoreCase("AirBlast")) { new AirSuction(player);
new AirBlast(player); } else if (abil.equalsIgnoreCase("AirBurst")) {
} else if (abil.equalsIgnoreCase("AirSuction")) { AirBurst.coneBurst(player);
new AirSuction(player); } else if (abil.equalsIgnoreCase("AirScooter")) {
} else if (abil.equalsIgnoreCase("AirBurst")) { new AirScooter(player);
AirBurst.coneBurst(player); } else if (abil.equalsIgnoreCase("AirSpout")) {
} else if (abil.equalsIgnoreCase("AirScooter")) { new AirSpout(player);
new AirScooter(player); } else if (abil.equalsIgnoreCase("AirSwipe")) {
} else if (abil.equalsIgnoreCase("AirSpout")) { new AirSwipe(player);
new AirSpout(player); } else if (abil.equalsIgnoreCase("Flight")) {
} else if (abil.equalsIgnoreCase("AirSwipe")) { if (!ProjectKorra.plugin.getConfig().getBoolean("Abilities.Air.Flight.HoverEnabled")
new AirSwipe(player); || !bPlayer.canUseFlight()) {
} else if (abil.equalsIgnoreCase("Flight")) { return;
if (!ProjectKorra.plugin.getConfig().getBoolean("Abilities.Air.Flight.HoverEnabled") }
|| !bPlayer.canUseFlight()) {
return;
}
if (AirFlight.isFlying(event.getPlayer())) { if (AirFlight.isFlying(event.getPlayer())) {
if (AirFlight.isHovering(event.getPlayer())) { if (AirFlight.isHovering(event.getPlayer())) {
AirFlight.setHovering(event.getPlayer(), false); AirFlight.setHovering(event.getPlayer(), false);
} else { } else {
AirFlight.setHovering(event.getPlayer(), true); AirFlight.setHovering(event.getPlayer(), true);
}
} }
} }
} }
} }
if (coreAbil instanceof WaterAbility && bPlayer.isElementToggled(Element.WATER) == true) { if (coreAbil instanceof WaterAbility && bPlayer.isElementToggled(Element.WATER) == true) {
if (bPlayer.getBoundAbility() != null && player.getInventory().getItemInMainHand() != null && GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) if (bPlayer.canCurrentlyBendWithWeapons()) {
&& !plugin.getConfig().getBoolean("Properties.Water.CanBendWithWeapons")) { if (abil.equalsIgnoreCase("Bloodbending")) {
return; Bloodbending.launch(player);
} } else if (abil.equalsIgnoreCase("IceBlast")) {
if (abil.equalsIgnoreCase("Bloodbending")) { IceBlast.activate(player);
Bloodbending.launch(player); } else if (abil.equalsIgnoreCase("IceSpike")) {
} else if (abil.equalsIgnoreCase("IceBlast")) { IceSpikeBlast.activate(player);
IceBlast.activate(player); } else if (abil.equalsIgnoreCase("OctopusForm")) {
} else if (abil.equalsIgnoreCase("IceSpike")) { new OctopusForm(player);
IceSpikeBlast.activate(player); } else if (abil.equalsIgnoreCase("PhaseChange")) {
} else if (abil.equalsIgnoreCase("OctopusForm")) { if (!CoreAbility.hasAbility(player, PhaseChange.class)) {
new OctopusForm(player); new PhaseChange(player, PhaseChangeType.FREEZE);
} else if (abil.equalsIgnoreCase("PhaseChange")) { } else {
if (!CoreAbility.hasAbility(player, PhaseChange.class)) { PhaseChange pc = CoreAbility.getAbility(player, PhaseChange.class);
new PhaseChange(player, PhaseChangeType.FREEZE); pc.startNewType(PhaseChangeType.FREEZE);
} else { }
PhaseChange pc = CoreAbility.getAbility(player, PhaseChange.class); } else if (abil.equalsIgnoreCase("PlantArmor")) {
pc.startNewType(PhaseChangeType.FREEZE); new PlantArmor(player);
} else if (abil.equalsIgnoreCase("WaterSpout")) {
new WaterSpout(player);
} else if (abil.equalsIgnoreCase("WaterManipulation")) {
WaterManipulation.moveWater(player);
} else if (abil.equalsIgnoreCase("Surge")) {
new SurgeWall(player);
} else if (abil.equalsIgnoreCase("Torrent")) {
new Torrent(player);
} }
} else if (abil.equalsIgnoreCase("PlantArmor")) {
new PlantArmor(player);
} else if (abil.equalsIgnoreCase("WaterSpout")) {
new WaterSpout(player);
} else if (abil.equalsIgnoreCase("WaterManipulation")) {
WaterManipulation.moveWater(player);
} else if (abil.equalsIgnoreCase("Surge")) {
new SurgeWall(player);
} else if (abil.equalsIgnoreCase("Torrent")) {
new Torrent(player);
} }
} }
if (coreAbil instanceof EarthAbility && bPlayer.isElementToggled(Element.EARTH) == true) { if (coreAbil instanceof EarthAbility && bPlayer.isElementToggled(Element.EARTH) == true) {
if (bPlayer.getBoundAbility() != null && player.getInventory().getItemInMainHand() != null && GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) if (bPlayer.canCurrentlyBendWithWeapons()) {
&& !plugin.getConfig().getBoolean("Properties.Earth.CanBendWithWeapons")) { if (abil.equalsIgnoreCase("Catapult")) {
return; new Catapult(player);
} } else if (abil.equalsIgnoreCase("EarthBlast")) {
if (abil.equalsIgnoreCase("Catapult")) { EarthBlast.throwEarth(player);
new Catapult(player); } else if (abil.equalsIgnoreCase("RaiseEarth")) {
} else if (abil.equalsIgnoreCase("EarthBlast")) { new RaiseEarth(player);
EarthBlast.throwEarth(player); } else if (abil.equalsIgnoreCase("Collapse")) {
} else if (abil.equalsIgnoreCase("RaiseEarth")) { new Collapse(player);
new RaiseEarth(player); } else if (abil.equalsIgnoreCase("Shockwave")) {
} else if (abil.equalsIgnoreCase("Collapse")) { Shockwave.coneShockwave(player);
new Collapse(player); } else if (abil.equalsIgnoreCase("EarthArmor")) {
} else if (abil.equalsIgnoreCase("Shockwave")) { EarthArmor armor = CoreAbility.getAbility(player, EarthArmor.class);
Shockwave.coneShockwave(player); if (armor != null && armor.isFormed()) {
} else if (abil.equalsIgnoreCase("EarthArmor")) { armor.click();
EarthArmor armor = CoreAbility.getAbility(player, EarthArmor.class); }
if (armor != null && armor.isFormed()) { } else if (abil.equalsIgnoreCase("EarthGrab")) {
armor.click(); new EarthGrab(player);
} else if (abil.equalsIgnoreCase("Tremorsense")) {
new Tremorsense(player, true);
} else if (abil.equalsIgnoreCase("MetalClips")) {
MetalClips clips = CoreAbility.getAbility(player, MetalClips.class);
if (clips == null) {
new MetalClips(player, 0);
} else if (clips
.getMetalClipsCount() < (player.hasPermission("bending.ability.MetalClips.4clips") ? 4
: 3)) {
clips.shootMetal();
} else if (clips.getMetalClipsCount() == 4 && clips.isCanUse4Clips()) {
clips.crush();
}
} else if (abil.equalsIgnoreCase("LavaSurge")) {
LavaSurge surge = CoreAbility.getAbility(player, LavaSurge.class);
if (surge != null) {
surge.launch();
}
} else if (abil.equalsIgnoreCase("LavaFlow")) {
new LavaFlow(player, AbilityType.CLICK);
} else if (abil.equalsIgnoreCase("EarthSmash")) {
new EarthSmash(player, ClickType.LEFT_CLICK);
} else if (abil.equalsIgnoreCase("SandSpout")) {
new SandSpout(player);
} }
} else if (abil.equalsIgnoreCase("EarthGrab")) {
new EarthGrab(player);
} else if (abil.equalsIgnoreCase("Tremorsense")) {
new Tremorsense(player, true);
} else if (abil.equalsIgnoreCase("MetalClips")) {
MetalClips clips = CoreAbility.getAbility(player, MetalClips.class);
if (clips == null) {
new MetalClips(player, 0);
} else if (clips.getMetalClipsCount() < (player.hasPermission("bending.ability.MetalClips.4clips")
? 4 : 3)) {
clips.shootMetal();
} else if (clips.getMetalClipsCount() == 4 && clips.isCanUse4Clips()) {
clips.crush();
}
} else if (abil.equalsIgnoreCase("LavaSurge")) {
LavaSurge surge = CoreAbility.getAbility(player, LavaSurge.class);
if (surge != null) {
surge.launch();
}
} else if (abil.equalsIgnoreCase("LavaFlow")) {
new LavaFlow(player, AbilityType.CLICK);
} else if (abil.equalsIgnoreCase("EarthSmash")) {
new EarthSmash(player, ClickType.LEFT_CLICK);
} else if (abil.equalsIgnoreCase("SandSpout")) {
new SandSpout(player);
} }
} }
if (coreAbil instanceof FireAbility && bPlayer.isElementToggled(Element.FIRE) == true) { if (coreAbil instanceof FireAbility && bPlayer.isElementToggled(Element.FIRE) == true) {
if (bPlayer.getBoundAbility() != null && player.getInventory().getItemInMainHand() != null && GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) if (bPlayer.canCurrentlyBendWithWeapons()) {
&& !plugin.getConfig().getBoolean("Properties.Fire.CanBendWithWeapons")) { if (abil.equalsIgnoreCase("Blaze")) {
return; new Blaze(player);
} } else if (abil.equalsIgnoreCase("FireBlast")) {
if (abil.equalsIgnoreCase("Blaze")) { new FireBlast(player);
new Blaze(player); } else if (abil.equalsIgnoreCase("FireJet")) {
} else if (abil.equalsIgnoreCase("FireBlast")) { new FireJet(player);
new FireBlast(player); } else if (abil.equalsIgnoreCase("HeatControl")) {
} else if (abil.equalsIgnoreCase("FireJet")) { new HeatControl(player, HeatControlType.MELT);
new FireJet(player); } else if (abil.equalsIgnoreCase("Illumination")) {
} else if (abil.equalsIgnoreCase("HeatControl")) { if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.Illumination.Passive")) {
new HeatControl(player, HeatControlType.MELT); bPlayer.toggleIllumination();
} else if (abil.equalsIgnoreCase("Illumination")) { } else {
if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.Illumination.Passive")) { new Illumination(player);
bPlayer.toggleIllumination(); }
} else {
new Illumination(player);
}
} else if (abil.equalsIgnoreCase("FireBurst")) { } else if (abil.equalsIgnoreCase("FireBurst")) {
FireBurst.coneBurst(player); FireBurst.coneBurst(player);
} else if (abil.equalsIgnoreCase("FireShield")) { } else if (abil.equalsIgnoreCase("FireShield")) {
new FireShield(player); new FireShield(player);
} else if (abil.equalsIgnoreCase("WallOfFire")) { } else if (abil.equalsIgnoreCase("WallOfFire")) {
new WallOfFire(player); new WallOfFire(player);
} else if (abil.equalsIgnoreCase("Combustion")) { } else if (abil.equalsIgnoreCase("Combustion")) {
Combustion.explode(player); Combustion.explode(player);
}
} }
} }
if (coreAbil instanceof ChiAbility && bPlayer.isElementToggled(Element.CHI) == true) { if (coreAbil instanceof ChiAbility && bPlayer.isElementToggled(Element.CHI) == true) {
if (bPlayer.getBoundAbility() != null && player.getInventory().getItemInMainHand() != null && GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) if (bPlayer.canCurrentlyBendWithWeapons()) {
&& !plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) { if (abil.equalsIgnoreCase("HighJump")) {
return; new HighJump(player);
} } else if (abil.equalsIgnoreCase("Smokescreen")) {
if (abil.equalsIgnoreCase("HighJump")) { new Smokescreen(player);
new HighJump(player); } else if (abil.equalsIgnoreCase("WarriorStance")) {
} else if (abil.equalsIgnoreCase("Smokescreen")) { new WarriorStance(player);
new Smokescreen(player); } else if (abil.equalsIgnoreCase("AcrobatStance")) {
} else if (abil.equalsIgnoreCase("WarriorStance")) { new AcrobatStance(player);
new WarriorStance(player); }
} else if (abil.equalsIgnoreCase("AcrobatStance")) {
new AcrobatStance(player);
} }
} }
if (abil.equalsIgnoreCase("AvatarState")) { if (coreAbil instanceof AvatarAbility) {
new AvatarState(player); if (abil.equalsIgnoreCase("AvatarState")) {
new AvatarState(player);
}
} }
} }