Bug Fixes (#664)

* Fixes AirScooter Speed Glitch

Fixes being able to autorun with AirScooter (CTRL) to go insanely fast

* Adds golden tools

Fixes an issue that didn’t include golden tools in CanBendWithWeapons.

* Adds cooldown to QuickStrike, fixes QuickStrike and SwiftKick not activating

* Fixes HighJump cooldown activating when the ability hasn't worked

* Fixes SwiftKick and QuickStrike not working properly and RapidPunch not working half the time

* Fixes FireWheel and AirSwipe being stopped by snow on the ground

* Makes QuickStrike do one heart
This commit is contained in:
Loony 2016-12-27 06:26:06 +00:00 committed by Christopher Martin
parent 45d2230376
commit 9d15d8b122
9 changed files with 340 additions and 301 deletions

View file

@ -1413,7 +1413,7 @@ public class GeneralMethods {
} }
public static boolean isWeapon(Material mat) { public static boolean isWeapon(Material mat) {
return mat != null && (mat == Material.WOOD_AXE || mat == Material.WOOD_PICKAXE || mat == Material.WOOD_SPADE || mat == Material.WOOD_SWORD || mat == Material.STONE_AXE || mat == Material.STONE_PICKAXE || mat == Material.STONE_SPADE || mat == Material.STONE_SWORD || mat == Material.IRON_AXE || mat == Material.IRON_PICKAXE || mat == Material.IRON_SWORD || mat == Material.IRON_SPADE || mat == Material.DIAMOND_AXE || mat == Material.DIAMOND_PICKAXE || mat == Material.DIAMOND_SWORD || mat == Material.DIAMOND_SPADE); return mat != null && (mat == Material.WOOD_AXE || mat == Material.WOOD_PICKAXE || mat == Material.WOOD_SPADE || mat == Material.WOOD_SWORD || mat == Material.STONE_AXE || mat == Material.STONE_PICKAXE || mat == Material.STONE_SPADE || mat == Material.STONE_SWORD || mat == Material.IRON_AXE || mat == Material.IRON_PICKAXE || mat == Material.IRON_SWORD || mat == Material.IRON_SPADE || mat == Material.DIAMOND_AXE || mat == Material.DIAMOND_PICKAXE || mat == Material.DIAMOND_SWORD || mat == Material.DIAMOND_SPADE || mat == Material.GOLD_AXE || mat == Material.GOLD_HOE || mat == Material.GOLD_SWORD || mat == Material.GOLD_PICKAXE || mat == Material.GOLD_SPADE);
} }
public static void loadBendingPlayer(BendingPlayer pl) { public static void loadBendingPlayer(BendingPlayer pl) {

View file

@ -174,9 +174,22 @@ public class PKListener implements Listener {
ProjectKorra plugin; ProjectKorra plugin;
private static final HashMap<Player, String> BENDING_PLAYER_DEATH = new HashMap<>(); // Player killed by Bending private static final HashMap<Player, String> BENDING_PLAYER_DEATH = new HashMap<>(); // Player
private static final List<UUID> RIGHT_CLICK_INTERACT = new ArrayList<UUID>(); // Player right click block // killed
private static final ArrayList<UUID> TOGGLED_OUT = new ArrayList<>(); // Stands for toggled = false while logging out // by
// Bending
private static final List<UUID> RIGHT_CLICK_INTERACT = new ArrayList<UUID>(); // Player
// right
// click
// block
private static final ArrayList<UUID> TOGGLED_OUT = new ArrayList<>(); // Stands
// for
// toggled
// =
// false
// while
// logging
// out
private static final Map<Player, Integer> JUMPS = new HashMap<>(); private static final Map<Player, Integer> JUMPS = new HashMap<>();
public PKListener(ProjectKorra plugin) { public PKListener(ProjectKorra plugin) {
@ -191,7 +204,8 @@ public class PKListener implements Listener {
Block block = event.getBlock(); Block block = event.getBlock();
Player player = event.getPlayer(); Player player = event.getPlayer();
if (SurgeWall.wasBrokenFor(player, block) || OctopusForm.wasBrokenFor(player, block) || Torrent.wasBrokenFor(player, block) || WaterSpoutWave.wasBrokenFor(player, block)) { if (SurgeWall.wasBrokenFor(player, block) || OctopusForm.wasBrokenFor(player, block)
|| Torrent.wasBrokenFor(player, block) || WaterSpoutWave.wasBrokenFor(player, block)) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
@ -304,13 +318,19 @@ public class PKListener implements Listener {
Block block = event.getBlock(); Block block = event.getBlock();
if (!WaterManipulation.canPhysicsChange(block) || !EarthPassive.canPhysicsChange(block) || Illumination.getBlocks().containsKey(block) || EarthAbility.getPreventPhysicsBlocks().contains(block)) { if (!WaterManipulation.canPhysicsChange(block) || !EarthPassive.canPhysicsChange(block)
|| Illumination.getBlocks().containsKey(block)
|| EarthAbility.getPreventPhysicsBlocks().contains(block)) {
event.setCancelled(true); event.setCancelled(true);
} }
//If there is a TempBlock of Air bellow FallingSand blocks, prevent it from updating. // If there is a TempBlock of Air bellow FallingSand blocks, prevent it
if (!event.isCancelled() && (block.getType() == Material.SAND || block.getType() == Material.GRAVEL || block.getType() == Material.ANVIL) // from updating.
&& TempBlock.isTempBlock(block.getRelative(BlockFace.DOWN)) && block.getRelative(BlockFace.DOWN).getType() == Material.AIR) { if (!event.isCancelled()
&& (block.getType() == Material.SAND || block.getType() == Material.GRAVEL
|| block.getType() == Material.ANVIL)
&& TempBlock.isTempBlock(block.getRelative(BlockFace.DOWN))
&& block.getRelative(BlockFace.DOWN).getType() == Material.AIR) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -321,8 +341,8 @@ public class PKListener implements Listener {
return; return;
} }
Player player = event.getPlayer(); Player player = event.getPlayer();
if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbent(player)
|| Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) { || Suffocate.isBreathbent(player)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -345,7 +365,8 @@ public class PKListener implements Listener {
} else if (element != null) { } else if (element != null) {
prefix = element.getPrefix(); prefix = element.getPrefix();
} else { } else {
prefix = ChatColor.WHITE + ChatColor.translateAlternateColorCodes('&', ConfigManager.languageConfig.get().getString("Chat.Prefixes.Nonbender")) + " "; prefix = ChatColor.WHITE + ChatColor.translateAlternateColorCodes('&',
ConfigManager.languageConfig.get().getString("Chat.Prefixes.Nonbender")) + " ";
} }
player.setDisplayName(player.getName()); player.setDisplayName(player.getName());
player.setDisplayName(prefix + ChatColor.RESET + player.getDisplayName()); player.setDisplayName(prefix + ChatColor.RESET + player.getDisplayName());
@ -365,7 +386,8 @@ public class PKListener implements Listener {
} }
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) { if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbent(entity)
|| Suffocate.isBreathbent(entity)) {
event.setCancelled(true); event.setCancelled(true);
} }
@ -398,7 +420,8 @@ public class PKListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityDamageByBlock(EntityDamageByBlockEvent event) { public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
Block block = event.getDamager(); Block block = event.getDamager();
if (block == null) return; if (block == null)
return;
if (TempBlock.isTempBlock(block)) { if (TempBlock.isTempBlock(block)) {
if (EarthAbility.isEarthbendable(block.getType()) && GeneralMethods.isSolid(block)) { if (EarthAbility.isEarthbendable(block.getType()) && GeneralMethods.isSolid(block)) {
@ -416,7 +439,8 @@ public class PKListener implements Listener {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (event.getCause() == DamageCause.FIRE && BlazeArc.getIgnitedBlocks().containsKey(entity.getLocation().getBlock())) { if (event.getCause() == DamageCause.FIRE
&& BlazeArc.getIgnitedBlocks().containsKey(entity.getLocation().getBlock())) {
new FireDamageTimer(entity, BlazeArc.getIgnitedBlocks().get(entity.getLocation().getBlock())); new FireDamageTimer(entity, BlazeArc.getIgnitedBlocks().get(entity.getLocation().getBlock()));
} }
@ -456,8 +480,7 @@ public class PKListener implements Listener {
armor.revert(); armor.revert();
} }
for (FireCombo fc : CoreAbility.getAbilities(event.getEntity().getKiller(), FireCombo.class)) {
for (FireCombo fc : CoreAbility.getAbilities(event.getEntity().getKiller(), FireCombo.class)) {
if (!fc.getAffectedEntities().contains(event.getEntity())) if (!fc.getAffectedEntities().contains(event.getEntity()))
continue; continue;
List<ItemStack> drops = event.getDrops(); List<ItemStack> drops = event.getDrops();
@ -466,31 +489,31 @@ public class PKListener implements Listener {
ItemStack cooked = drops.get(i); ItemStack cooked = drops.get(i);
Material material = drops.get(i).getType(); Material material = drops.get(i).getType();
switch (material) { switch (material) {
case RAW_BEEF: case RAW_BEEF:
cooked = new ItemStack(Material.COOKED_BEEF, 1); cooked = new ItemStack(Material.COOKED_BEEF, 1);
break; break;
case RAW_FISH: case RAW_FISH:
ItemStack salmon = new ItemStack(Material.RAW_FISH, 1, (short) 1); ItemStack salmon = new ItemStack(Material.RAW_FISH, 1, (short) 1);
if (drops.get(i).getDurability() == salmon.getDurability()) { if (drops.get(i).getDurability() == salmon.getDurability()) {
cooked = new ItemStack(Material.COOKED_FISH, 1, (short) 1); cooked = new ItemStack(Material.COOKED_FISH, 1, (short) 1);
} else { } else {
cooked = new ItemStack(Material.COOKED_FISH, 1); cooked = new ItemStack(Material.COOKED_FISH, 1);
} }
break; break;
case RAW_CHICKEN: case RAW_CHICKEN:
cooked = new ItemStack(Material.COOKED_CHICKEN, 1); cooked = new ItemStack(Material.COOKED_CHICKEN, 1);
break; break;
case PORK: case PORK:
cooked = new ItemStack(Material.GRILLED_PORK, 1); cooked = new ItemStack(Material.GRILLED_PORK, 1);
break; break;
case MUTTON: case MUTTON:
cooked = new ItemStack(Material.COOKED_MUTTON); cooked = new ItemStack(Material.COOKED_MUTTON);
break; break;
case RABBIT: case RABBIT:
cooked = new ItemStack(Material.COOKED_RABBIT); cooked = new ItemStack(Material.COOKED_RABBIT);
break; break;
default: default:
break; break;
} }
newDrops.add(cooked); newDrops.add(cooked);
@ -535,7 +558,8 @@ public class PKListener implements Listener {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (entity != null) { if (entity != null) {
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) { if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbent(entity)
|| Suffocate.isBreathbent(entity)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -548,7 +572,8 @@ public class PKListener implements Listener {
} }
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) { if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbent(entity)
|| Suffocate.isBreathbent(entity)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -560,7 +585,8 @@ public class PKListener implements Listener {
} }
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) { if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbent(entity)
|| Suffocate.isBreathbent(entity)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -572,7 +598,8 @@ public class PKListener implements Listener {
} }
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) { if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbent(entity)
|| Suffocate.isBreathbent(entity)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -584,7 +611,8 @@ public class PKListener implements Listener {
} }
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) { if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbent(entity)
|| Suffocate.isBreathbent(entity)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -633,7 +661,8 @@ public class PKListener implements Listener {
} }
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) { if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbent(entity)
|| Suffocate.isBreathbent(entity)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -642,9 +671,11 @@ public class PKListener implements Listener {
public void onHorizontalCollision(HorizontalVelocityChangeEvent e) { public void onHorizontalCollision(HorizontalVelocityChangeEvent e) {
if (e.getEntity() instanceof LivingEntity) { if (e.getEntity() instanceof LivingEntity) {
if (e.getEntity().getEntityId() != e.getInstigator().getEntityId()) { if (e.getEntity().getEntityId() != e.getInstigator().getEntityId()) {
double minimumDistance = plugin.getConfig().getDouble("Properties.HorizontalCollisionPhysics.WallDamageMinimumDistance"); double minimumDistance = plugin.getConfig()
.getDouble("Properties.HorizontalCollisionPhysics.WallDamageMinimumDistance");
double maxDamage = plugin.getConfig().getDouble("Properties.HorizontalCollisionPhysics.WallDamageCap"); double maxDamage = plugin.getConfig().getDouble("Properties.HorizontalCollisionPhysics.WallDamageCap");
double damage = ((e.getDistanceTraveled() - minimumDistance) < 0 ? 0 : e.getDistanceTraveled() - minimumDistance) / (e.getDifference().length()); double damage = ((e.getDistanceTraveled() - minimumDistance) < 0 ? 0
: e.getDistanceTraveled() - minimumDistance) / (e.getDifference().length());
if (damage > 0) { if (damage > 0) {
if (damage <= maxDamage) { if (damage <= maxDamage) {
DamageHandler.damageEntity((LivingEntity) e.getEntity(), damage, e.getAbility()); DamageHandler.damageEntity((LivingEntity) e.getEntity(), damage, e.getAbility());
@ -663,13 +694,15 @@ public class PKListener implements Listener {
} }
for (MetalClips clips : CoreAbility.getAbilities(MetalClips.class)) { for (MetalClips clips : CoreAbility.getAbilities(MetalClips.class)) {
if (clips.getTargetEntity() != null && clips.getTargetEntity().getEntityId() == event.getWhoClicked().getEntityId()) { if (clips.getTargetEntity() != null
&& clips.getTargetEntity().getEntityId() == event.getWhoClicked().getEntityId()) {
event.setCancelled(true); event.setCancelled(true);
break; break;
} }
} }
if (event.getSlotType() == SlotType.ARMOR && CoreAbility.hasAbility((Player) event.getWhoClicked(), EarthArmor.class)) { if (event.getSlotType() == SlotType.ARMOR
&& CoreAbility.hasAbility((Player) event.getWhoClicked(), EarthArmor.class)) {
event.setCancelled(true); event.setCancelled(true);
} }
if (event.getSlotType() == SlotType.ARMOR && !PlantArmor.canRemoveArmor((Player) event.getWhoClicked())) { if (event.getSlotType() == SlotType.ARMOR && !PlantArmor.canRemoveArmor((Player) event.getWhoClicked())) {
@ -683,7 +716,8 @@ public class PKListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.NORMAL)
public void onPlayerBendingDeath(EntityBendingDeathEvent event) { public void onPlayerBendingDeath(EntityBendingDeathEvent event) {
if (ConfigManager.languageConfig.get().getBoolean("DeathMessages.Enabled") && event.getEntity() instanceof Player) { if (ConfigManager.languageConfig.get().getBoolean("DeathMessages.Enabled")
&& event.getEntity() instanceof Player) {
Ability ability = event.getAbility(); Ability ability = event.getAbility();
if (ability == null) { if (ability == null) {
@ -711,10 +745,15 @@ public class PKListener implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
String e = bPlayer == null || bPlayer.getElements().size() == 0 ? "Nonbender" : (bPlayer.getElements().size() > 1 ? "Avatar" : bPlayer.getElements().get(0).getName()); String e = bPlayer == null || bPlayer.getElements().size() == 0 ? "Nonbender"
: (bPlayer.getElements().size() > 1 ? "Avatar" : bPlayer.getElements().get(0).getName());
String element = ConfigManager.languageConfig.get().getString("Chat.Prefixes." + e); String element = ConfigManager.languageConfig.get().getString("Chat.Prefixes." + e);
ChatColor c = bPlayer == null || bPlayer.getElements().size() == 0 ? ChatColor.WHITE : (bPlayer.getElements().size() > 1 ? Element.AVATAR.getColor() : bPlayer.getElements().get(0).getColor()); ChatColor c = bPlayer == null || bPlayer.getElements().size() == 0 ? ChatColor.WHITE
event.setFormat(event.getFormat().replace("{element}", c + element + ChatColor.RESET).replace("{ELEMENT}", c + element + ChatColor.RESET).replace("{elementcolor}", c + "").replace("{ELEMENTCOLOR}", c + "")); : (bPlayer.getElements().size() > 1 ? Element.AVATAR.getColor()
: bPlayer.getElements().get(0).getColor());
event.setFormat(event.getFormat().replace("{element}", c + element + ChatColor.RESET)
.replace("{ELEMENT}", c + element + ChatColor.RESET).replace("{elementcolor}", c + "")
.replace("{ELEMENTCOLOR}", c + ""));
if (!ConfigManager.languageConfig.get().getBoolean("Chat.Enable")) { if (!ConfigManager.languageConfig.get().getBoolean("Chat.Enable")) {
return; return;
@ -758,27 +797,31 @@ public class PKListener implements Listener {
new Shockwave(player, true); new Shockwave(player, true);
} }
if (!event.isCancelled() && bPlayer.hasElement(Element.AIR) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.AIR)) { if (!event.isCancelled() && bPlayer.hasElement(Element.AIR) && event.getCause() == DamageCause.FALL
&& bPlayer.canBendPassive(Element.AIR)) {
new AirBurst(player, true); new AirBurst(player, true);
event.setDamage(0D); event.setDamage(0D);
event.setCancelled(true); event.setCancelled(true);
} }
if (!event.isCancelled() && bPlayer.hasElement(Element.WATER) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.WATER)) { if (!event.isCancelled() && bPlayer.hasElement(Element.WATER) && event.getCause() == DamageCause.FALL
&& bPlayer.canBendPassive(Element.WATER)) {
if (WaterPassive.applyNoFall(player)) { if (WaterPassive.applyNoFall(player)) {
event.setDamage(0D); event.setDamage(0D);
event.setCancelled(true); event.setCancelled(true);
} }
} }
if (!event.isCancelled() && bPlayer.hasElement(Element.EARTH) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.EARTH)) { if (!event.isCancelled() && bPlayer.hasElement(Element.EARTH) && event.getCause() == DamageCause.FALL
&& bPlayer.canBendPassive(Element.EARTH)) {
if (EarthPassive.softenLanding(player)) { if (EarthPassive.softenLanding(player)) {
event.setDamage(0D); event.setDamage(0D);
event.setCancelled(true); event.setCancelled(true);
} }
} }
if (!event.isCancelled() && bPlayer.hasElement(Element.CHI) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.CHI)) { if (!event.isCancelled() && bPlayer.hasElement(Element.CHI) && event.getCause() == DamageCause.FALL
&& bPlayer.canBendPassive(Element.CHI)) {
double initdamage = event.getDamage(); double initdamage = event.getDamage();
double newdamage = event.getDamage() * ChiPassive.getFallReductionFactor(); double newdamage = event.getDamage() * ChiPassive.getFallReductionFactor();
double finaldamage = initdamage - newdamage; double finaldamage = initdamage - newdamage;
@ -794,11 +837,13 @@ public class PKListener implements Listener {
} }
} }
if (bPlayer.canBendPassive(Element.FIRE) && bPlayer.hasElement(Element.FIRE) && (event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK)) { if (bPlayer.canBendPassive(Element.FIRE) && bPlayer.hasElement(Element.FIRE)
&& (event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK)) {
event.setCancelled(!HeatControl.canBurn(player)); event.setCancelled(!HeatControl.canBurn(player));
} }
if (bPlayer.hasElement(Element.EARTH) && event.getCause() == DamageCause.SUFFOCATION && TempBlock.isTempBlock(player.getEyeLocation().getBlock())) { if (bPlayer.hasElement(Element.EARTH) && event.getCause() == DamageCause.SUFFOCATION
&& TempBlock.isTempBlock(player.getEyeLocation().getBlock())) {
event.setDamage(0D); event.setDamage(0D);
event.setCancelled(true); event.setCancelled(true);
} }
@ -837,7 +882,8 @@ public class PKListener implements Listener {
Entity en = e.getEntity(); Entity en = e.getEntity();
if (en instanceof Player) { if (en instanceof Player) {
if (e.getDamager() instanceof Player) { // This is the player hitting someone. if (e.getDamager() instanceof Player) { // This is the player
// hitting someone.
Player sourcePlayer = (Player) e.getDamager(); Player sourcePlayer = (Player) e.getDamager();
Player targetPlayer = (Player) e.getEntity(); Player targetPlayer = (Player) e.getEntity();
BendingPlayer sourceBPlayer = BendingPlayer.getBendingPlayer(sourcePlayer); BendingPlayer sourceBPlayer = BendingPlayer.getBendingPlayer(sourcePlayer);
@ -850,13 +896,22 @@ 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 (GeneralMethods.isWeapon(sourcePlayer.getInventory().getItemInMainHand().getType()) && !plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) { if (GeneralMethods.isWeapon(sourcePlayer.getInventory().getItemInMainHand().getType())
&& !plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
return; return;
} }
if (sourceBPlayer.isElementToggled(Element.CHI) == true) { if (sourceBPlayer.isElementToggled(Element.CHI) == true) {
if (boundAbil.equalsIgnoreCase("Paralyze")) { if (boundAbil.equalsIgnoreCase("Paralyze")) {
new Paralyze(sourcePlayer, targetPlayer); new Paralyze(sourcePlayer, targetPlayer);
} else { } else if (boundAbil.equalsIgnoreCase("QuickStrike")) {
new QuickStrike(sourcePlayer, targetPlayer);
} else if (boundAbil.equalsIgnoreCase("SwiftKick")) {
new SwiftKick(sourcePlayer, targetPlayer);
}
else if (boundAbil.equalsIgnoreCase("RapidPunch")) {
new RapidPunch(sourcePlayer, targetPlayer);
}
else {
if (ChiPassive.willChiBlock(sourcePlayer, targetPlayer)) { if (ChiPassive.willChiBlock(sourcePlayer, targetPlayer)) {
ChiPassive.blockChi(targetPlayer); ChiPassive.blockChi(targetPlayer);
} }
@ -866,12 +921,15 @@ public class PKListener implements Listener {
} }
} }
if (sourceBPlayer.canBendPassive(Element.CHI)) { if (sourceBPlayer.canBendPassive(Element.CHI)) {
if (GeneralMethods.isWeapon(sourcePlayer.getInventory().getItemInMainHand().getType()) && !ProjectKorra.plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) { if (GeneralMethods.isWeapon(sourcePlayer.getInventory().getItemInMainHand().getType())
&& !ProjectKorra.plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
return; return;
} }
if (e.getCause() == DamageCause.ENTITY_ATTACK && sourceBPlayer.isElementToggled(Element.CHI) == true) { if (e.getCause() == DamageCause.ENTITY_ATTACK
&& sourceBPlayer.isElementToggled(Element.CHI) == true) {
if (boundAbil.equalsIgnoreCase("Paralyze") && e.getDamage() == 1) { if (boundAbil.equalsIgnoreCase("Paralyze") && e.getDamage() == 1) {
if (sourcePlayer.getWorld().equals(targetPlayer.getWorld()) && Math.abs(sourcePlayer.getLocation().distance(targetPlayer.getLocation())) < 3) { if (sourcePlayer.getWorld().equals(targetPlayer.getWorld())
&& Math.abs(sourcePlayer.getLocation().distance(targetPlayer.getLocation())) < 3) {
new Paralyze(sourcePlayer, targetPlayer); new Paralyze(sourcePlayer, targetPlayer);
} }
} }
@ -892,7 +950,8 @@ public class PKListener implements Listener {
TempArmor.getTempArmor(event.getEntity()).revert(); TempArmor.getTempArmor(event.getEntity()).revert();
} }
} else { } else {
//Do nothing. TempArmor drops are handled by the EntityDeath event and not PlayerDeath // Do nothing. TempArmor drops are handled by the EntityDeath event
// and not PlayerDeath
} }
if (event.getEntity().getKiller() != null) { if (event.getEntity().getKiller() != null) {
@ -908,26 +967,38 @@ public class PKListener implements Listener {
element = coreAbil.getElement(); element = coreAbil.getElement();
} }
if (HorizontalVelocityTracker.hasBeenDamagedByHorizontalVelocity(event.getEntity()) && Arrays.asList(HorizontalVelocityTracker.abils).contains(tempAbility)) { if (HorizontalVelocityTracker.hasBeenDamagedByHorizontalVelocity(event.getEntity())
if (ConfigManager.languageConfig.get().contains("Abilities." + element.getName() + "." + tempAbility + ".HorizontalVelocityDeath")) { && Arrays.asList(HorizontalVelocityTracker.abils).contains(tempAbility)) {
message = ConfigManager.languageConfig.get().getString("Abilities." + element.getName() + "." + tempAbility + ".HorizontalVelocityDeath"); if (ConfigManager.languageConfig.get().contains(
"Abilities." + element.getName() + "." + tempAbility + ".HorizontalVelocityDeath")) {
message = ConfigManager.languageConfig.get().getString(
"Abilities." + element.getName() + "." + tempAbility + ".HorizontalVelocityDeath");
} }
} else if (element != null) { } else if (element != null) {
if (ConfigManager.languageConfig.get().contains("Abilities." + element.getName() + "." + tempAbility + ".DeathMessage")) { if (ConfigManager.languageConfig.get()
message = ConfigManager.languageConfig.get().getString("Abilities." + element.getName() + "." + tempAbility + ".DeathMessage"); .contains("Abilities." + element.getName() + "." + tempAbility + ".DeathMessage")) {
} else if (ConfigManager.languageConfig.get().contains("Abilities." + element.getName() + ".Combo." + tempAbility + ".DeathMessage")) { message = ConfigManager.languageConfig.get()
message = ConfigManager.languageConfig.get().getString("Abilities." + element.getName() + ".Combo." + tempAbility + ".DeathMessage"); .getString("Abilities." + element.getName() + "." + tempAbility + ".DeathMessage");
} else if (ConfigManager.languageConfig.get()
.contains("Abilities." + element.getName() + ".Combo." + tempAbility + ".DeathMessage")) {
message = ConfigManager.languageConfig.get().getString(
"Abilities." + element.getName() + ".Combo." + tempAbility + ".DeathMessage");
} }
} else { } else {
if (isAvatarAbility) { if (isAvatarAbility) {
if (ConfigManager.languageConfig.get().contains("Abilities.Avatar." + tempAbility + ".DeathMessage")) { if (ConfigManager.languageConfig.get()
message = ConfigManager.languageConfig.get().getString("Abilities.Avatar." + tempAbility + ".DeathMessage"); .contains("Abilities.Avatar." + tempAbility + ".DeathMessage")) {
message = ConfigManager.languageConfig.get()
.getString("Abilities.Avatar." + tempAbility + ".DeathMessage");
} }
} else if (ConfigManager.languageConfig.get().contains("Abilities.Avatar.Combo." + tempAbility + ".DeathMessage")) { } else if (ConfigManager.languageConfig.get()
message = ConfigManager.languageConfig.get().getString("Abilities.Avatar.Combo." + tempAbility + ".DeathMessage"); .contains("Abilities.Avatar.Combo." + tempAbility + ".DeathMessage")) {
message = ConfigManager.languageConfig.get()
.getString("Abilities.Avatar.Combo." + tempAbility + ".DeathMessage");
} }
} }
message = message.replace("{victim}", event.getEntity().getName()).replace("{attacker}", event.getEntity().getKiller().getName()).replace("{ability}", ability); message = message.replace("{victim}", event.getEntity().getName())
.replace("{attacker}", event.getEntity().getKiller().getName()).replace("{ability}", ability);
event.setDeathMessage(message); event.setDeathMessage(message);
BENDING_PLAYER_DEATH.remove(event.getEntity()); BENDING_PLAYER_DEATH.remove(event.getEntity());
} }
@ -965,7 +1036,8 @@ public class PKListener implements Listener {
new EarthSmash(player, ClickType.RIGHT_CLICK); new EarthSmash(player, ClickType.RIGHT_CLICK);
} }
} }
if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) { if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbent(player)
|| Suffocate.isBreathbent(player)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -981,22 +1053,25 @@ public class PKListener implements Listener {
ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK_ENTITY); ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK_ENTITY);
if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) { if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbent(player)
|| Suffocate.isBreathbent(player)) {
event.setCancelled(true); event.setCancelled(true);
} }
if (bPlayer.getBoundAbilityName().equalsIgnoreCase("HealingWaters") && event.getHand().equals(EquipmentSlot.HAND)) { if (bPlayer.getBoundAbilityName().equalsIgnoreCase("HealingWaters")
HealingWaters instance = CoreAbility.getAbility(player, HealingWaters.class); && event.getHand().equals(EquipmentSlot.HAND)) {
if(instance != null && instance.charged) { HealingWaters instance = CoreAbility.getAbility(player, HealingWaters.class);
instance.click(); if (instance != null && instance.charged) {
event.setCancelled(true); instance.click();
} event.setCancelled(true);
}
} }
} }
@EventHandler @EventHandler
public void onPlayerItemDamage(PlayerItemDamageEvent event) { public void onPlayerItemDamage(PlayerItemDamageEvent event) {
if (event.isCancelled()) return; if (event.isCancelled())
return;
if (TempArmor.hasTempArmor(event.getPlayer())) { if (TempArmor.hasTempArmor(event.getPlayer())) {
TempArmor armor = TempArmor.getTempArmor(event.getPlayer()); TempArmor armor = TempArmor.getTempArmor(event.getPlayer());
@ -1052,7 +1127,8 @@ public class PKListener implements Listener {
return; return;
} }
else if (CoreAbility.hasAbility(player, WaterSpout.class) || CoreAbility.hasAbility(player, AirSpout.class) || CoreAbility.hasAbility(player, SandSpout.class)) { else if (CoreAbility.hasAbility(player, WaterSpout.class) || CoreAbility.hasAbility(player, AirSpout.class)
|| CoreAbility.hasAbility(player, SandSpout.class)) {
Vector vel = new Vector(); Vector vel = new Vector();
vel.setX(event.getTo().getX() - event.getFrom().getX()); vel.setX(event.getTo().getX() - event.getFrom().getX());
vel.setZ(event.getTo().getZ() - event.getFrom().getZ()); vel.setZ(event.getTo().getZ() - event.getFrom().getZ());
@ -1094,7 +1170,8 @@ public class PKListener implements Listener {
else { else {
if (bPlayer != null) { if (bPlayer != null) {
if (bPlayer.hasElement(Element.AIR) || bPlayer.hasElement(Element.CHI) || bPlayer.hasElement(Element.EARTH)) { if (bPlayer.hasElement(Element.AIR) || bPlayer.hasElement(Element.CHI)
|| bPlayer.hasElement(Element.EARTH)) {
PassiveHandler.checkSpeedPassives(player); PassiveHandler.checkSpeedPassives(player);
} }
if (bPlayer.hasElement(Element.AIR) || bPlayer.hasElement(Element.CHI)) { if (bPlayer.hasElement(Element.AIR) || bPlayer.hasElement(Element.CHI)) {
@ -1105,7 +1182,8 @@ public class PKListener implements Listener {
} }
if (event.getTo().getY() > event.getFrom().getY()) { if (event.getTo().getY() > event.getFrom().getY()) {
if (!(player.getLocation().getBlock().getType() == Material.VINE) && !(player.getLocation().getBlock().getType() == Material.LADDER)) { if (!(player.getLocation().getBlock().getType() == Material.VINE)
&& !(player.getLocation().getBlock().getType() == Material.LADDER)) {
int current = player.getStatistic(Statistic.JUMP); int current = player.getStatistic(Statistic.JUMP);
int last = JUMPS.get(player); int last = JUMPS.get(player);
@ -1176,6 +1254,11 @@ public class PKListener implements Listener {
return; return;
} }
if (CoreAbility.hasAbility(event.getPlayer(), AirScooter.class)) {
event.setCancelled(true);
return;
}
if (player.isSneaking()) { if (player.isSneaking()) {
ComboManager.addComboAbility(player, ClickType.SHIFT_UP); ComboManager.addComboAbility(player, ClickType.SHIFT_UP);
} else { } else {
@ -1184,7 +1267,8 @@ public class PKListener implements Listener {
String abilName = bPlayer.getBoundAbilityName(); String abilName = bPlayer.getBoundAbilityName();
if (Suffocate.isBreathbent(player)) { if (Suffocate.isBreathbent(player)) {
if (!abilName.equalsIgnoreCase("AirSwipe") || !abilName.equalsIgnoreCase("FireBlast") || !abilName.equalsIgnoreCase("EarthBlast") || !abilName.equalsIgnoreCase("WaterManipulation")) { if (!abilName.equalsIgnoreCase("AirSwipe") || !abilName.equalsIgnoreCase("FireBlast")
|| !abilName.equalsIgnoreCase("EarthBlast") || !abilName.equalsIgnoreCase("WaterManipulation")) {
if (!player.isSneaking()) { if (!player.isSneaking()) {
event.setCancelled(true); event.setCancelled(true);
} }
@ -1218,31 +1302,25 @@ 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 (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) && !plugin.getConfig().getBoolean("Properties.Air.CanBendWithWeapons")) { if (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType())
&& !plugin.getConfig().getBoolean("Properties.Air.CanBendWithWeapons")) {
return; return;
} }
if (abil.equalsIgnoreCase("Tornado")) { if (abil.equalsIgnoreCase("Tornado")) {
new Tornado(player); new Tornado(player);
} } else if (abil.equalsIgnoreCase("AirBlast")) {
else if (abil.equalsIgnoreCase("AirBlast")) {
AirBlast.setOrigin(player); AirBlast.setOrigin(player);
} } else if (abil.equalsIgnoreCase("AirBurst")) {
else if (abil.equalsIgnoreCase("AirBurst")) {
new AirBurst(player, false); new AirBurst(player, false);
} } else if (abil.equalsIgnoreCase("AirSuction")) {
else if (abil.equalsIgnoreCase("AirSuction")) {
AirSuction.setOrigin(player); AirSuction.setOrigin(player);
} } else if (abil.equalsIgnoreCase("AirSwipe")) {
else if (abil.equalsIgnoreCase("AirSwipe")) {
new AirSwipe(player, true); new AirSwipe(player, true);
} } else if (abil.equalsIgnoreCase("AirShield")) {
else if (abil.equalsIgnoreCase("AirShield")) {
new AirShield(player); new AirShield(player);
} } else if (abil.equalsIgnoreCase("Suffocate")) {
else if (abil.equalsIgnoreCase("Suffocate")) {
new Suffocate(player); new Suffocate(player);
} } else if (abil.equalsIgnoreCase("Flight")) {
else if (abil.equalsIgnoreCase("Flight")) {
if (player.isSneaking() || !bPlayer.canUseFlight()) { if (player.isSneaking() || !bPlayer.canUseFlight()) {
return; return;
} }
@ -1251,39 +1329,32 @@ public class PKListener implements Listener {
} }
if (coreAbil instanceof WaterAbility && bPlayer.isElementToggled(Element.WATER) == true) { if (coreAbil instanceof WaterAbility && bPlayer.isElementToggled(Element.WATER) == true) {
if (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) && !plugin.getConfig().getBoolean("Properties.Water.CanBendWithWeapons")) { if (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType())
&& !plugin.getConfig().getBoolean("Properties.Water.CanBendWithWeapons")) {
return; return;
} }
if (abil.equalsIgnoreCase("Bloodbending")) { if (abil.equalsIgnoreCase("Bloodbending")) {
new Bloodbending(player); new Bloodbending(player);
} } else if (abil.equalsIgnoreCase("IceBlast")) {
else if (abil.equalsIgnoreCase("IceBlast")) {
new IceBlast(player); new IceBlast(player);
} } else if (abil.equalsIgnoreCase("IceSpike")) {
else if (abil.equalsIgnoreCase("IceSpike")) {
new IceSpikeBlast(player); new IceSpikeBlast(player);
} } else if (abil.equalsIgnoreCase("OctopusForm")) {
else if (abil.equalsIgnoreCase("OctopusForm")) {
OctopusForm.form(player); OctopusForm.form(player);
} } else if (abil.equalsIgnoreCase("PhaseChange")) {
else if (abil.equalsIgnoreCase("PhaseChange")) {
if (!CoreAbility.hasAbility(player, PhaseChange.class)) { if (!CoreAbility.hasAbility(player, PhaseChange.class)) {
new PhaseChange(player, PhaseChangeType.MELT); new PhaseChange(player, PhaseChangeType.MELT);
} else { } else {
PhaseChange pc = CoreAbility.getAbility(player, PhaseChange.class); PhaseChange pc = CoreAbility.getAbility(player, PhaseChange.class);
pc.startNewType(PhaseChangeType.MELT); pc.startNewType(PhaseChangeType.MELT);
} }
} } else if (abil.equalsIgnoreCase("WaterManipulation")) {
else if (abil.equalsIgnoreCase("WaterManipulation")) {
new WaterManipulation(player); new WaterManipulation(player);
} } else if (abil.equalsIgnoreCase("Surge")) {
else if (abil.equalsIgnoreCase("Surge")) {
SurgeWall.form(player); SurgeWall.form(player);
} } else if (abil.equalsIgnoreCase("Torrent")) {
else if (abil.equalsIgnoreCase("Torrent")) {
Torrent.create(player); Torrent.create(player);
} } else if (abil.equalsIgnoreCase("WaterArms")) {
else if (abil.equalsIgnoreCase("WaterArms")) {
new WaterArms(player); new WaterArms(player);
} }
if (abil.equalsIgnoreCase("HealingWaters")) { if (abil.equalsIgnoreCase("HealingWaters")) {
@ -1292,34 +1363,27 @@ public class PKListener implements Listener {
} }
if (coreAbil instanceof EarthAbility && bPlayer.isElementToggled(Element.EARTH) == true) { if (coreAbil instanceof EarthAbility && bPlayer.isElementToggled(Element.EARTH) == true) {
if (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) && !plugin.getConfig().getBoolean("Properties.Earth.CanBendWithWeapons")) { if (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType())
&& !plugin.getConfig().getBoolean("Properties.Earth.CanBendWithWeapons")) {
return; return;
} }
if (abil.equalsIgnoreCase("EarthBlast")) { if (abil.equalsIgnoreCase("EarthBlast")) {
new EarthBlast(player); new EarthBlast(player);
} } else if (abil.equalsIgnoreCase("EarthArmor")) {
else if (abil.equalsIgnoreCase("EarthArmor")) {
new EarthArmor(player); new EarthArmor(player);
} } else if (abil.equalsIgnoreCase("RaiseEarth")) {
else if (abil.equalsIgnoreCase("RaiseEarth")) {
new RaiseEarthWall(player); new RaiseEarthWall(player);
} } else if (abil.equalsIgnoreCase("Collapse")) {
else if (abil.equalsIgnoreCase("Collapse")) {
new CollapseWall(player); new CollapseWall(player);
} } else if (abil.equalsIgnoreCase("Shockwave")) {
else if (abil.equalsIgnoreCase("Shockwave")) {
new Shockwave(player, false); new Shockwave(player, false);
} } else if (abil.equalsIgnoreCase("EarthTunnel")) {
else if (abil.equalsIgnoreCase("EarthTunnel")) {
new EarthTunnel(player); new EarthTunnel(player);
} } else if (abil.equalsIgnoreCase("Tremorsense")) {
else if (abil.equalsIgnoreCase("Tremorsense")) {
bPlayer.toggleTremorSense(); bPlayer.toggleTremorSense();
} } else if (abil.equalsIgnoreCase("Extraction")) {
else if (abil.equalsIgnoreCase("Extraction")) {
new Extraction(player); new Extraction(player);
} } else if (abil.equalsIgnoreCase("MetalClips")) {
else if (abil.equalsIgnoreCase("MetalClips")) {
MetalClips clips = CoreAbility.getAbility(player, MetalClips.class); MetalClips clips = CoreAbility.getAbility(player, MetalClips.class);
if (clips != null) { if (clips != null) {
if (clips.getTargetEntity() == null) { if (clips.getTargetEntity() == null) {
@ -1334,35 +1398,29 @@ public class PKListener implements Listener {
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 (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) && !plugin.getConfig().getBoolean("Properties.Fire.CanBendWithWeapons")) { if (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType())
&& !plugin.getConfig().getBoolean("Properties.Fire.CanBendWithWeapons")) {
return; return;
} }
if (abil.equalsIgnoreCase("Blaze")) { if (abil.equalsIgnoreCase("Blaze")) {
new BlazeRing(player); new BlazeRing(player);
} } else if (abil.equalsIgnoreCase("FireBlast")) {
else if (abil.equalsIgnoreCase("FireBlast")) {
new FireBlastCharged(player); new FireBlastCharged(player);
} } else if (abil.equalsIgnoreCase("HeatControl")) {
else if (abil.equalsIgnoreCase("HeatControl")) {
new HeatControl(player, HeatControlType.COOK); new HeatControl(player, HeatControlType.COOK);
} } else if (abil.equalsIgnoreCase("FireBurst")) {
else if (abil.equalsIgnoreCase("FireBurst")) {
new FireBurst(player); new FireBurst(player);
} } else if (abil.equalsIgnoreCase("FireShield")) {
else if (abil.equalsIgnoreCase("FireShield")) {
new FireShield(player, true); new FireShield(player, true);
} } else if (abil.equalsIgnoreCase("Lightning")) {
else if (abil.equalsIgnoreCase("Lightning")) {
new Lightning(player); new Lightning(player);
} } else if (abil.equalsIgnoreCase("Combustion")) {
else if (abil.equalsIgnoreCase("Combustion")) {
new Combustion(player); new Combustion(player);
} }
} }
@ -1393,7 +1451,6 @@ public class PKListener implements Listener {
return; return;
} }
Player player = event.getPlayer(); Player player = event.getPlayer();
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null) { if (bPlayer == null) {
@ -1440,29 +1497,25 @@ public class PKListener implements Listener {
} }
if (coreAbil instanceof AirAbility && bPlayer.isElementToggled(Element.AIR) == true) { if (coreAbil instanceof AirAbility && bPlayer.isElementToggled(Element.AIR) == true) {
if (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) && !plugin.getConfig().getBoolean("Properties.Air.CanBendWithWeapons")) { if (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType())
&& !plugin.getConfig().getBoolean("Properties.Air.CanBendWithWeapons")) {
return; return;
} }
if (abil.equalsIgnoreCase("AirBlast")) { if (abil.equalsIgnoreCase("AirBlast")) {
new AirBlast(player); new AirBlast(player);
} } else if (abil.equalsIgnoreCase("AirSuction")) {
else if (abil.equalsIgnoreCase("AirSuction")) {
new AirSuction(player); new AirSuction(player);
} } else if (abil.equalsIgnoreCase("AirBurst")) {
else if (abil.equalsIgnoreCase("AirBurst")) {
AirBurst.coneBurst(player); AirBurst.coneBurst(player);
} } else if (abil.equalsIgnoreCase("AirScooter")) {
else if (abil.equalsIgnoreCase("AirScooter")) {
new AirScooter(player); new AirScooter(player);
} } else if (abil.equalsIgnoreCase("AirSpout")) {
else if (abil.equalsIgnoreCase("AirSpout")) {
new AirSpout(player); new AirSpout(player);
} } else if (abil.equalsIgnoreCase("AirSwipe")) {
else if (abil.equalsIgnoreCase("AirSwipe")) {
new AirSwipe(player); new AirSwipe(player);
} } else if (abil.equalsIgnoreCase("Flight")) {
else if (abil.equalsIgnoreCase("Flight")) { if (!ProjectKorra.plugin.getConfig().getBoolean("Abilities.Air.Flight.HoverEnabled")
if (!ProjectKorra.plugin.getConfig().getBoolean("Abilities.Air.Flight.HoverEnabled") || !bPlayer.canUseFlight()) { || !bPlayer.canUseFlight()) {
return; return;
} }
@ -1477,167 +1530,131 @@ public class PKListener implements Listener {
} }
if (coreAbil instanceof WaterAbility && bPlayer.isElementToggled(Element.WATER) == true) { if (coreAbil instanceof WaterAbility && bPlayer.isElementToggled(Element.WATER) == true) {
if (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) && !plugin.getConfig().getBoolean("Properties.Water.CanBendWithWeapons")) { if (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType())
&& !plugin.getConfig().getBoolean("Properties.Water.CanBendWithWeapons")) {
return; return;
} }
if (abil.equalsIgnoreCase("Bloodbending")) { if (abil.equalsIgnoreCase("Bloodbending")) {
Bloodbending.launch(player); Bloodbending.launch(player);
} } else if (abil.equalsIgnoreCase("IceBlast")) {
else if (abil.equalsIgnoreCase("IceBlast")) {
IceBlast.activate(player); IceBlast.activate(player);
} } else if (abil.equalsIgnoreCase("IceSpike")) {
else if (abil.equalsIgnoreCase("IceSpike")) {
IceSpikeBlast.activate(player); IceSpikeBlast.activate(player);
} } else if (abil.equalsIgnoreCase("OctopusForm")) {
else if (abil.equalsIgnoreCase("OctopusForm")) {
new OctopusForm(player); new OctopusForm(player);
} } else if (abil.equalsIgnoreCase("PhaseChange")) {
else if (abil.equalsIgnoreCase("PhaseChange")) {
if (!CoreAbility.hasAbility(player, PhaseChange.class)) { if (!CoreAbility.hasAbility(player, PhaseChange.class)) {
new PhaseChange(player, PhaseChangeType.FREEZE); new PhaseChange(player, PhaseChangeType.FREEZE);
} else { } else {
PhaseChange pc = CoreAbility.getAbility(player, PhaseChange.class); PhaseChange pc = CoreAbility.getAbility(player, PhaseChange.class);
pc.startNewType(PhaseChangeType.FREEZE); pc.startNewType(PhaseChangeType.FREEZE);
} }
} } else if (abil.equalsIgnoreCase("PlantArmor")) {
else if (abil.equalsIgnoreCase("PlantArmor")) {
new PlantArmor(player); new PlantArmor(player);
} } else if (abil.equalsIgnoreCase("WaterSpout")) {
else if (abil.equalsIgnoreCase("WaterSpout")) {
new WaterSpout(player); new WaterSpout(player);
} } else if (abil.equalsIgnoreCase("WaterManipulation")) {
else if (abil.equalsIgnoreCase("WaterManipulation")) {
WaterManipulation.moveWater(player); WaterManipulation.moveWater(player);
} } else if (abil.equalsIgnoreCase("Surge")) {
else if (abil.equalsIgnoreCase("Surge")) {
new SurgeWall(player); new SurgeWall(player);
} } else if (abil.equalsIgnoreCase("Torrent")) {
else if (abil.equalsIgnoreCase("Torrent")) {
new Torrent(player); new Torrent(player);
} }
} }
if (coreAbil instanceof EarthAbility && bPlayer.isElementToggled(Element.EARTH) == true) { if (coreAbil instanceof EarthAbility && bPlayer.isElementToggled(Element.EARTH) == true) {
if (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) && !plugin.getConfig().getBoolean("Properties.Earth.CanBendWithWeapons")) { if (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType())
&& !plugin.getConfig().getBoolean("Properties.Earth.CanBendWithWeapons")) {
return; return;
} }
if (abil.equalsIgnoreCase("Catapult")) { if (abil.equalsIgnoreCase("Catapult")) {
new Catapult(player); new Catapult(player);
} } else if (abil.equalsIgnoreCase("EarthBlast")) {
else if (abil.equalsIgnoreCase("EarthBlast")) {
EarthBlast.throwEarth(player); EarthBlast.throwEarth(player);
} } else if (abil.equalsIgnoreCase("RaiseEarth")) {
else if (abil.equalsIgnoreCase("RaiseEarth")) {
new RaiseEarth(player); new RaiseEarth(player);
} } else if (abil.equalsIgnoreCase("Collapse")) {
else if (abil.equalsIgnoreCase("Collapse")) {
new Collapse(player); new Collapse(player);
} } else if (abil.equalsIgnoreCase("Shockwave")) {
else if (abil.equalsIgnoreCase("Shockwave")) {
Shockwave.coneShockwave(player); Shockwave.coneShockwave(player);
} } else if (abil.equalsIgnoreCase("EarthArmor")) {
else if (abil.equalsIgnoreCase("EarthArmor")) {
EarthArmor armor = CoreAbility.getAbility(player, EarthArmor.class); EarthArmor armor = CoreAbility.getAbility(player, EarthArmor.class);
if (armor != null && armor.isFormed()) { if (armor != null && armor.isFormed()) {
armor.click(); armor.click();
} }
} } else if (abil.equalsIgnoreCase("EarthGrab")) {
else if (abil.equalsIgnoreCase("EarthGrab")) {
new EarthGrab(player); new EarthGrab(player);
} } else if (abil.equalsIgnoreCase("Tremorsense")) {
else if (abil.equalsIgnoreCase("Tremorsense")) {
new Tremorsense(player, true); new Tremorsense(player, true);
} } else if (abil.equalsIgnoreCase("MetalClips")) {
else if (abil.equalsIgnoreCase("MetalClips")) {
MetalClips clips = CoreAbility.getAbility(player, MetalClips.class); MetalClips clips = CoreAbility.getAbility(player, MetalClips.class);
if (clips == null) { if (clips == null) {
new MetalClips(player, 0); new MetalClips(player, 0);
} else if (clips.getMetalClipsCount() < (player.hasPermission("bending.ability.MetalClips.4clips") ? 4 : 3)) { } else if (clips.getMetalClipsCount() < (player.hasPermission("bending.ability.MetalClips.4clips")
? 4 : 3)) {
clips.shootMetal(); clips.shootMetal();
} else if (clips.getMetalClipsCount() == 4 && clips.isCanUse4Clips()) { } else if (clips.getMetalClipsCount() == 4 && clips.isCanUse4Clips()) {
clips.crush(); clips.crush();
} }
} } else if (abil.equalsIgnoreCase("LavaSurge")) {
else if (abil.equalsIgnoreCase("LavaSurge")) {
LavaSurge surge = CoreAbility.getAbility(player, LavaSurge.class); LavaSurge surge = CoreAbility.getAbility(player, LavaSurge.class);
if (surge != null) { if (surge != null) {
surge.launch(); surge.launch();
} }
} } else if (abil.equalsIgnoreCase("LavaFlow")) {
else if (abil.equalsIgnoreCase("LavaFlow")) {
new LavaFlow(player, AbilityType.CLICK); new LavaFlow(player, AbilityType.CLICK);
} } else if (abil.equalsIgnoreCase("EarthSmash")) {
else if (abil.equalsIgnoreCase("EarthSmash")) {
new EarthSmash(player, ClickType.LEFT_CLICK); new EarthSmash(player, ClickType.LEFT_CLICK);
} } else if (abil.equalsIgnoreCase("SandSpout")) {
else if (abil.equalsIgnoreCase("SandSpout")) {
new SandSpout(player); new SandSpout(player);
} }
} }
if (coreAbil instanceof FireAbility && bPlayer.isElementToggled(Element.FIRE) == true) { if (coreAbil instanceof FireAbility && bPlayer.isElementToggled(Element.FIRE) == true) {
if (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) && !plugin.getConfig().getBoolean("Properties.Fire.CanBendWithWeapons")) { if (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType())
&& !plugin.getConfig().getBoolean("Properties.Fire.CanBendWithWeapons")) {
return; return;
} }
if (abil.equalsIgnoreCase("Blaze")) { if (abil.equalsIgnoreCase("Blaze")) {
new Blaze(player); new Blaze(player);
} } else if (abil.equalsIgnoreCase("FireBlast")) {
else if (abil.equalsIgnoreCase("FireBlast")) {
new FireBlast(player); new FireBlast(player);
} } else if (abil.equalsIgnoreCase("FireJet")) {
else if (abil.equalsIgnoreCase("FireJet")) {
new FireJet(player); new FireJet(player);
} } else if (abil.equalsIgnoreCase("HeatControl")) {
else if (abil.equalsIgnoreCase("HeatControl")) {
new HeatControl(player, HeatControlType.MELT); new HeatControl(player, HeatControlType.MELT);
} } else if (abil.equalsIgnoreCase("Illumination")) {
else if (abil.equalsIgnoreCase("Illumination")) {
if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.Illumination.Passive")) { if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.Illumination.Passive")) {
bPlayer.toggleIllumination(); bPlayer.toggleIllumination();
} else { } else {
new Illumination(player); 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 (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) && !plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) { if (GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType())
&& !plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
return; return;
} }
if (abil.equalsIgnoreCase("HighJump")) { if (abil.equalsIgnoreCase("HighJump")) {
new HighJump(player); new HighJump(player);
} } else if (abil.equalsIgnoreCase("Smokescreen")) {
else if (abil.equalsIgnoreCase("RapidPunch")) {
new RapidPunch(player);
}
else if (abil.equalsIgnoreCase("Smokescreen")) {
new Smokescreen(player); new Smokescreen(player);
} } else if (abil.equalsIgnoreCase("WarriorStance")) {
else if (abil.equalsIgnoreCase("WarriorStance")) {
new WarriorStance(player); new WarriorStance(player);
} } else if (abil.equalsIgnoreCase("AcrobatStance")) {
else if (abil.equalsIgnoreCase("AcrobatStance")) {
new AcrobatStance(player); new AcrobatStance(player);
} }
else if (abil.equalsIgnoreCase("QuickStrike")) {
new QuickStrike(player);
}
else if (abil.equalsIgnoreCase("SwiftKick")) {
new SwiftKick(player);
}
} }
if (abil.equalsIgnoreCase("AvatarState")) { if (abil.equalsIgnoreCase("AvatarState")) {
@ -1660,7 +1677,9 @@ public class PKListener implements Listener {
} }
Player player = event.getPlayer(); Player player = event.getPlayer();
if (CoreAbility.hasAbility(player, Tornado.class) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player) || CoreAbility.hasAbility(player, FireJet.class) || CoreAbility.hasAbility(player, AvatarState.class)) { if (CoreAbility.hasAbility(player, Tornado.class) || Bloodbending.isBloodbent(player)
|| Suffocate.isBreathbent(player) || CoreAbility.hasAbility(player, FireJet.class)
|| CoreAbility.hasAbility(player, AvatarState.class)) {
event.setCancelled(player.getGameMode() != GameMode.CREATIVE); event.setCancelled(player.getGameMode() != GameMode.CREATIVE);
} }
} }

View file

@ -131,7 +131,8 @@ public class AirSwipe extends AirAbility {
location = location.clone().add(direction.clone().multiply(speed)); location = location.clone().add(direction.clone().multiply(speed));
elements.put(direction, location); elements.put(direction, location);
if (location.distanceSquared(origin) > range * range || GeneralMethods.isRegionProtectedFromBuild(this, location)) { if (location.distanceSquared(origin) > range * range
|| GeneralMethods.isRegionProtectedFromBuild(this, location)) {
elements.remove(direction); elements.remove(direction);
} else { } else {
Block block = location.getBlock(); Block block = location.getBlock();
@ -152,7 +153,11 @@ public class AirSwipe extends AirAbility {
if (block.getType() != Material.AIR) { if (block.getType() != Material.AIR) {
if (isBlockBreakable(block)) { if (isBlockBreakable(block)) {
GeneralMethods.breakBlock(block); GeneralMethods.breakBlock(block);
}
if (block.getType().equals(Material.SNOW)) {
continue;
} else { } else {
elements.remove(direction); elements.remove(direction);
} }
if (isLava(block)) { if (isLava(block)) {
@ -197,7 +202,8 @@ public class AirSwipe extends AirAbility {
} }
if (entities.size() < MAX_AFFECTABLE_ENTITIES) { if (entities.size() < MAX_AFFECTABLE_ENTITIES) {
if (bPlayer.isAvatarState()) { if (bPlayer.isAvatarState()) {
GeneralMethods.setVelocity(entity, fDirection.multiply(AvatarState.getValue(pushFactor))); GeneralMethods.setVelocity(entity,
fDirection.multiply(AvatarState.getValue(pushFactor)));
} else { } else {
GeneralMethods.setVelocity(entity, fDirection.multiply(pushFactor)); GeneralMethods.setVelocity(entity, fDirection.multiply(pushFactor));
} }
@ -282,7 +288,8 @@ public class AirSwipe extends AirAbility {
} else if (bPlayer.isAvatarState()) { } else if (bPlayer.isAvatarState()) {
factor = AvatarState.getValue(factor); factor = AvatarState.getValue(factor);
} else { } else {
factor = maxChargeFactor * (double) (System.currentTimeMillis() - getStartTime()) / (double) maxChargeTime; factor = maxChargeFactor * (double) (System.currentTimeMillis() - getStartTime())
/ (double) maxChargeTime;
} }
charging = false; charging = false;

View file

@ -27,11 +27,13 @@ public class HighJump extends ChiAbility {
private void jump(Player p) { private void jump(Player p) {
if (!GeneralMethods.isSolid(p.getLocation().getBlock().getRelative(BlockFace.DOWN))) { if (!GeneralMethods.isSolid(p.getLocation().getBlock().getRelative(BlockFace.DOWN))) {
remove();
return; return;
} }
Vector vec = p.getVelocity(); Vector vec = p.getVelocity();
vec.setY(height); vec.setY(height);
p.setVelocity(vec); p.setVelocity(vec);
bPlayer.addCooldown(this);
return; return;
} }
@ -47,7 +49,7 @@ public class HighJump extends ChiAbility {
if (waw != null) { if (waw != null) {
waw.setGrabbed(false); waw.setGrabbed(false);
} }
bPlayer.addCooldown(this);
} }
@Override @Override

View file

@ -1,27 +1,28 @@
package com.projectkorra.projectkorra.chiblocking; package com.projectkorra.projectkorra.chiblocking;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
public class QuickStrike extends ChiAbility { public class QuickStrike extends ChiAbility {
private int damage; private int damage;
private int blockChance; private int blockChance;
private Entity target; private Entity target;
private long cooldown;
public QuickStrike(Player player) { public QuickStrike(Player sourceplayer, Entity targetentity) {
super(player); super(sourceplayer);
if (!bPlayer.canBend(this)) { if (!bPlayer.canBend(this)) {
return; return;
} }
this.damage = getConfig().getInt("Abilities.Chi.QuickStrike.Damage"); this.damage = getConfig().getInt("Abilities.Chi.QuickStrike.Damage");
this.cooldown = getConfig().getLong("Abilities.Chi.QuickStrike.Cooldown");
this.blockChance = getConfig().getInt("Abilities.Chi.QuickStrike.ChiBlockChance"); this.blockChance = getConfig().getInt("Abilities.Chi.QuickStrike.ChiBlockChance");
target = GeneralMethods.getTargetedEntity(player, 2); target = targetentity;
if (target == null) { if (target == null) {
return; return;
} }
@ -30,15 +31,20 @@ public class QuickStrike extends ChiAbility {
@Override @Override
public void progress() { public void progress() {
if (bPlayer.isOnCooldown(this)) {
return;
}
if (target == null) { if (target == null) {
remove(); remove();
return; return;
} }
DamageHandler.damageEntity(target, damage, this); DamageHandler.damageEntity(target, damage, this);
bPlayer.addCooldown(this);
if (target instanceof Player && ChiPassive.willChiBlock(player, (Player) target)) { if (target instanceof Player && ChiPassive.willChiBlock(player, (Player) target)) {
ChiPassive.blockChi((Player) target); ChiPassive.blockChi((Player) target);
} }
remove(); remove();
} }
@ -54,7 +60,7 @@ public class QuickStrike extends ChiAbility {
@Override @Override
public long getCooldown() { public long getCooldown() {
return 0; return cooldown;
} }
@Override @Override

View file

@ -19,8 +19,8 @@ public class RapidPunch extends ChiAbility {
private int numPunches; private int numPunches;
private Entity target; private Entity target;
public RapidPunch(Player player) { public RapidPunch(Player sourceplayer, Entity targetentity) {
super(player); super(sourceplayer);
if (!bPlayer.canBend(this)) { if (!bPlayer.canBend(this)) {
return; return;
} }

View file

@ -1,14 +1,13 @@
package com.projectkorra.projectkorra.chiblocking; package com.projectkorra.projectkorra.chiblocking;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
public class SwiftKick extends ChiAbility { public class SwiftKick extends ChiAbility {
private int damage; private int damage;
@ -16,15 +15,15 @@ public class SwiftKick extends ChiAbility {
private long cooldown; private long cooldown;
private Entity target; private Entity target;
public SwiftKick(Player player) { public SwiftKick(Player sourceplayer, Entity targetentity) {
super(player); super(sourceplayer);
if (!bPlayer.canBend(this)) { if (!bPlayer.canBend(this)) {
return; return;
} }
this.damage = getConfig().getInt("Abilities.Chi.SwiftKick.Damage"); this.damage = getConfig().getInt("Abilities.Chi.SwiftKick.Damage");
this.blockChance = getConfig().getInt("Abilities.Chi.SwiftKick.ChiBlockChance"); this.blockChance = getConfig().getInt("Abilities.Chi.SwiftKick.ChiBlockChance");
this.cooldown = getConfig().getInt("Abilities.Chi.SwiftKick.Cooldown"); this.cooldown = getConfig().getInt("Abilities.Chi.SwiftKick.Cooldown");
this.target = GeneralMethods.getTargetedEntity(player, 4); this.target = targetentity;
start(); start();
} }

View file

@ -1139,7 +1139,8 @@ public class ConfigManager {
config.addDefault("Abilities.Chi.WarriorStance.Resistance", -1); config.addDefault("Abilities.Chi.WarriorStance.Resistance", -1);
config.addDefault("Abilities.Chi.QuickStrike.Enabled", true); config.addDefault("Abilities.Chi.QuickStrike.Enabled", true);
config.addDefault("Abilities.Chi.QuickStrike.Damage", 1); config.addDefault("Abilities.Chi.QuickStrike.Damage", 2);
config.addDefault("Abilities.Chi.QuickStrike.Cooldown", 3000);
config.addDefault("Abilities.Chi.QuickStrike.ChiBlockChance", 10); config.addDefault("Abilities.Chi.QuickStrike.ChiBlockChance", 10);
config.addDefault("Abilities.Chi.SwiftKick.Enabled", true); config.addDefault("Abilities.Chi.SwiftKick.Enabled", true);

View file

@ -365,7 +365,12 @@ public class FireCombo extends FireAbility implements ComboAbility {
} }
Block topBlock = GeneralMethods.getTopBlock(location, 2, -4); Block topBlock = GeneralMethods.getTopBlock(location, 2, -4);
if (topBlock.getType().equals(Material.SNOW)){
topBlock = topBlock.getLocation().add(0, -1, 0).getBlock();
}
if (topBlock == null || (WaterAbility.isWaterbendable(player, ability, topBlock) && !isPlant(topBlock))) { if (topBlock == null || (WaterAbility.isWaterbendable(player, ability, topBlock) && !isPlant(topBlock))) {
remove(); remove();
return; return;
} else if (topBlock.getType() == Material.FIRE || ElementalAbility.isPlant(topBlock)) { } else if (topBlock.getType() == Material.FIRE || ElementalAbility.isPlant(topBlock)) {