diff --git a/.github/PULL_REQUEST_TEMPLATE b/.github/PULL_REQUEST_TEMPLATE
index c362c5af..5d3aa37e 100644
--- a/.github/PULL_REQUEST_TEMPLATE
+++ b/.github/PULL_REQUEST_TEMPLATE
@@ -1,9 +1,17 @@
-Links to Appropriate Issue Reports Addressed in this Pull Request:
-- One
-- Two
-- Three
+Fill in whatever sections apply, feel free to remove any others. :thumbsup:
-Release Notes for this Pull Request:
-- One
-- Two
-- Three
+## Additions
+* Adds 1.
+ > * Link to GitHub Issue(s) / Trello Card(s) if applicable.
+
+## Fixes
+* Fixes 2
+ > * Link to GitHub Issue(s) / Trello Card(s) if applicable.
+
+## Removals
+* Removes 3.
+ > * Link to GitHub Issue(s) / Trello Card(s) if applicable.
+
+## Misc. Changes
+* Changes 4 to 5.
+ > * Link to GitHub Issue(s) / Trello Card(s) if applicable.
diff --git a/.travis.yml b/.travis.yml
index befbc06d..56d5fa9b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,7 +2,6 @@ language: java
script: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
sudo: false
jdk:
- - oraclejdk7
- oraclejdk8
notifications:
slack:
diff --git a/README.md b/README.md
index 95845de4..e0281984 100644
--- a/README.md
+++ b/README.md
@@ -8,9 +8,13 @@
ProjectKorra is a place for members across the Minecraft and Bending Communities to come together and interact. ProjectKorra is one of the biggest Minecraft and Avatar/Korra related communities around and is still growing rapidly. Our goal is to bridge the two communities, providing users with a way to implement aspects of the hit television shows "Avatar: The Last Airbender" and "The Legend of Korra" into Minecraft.
+## Contributing
+
+We are always eager to see active developers in the community making pull requests to ProjectKorra and invite you to do so. We just ask that all incoming pull requests be made to the `wip` branch and that you try your best to adhere to our pull request template. If you find yourself contributing a lot and want to get more involved with the plugins community you may want to consider joining our development team [here](http://projectkorra.com/join-the-team/).
+
## Downloads
-You can find the latest recommended build on the official [Projectkorra Downloads Page](http://projectkorra.com/resources/categories/official-plugin-releases.2/).
+You can find the latest recommended build on the official [Projectkorra Downloads Page](http://projectkorra.com/downloads/).
Additionally, you can find the latest BETA builds in the resources section of the ProjectKorra forum, or you can use the Downloads page to download the latest. Stability of BETA builds are never promised, but usually anything pushed to the BETA Build section of the forum is at least runnable.
diff --git a/lib/PreciousStones 10.6.1.jar b/lib/PreciousStones 10.6.1.jar
new file mode 100644
index 00000000..cb267131
Binary files /dev/null and b/lib/PreciousStones 10.6.1.jar differ
diff --git a/lib/PreciousStones 9.7.1.jar b/lib/PreciousStones 9.7.1.jar
deleted file mode 100644
index b3cdd7e1..00000000
Binary files a/lib/PreciousStones 9.7.1.jar and /dev/null differ
diff --git a/lib/spigot-1.12-R0.1-SNAPSHOT.jar b/lib/spigot-1.12.1.jar
similarity index 89%
rename from lib/spigot-1.12-R0.1-SNAPSHOT.jar
rename to lib/spigot-1.12.1.jar
index 8845ace4..adf6ef4b 100644
Binary files a/lib/spigot-1.12-R0.1-SNAPSHOT.jar and b/lib/spigot-1.12.1.jar differ
diff --git a/pom.xml b/pom.xml
index b5dfeee0..76179b11 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.projectkorra
projectkorra
- 1.8.5
+ 1.8.6
jar
ProjectKorra
@@ -16,14 +16,14 @@
-
-
+
+
+ org.spigotmc
+ Spigot-Server
+ LATEST
+ system
+ ${project.basedir}/lib/spigot-1.12.1.jar
+
com.massivecraft
@@ -70,7 +70,7 @@
PreciousStones
LATEST
system
- ${project.basedir}/lib/PreciousStones 9.7.1.jar
+ ${project.basedir}/lib/PreciousStones 10.6.1.jar
@@ -136,13 +136,6 @@
system
${project.basedir}/lib/GLib.jar
-
- org.spigotmc
- Spigot-Server
- LATEST
- system
- ${project.basedir}/lib/spigot-1.12-R0.1-SNAPSHOT.jar
-
@@ -165,8 +158,8 @@
maven-compiler-plugin
3.1
-
- 1.7
+
+ 1.8
diff --git a/src/com/projectkorra/projectkorra/BendingManager.java b/src/com/projectkorra/projectkorra/BendingManager.java
index 43b9adc4..e1e14b6c 100644
--- a/src/com/projectkorra/projectkorra/BendingManager.java
+++ b/src/com/projectkorra/projectkorra/BendingManager.java
@@ -10,12 +10,14 @@ import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.FireAbility;
-import com.projectkorra.projectkorra.chiblocking.combo.Immobilize;
import com.projectkorra.projectkorra.configuration.ConfigManager;
+import com.projectkorra.projectkorra.earthbending.metal.MetalClips;
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
+import com.projectkorra.projectkorra.util.ActionBar;
import com.projectkorra.projectkorra.util.Flight;
import com.projectkorra.projectkorra.util.RevertChecker;
import com.projectkorra.projectkorra.util.TempPotionEffect;
+import com.projectkorra.projectkorra.waterbending.blood.Bloodbending;
import com.projectkorra.rpg.RPGMethods;
public class BendingManager implements Runnable {
@@ -110,9 +112,15 @@ public class BendingManager implements Runnable {
handleDayNight();
Flight.handle();
RevertChecker.revertAirBlocks();
- Immobilize.handleParalysis();
HorizontalVelocityTracker.updateAll();
handleCooldowns();
+ for (Player player : Bukkit.getServer().getOnlinePlayers()) {
+ if (MetalClips.isControlled(player)) {
+ ActionBar.sendActionBar(Element.METAL.getColor() + "* MetalClipped *", player);
+ } else if (Bloodbending.isBloodbent(player)) {
+ ActionBar.sendActionBar(Element.BLOOD.getColor() + "* Bloodbent *", player);
+ }
+ }
}
catch (Exception e) {
e.printStackTrace();
diff --git a/src/com/projectkorra/projectkorra/BendingPlayer.java b/src/com/projectkorra/projectkorra/BendingPlayer.java
index 67657755..551a4597 100644
--- a/src/com/projectkorra/projectkorra/BendingPlayer.java
+++ b/src/com/projectkorra/projectkorra/BendingPlayer.java
@@ -23,7 +23,6 @@ import com.projectkorra.projectkorra.ability.FireAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.ability.util.PassiveManager;
import com.projectkorra.projectkorra.avatar.AvatarState;
-import com.projectkorra.projectkorra.chiblocking.Paralyze;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.earthbending.metal.MetalClips;
@@ -619,7 +618,7 @@ public class BendingPlayer {
}
public boolean isParalyzed() {
- return Paralyze.isParalyzed(player);
+ return player.hasMetadata("movement:stop");
}
/**
diff --git a/src/com/projectkorra/projectkorra/GeneralMethods.java b/src/com/projectkorra/projectkorra/GeneralMethods.java
index 1f6843d5..3103ec0e 100644
--- a/src/com/projectkorra/projectkorra/GeneralMethods.java
+++ b/src/com/projectkorra/projectkorra/GeneralMethods.java
@@ -136,13 +136,13 @@ import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
-import net.sacredlabyrinth.Phaed.PreciousStones.FieldFlag;
import net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones;
+import net.sacredlabyrinth.Phaed.PreciousStones.field.FieldFlag;
@SuppressWarnings("deprecation")
public class GeneralMethods {
- public static final Integer[] NON_OPAQUE = { 0, 6, 8, 9, 10, 11, 27, 28, 30, 31, 32, 37, 38, 39, 40, 50, 51, 55, 59, 66, 68, 69, 70, 72, 75, 76, 77, 78, 83, 90, 93, 94, 104, 105, 106, 111, 115, 119, 127, 131, 132, 175 };
+ public static final Material[] NON_OPAQUE = { Material.AIR, Material.SAPLING, Material.WATER, Material.STATIONARY_WATER, Material.LAVA, Material.STATIONARY_LAVA, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.WEB, Material.LONG_GRASS, Material.DEAD_BUSH, Material.YELLOW_FLOWER, Material.RED_ROSE, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.TORCH, Material.FIRE, Material.REDSTONE_WIRE, Material.CROPS, Material.LADDER, Material.RAILS, Material.SIGN_POST, Material.LEVER, Material.STONE_PLATE, Material.WOOD_PLATE, Material.REDSTONE_TORCH_OFF, Material.REDSTONE_TORCH_ON, Material.STONE_BUTTON, Material.SNOW, Material.SUGAR_CANE_BLOCK, Material.PORTAL, Material.DIODE_BLOCK_OFF, Material.DIODE_BLOCK_ON, Material.PUMPKIN_STEM, Material.MELON_STEM, Material.VINE, Material.WATER_LILY, Material.NETHER_WART_BLOCK, Material.ENDER_PORTAL, Material.COCOA, Material.TRIPWIRE_HOOK, Material.TRIPWIRE, Material.FLOWER_POT, Material.CARROT, Material.POTATO, Material.WOOD_BUTTON, Material.GOLD_PLATE, Material.IRON_PLATE, Material.REDSTONE_COMPARATOR_OFF, Material.REDSTONE_COMPARATOR_ON, Material.DAYLIGHT_DETECTOR, Material.CARPET, Material.DOUBLE_PLANT, Material.STANDING_BANNER, Material.WALL_BANNER, Material.DAYLIGHT_DETECTOR_INVERTED,Material.END_ROD, Material.CHORUS_PLANT, Material.CHORUS_FLOWER, Material.BEETROOT_BLOCK, Material.END_GATEWAY };
public static final Material[] INTERACTABLE_MATERIALS = { Material.ACACIA_DOOR, Material.ACACIA_FENCE_GATE, Material.ANVIL, Material.BEACON, Material.BED_BLOCK, Material.BIRCH_DOOR, Material.BIRCH_FENCE_GATE, Material.BOAT, Material.BREWING_STAND, Material.BURNING_FURNACE, Material.CAKE_BLOCK, Material.CHEST, Material.COMMAND, Material.DARK_OAK_DOOR, Material.DARK_OAK_FENCE_GATE, Material.DISPENSER, Material.DRAGON_EGG, Material.DROPPER, Material.ENCHANTMENT_TABLE, Material.ENDER_CHEST, Material.ENDER_PORTAL_FRAME, Material.FENCE_GATE, Material.FURNACE, Material.HOPPER, Material.HOPPER_MINECART, Material.COMMAND_MINECART, Material.JUKEBOX, Material.JUNGLE_DOOR, Material.JUNGLE_FENCE_GATE, Material.LEVER, Material.MINECART, Material.NOTE_BLOCK, Material.SPRUCE_DOOR, Material.SPRUCE_FENCE_GATE, Material.STONE_BUTTON, Material.TRAPPED_CHEST, Material.TRAP_DOOR, Material.WOOD_BUTTON, Material.WOOD_DOOR, Material.WORKBENCH };
// Represents PlayerName, previously checked blocks, and whether they were true or false
@@ -1128,18 +1128,18 @@ public class GeneralMethods {
return getTargetedEntity(player, range, new ArrayList());
}
- public static Location getTargetedLocation(Player player, double originselectrange, Integer... nonOpaque2) {
+ public static Location getTargetedLocation(Player player, double originselectrange, Material... nonOpaque2) {
Location origin = player.getEyeLocation();
Vector direction = origin.getDirection();
- HashSet trans = new HashSet();
- trans.add((byte) 0);
+ HashSet trans = new HashSet();
+ trans.add(Material.AIR);
if (nonOpaque2 == null) {
trans = null;
} else {
- for (int i : nonOpaque2) {
- trans.add((byte) i);
+ for (Material material : nonOpaque2) {
+ trans.add(material);
}
}
@@ -1154,7 +1154,7 @@ public class GeneralMethods {
}
public static Location getTargetedLocation(Player player, int range) {
- return getTargetedLocation(player, range, 0);
+ return getTargetedLocation(player, range, Material.AIR);
}
public static Block getTopBlock(Location loc, int range) {
@@ -1289,7 +1289,7 @@ public class GeneralMethods {
for (double i = 0; i <= max; i++) {
loc = location1.clone().add(direction.clone().multiply(i));
Material type = loc.getBlock().getType();
- if (type != Material.AIR && !(Arrays.asList(ElementalAbility.getTransparentMaterialSet()).contains(type.getId()) || ElementalAbility.isWater(loc.getBlock()))) {
+ if (type != Material.AIR && !(ElementalAbility.getTransparentMaterialSet().contains(type) || ElementalAbility.isWater(loc.getBlock()))) {
return true;
}
}
@@ -1537,7 +1537,7 @@ public class GeneralMethods {
}
public static boolean isSolid(Block block) {
- return !Arrays.asList(NON_OPAQUE).contains(block.getTypeId());
+ return !Arrays.asList(NON_OPAQUE).contains(block.getType());
}
/** Checks if an entity is Undead **/
diff --git a/src/com/projectkorra/projectkorra/PKListener.java b/src/com/projectkorra/projectkorra/PKListener.java
index 60cb542d..8763e597 100644
--- a/src/com/projectkorra/projectkorra/PKListener.java
+++ b/src/com/projectkorra/projectkorra/PKListener.java
@@ -38,6 +38,7 @@ import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
+import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityInteractEvent;
@@ -104,7 +105,6 @@ import com.projectkorra.projectkorra.chiblocking.RapidPunch;
import com.projectkorra.projectkorra.chiblocking.Smokescreen;
import com.projectkorra.projectkorra.chiblocking.SwiftKick;
import com.projectkorra.projectkorra.chiblocking.WarriorStance;
-import com.projectkorra.projectkorra.chiblocking.combo.Immobilize;
import com.projectkorra.projectkorra.chiblocking.passive.Acrobatics;
import com.projectkorra.projectkorra.chiblocking.passive.ChiPassive;
import com.projectkorra.projectkorra.command.Commands;
@@ -157,6 +157,7 @@ import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.Flight;
+import com.projectkorra.projectkorra.util.MovementHandler;
import com.projectkorra.projectkorra.util.PassiveHandler;
import com.projectkorra.projectkorra.util.TempArmor;
import com.projectkorra.projectkorra.util.TempBlock;
@@ -364,7 +365,7 @@ public class PKListener implements Listener {
return;
}
Player player = event.getPlayer();
- if (Paralyze.isParalyzed(player) || Immobilize.isParalyzed(player) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) {
+ if (MovementHandler.isStopped(player) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) {
event.setCancelled(true);
}
}
@@ -408,7 +409,7 @@ public class PKListener implements Listener {
}
Entity entity = event.getEntity();
- if (Paralyze.isParalyzed(entity) || Immobilize.isParalyzed(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) {
+ if (MovementHandler.isStopped(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) {
event.setCancelled(true);
}
@@ -468,6 +469,10 @@ public class PKListener implements Listener {
event.setCancelled(true);
FireDamageTimer.dealFlameDamage(entity);
}
+
+ if (TempArmor.hasTempArmor((LivingEntity)entity)) {
+ event.setDamage(DamageModifier.ARMOR, 0);
+ }
if (entity instanceof Player) {
Player player = (Player) entity;
@@ -589,7 +594,7 @@ public class PKListener implements Listener {
Entity entity = event.getEntity();
if (entity != null) {
- if (Paralyze.isParalyzed(entity) || Immobilize.isParalyzed(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) {
+ if (MovementHandler.isStopped(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) {
event.setCancelled(true);
}
}
@@ -602,7 +607,7 @@ public class PKListener implements Listener {
}
Entity entity = event.getEntity();
- if (Paralyze.isParalyzed(entity) || Immobilize.isParalyzed(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) {
+ if (MovementHandler.isStopped(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) {
event.setCancelled(true);
}
}
@@ -614,7 +619,7 @@ public class PKListener implements Listener {
}
Entity entity = event.getEntity();
- if (Paralyze.isParalyzed(entity) || Immobilize.isParalyzed(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) {
+ if (MovementHandler.isStopped(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) {
event.setCancelled(true);
}
}
@@ -626,7 +631,7 @@ public class PKListener implements Listener {
}
Entity entity = event.getEntity();
- if (Paralyze.isParalyzed(entity) || Immobilize.isParalyzed(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) {
+ if (MovementHandler.isStopped(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) {
event.setCancelled(true);
}
}
@@ -638,7 +643,7 @@ public class PKListener implements Listener {
}
Entity entity = event.getEntity();
- if (Paralyze.isParalyzed(entity) || Immobilize.isParalyzed(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) {
+ if (MovementHandler.isStopped(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) {
event.setCancelled(true);
}
}
@@ -663,7 +668,7 @@ public class PKListener implements Listener {
}
Entity entity = event.getEntity();
- if (Paralyze.isParalyzed(entity) || Immobilize.isParalyzed(entity) || Bloodbending.isBloodbent(entity)) {
+ if (MovementHandler.isStopped(entity) || Bloodbending.isBloodbent(entity)) {
event.setCancelled(true);
}
}
@@ -675,7 +680,7 @@ public class PKListener implements Listener {
}
Entity entity = event.getEntity();
- if (Paralyze.isParalyzed(entity) || Immobilize.isParalyzed(entity) || Bloodbending.isBloodbent(entity)) {
+ if (MovementHandler.isStopped(entity) || Bloodbending.isBloodbent(entity)) {
event.setCancelled(true);
}
}
@@ -687,7 +692,7 @@ public class PKListener implements Listener {
}
Entity entity = event.getEntity();
- if (Paralyze.isParalyzed(entity) || Immobilize.isParalyzed(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity) || MetalClips.isControlled((LivingEntity)entity)) {
+ if (MovementHandler.isStopped(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity) || MetalClips.isControlled((LivingEntity)entity)) {
event.setCancelled(true);
}
@@ -895,7 +900,7 @@ public class PKListener implements Listener {
return;
}
- if (Paralyze.isParalyzed(e.getDamager()) || Immobilize.isParalyzed(e.getDamager())) {
+ if (MovementHandler.isStopped(e.getDamager())) {
e.setCancelled(true);
return;
}
@@ -904,36 +909,33 @@ public class PKListener implements Listener {
Suffocate.remove((Player) entity);
}
- if (entity instanceof Player) {
- if (source instanceof Player) { // This is the player hitting someone.
- Player sourcePlayer = (Player) source;
- Player targetPlayer = (Player) entity;
- BendingPlayer sourceBPlayer = BendingPlayer.getBendingPlayer(sourcePlayer);
- if (sourceBPlayer == null) {
- return;
- }
+ if (source instanceof Player) { // This is the player hitting someone.
+ Player sourcePlayer = (Player) source;
+ BendingPlayer sourceBPlayer = BendingPlayer.getBendingPlayer(sourcePlayer);
+ if (sourceBPlayer == null) {
+ return;
+ }
- String boundAbil = sourceBPlayer.getBoundAbilityName();
+ String boundAbil = sourceBPlayer.getBoundAbilityName();
- if (sourceBPlayer.canBendPassive(Element.CHI)) {
- if (e.getCause() == DamageCause.ENTITY_ATTACK && e.getDamage() == 1) {
- if (sourceBPlayer.getBoundAbility() instanceof ChiAbility) {
- if (sourceBPlayer.canCurrentlyBendWithWeapons()) {
- if (sourceBPlayer.isElementToggled(Element.CHI) == true) {
- if (boundAbil.equalsIgnoreCase("Paralyze")) {
- new Paralyze(sourcePlayer, targetPlayer);
- } else if (boundAbil.equalsIgnoreCase("QuickStrike")) {
- new QuickStrike(sourcePlayer, targetPlayer);
- e.setCancelled(true);
- } else if (boundAbil.equalsIgnoreCase("SwiftKick")) {
- new SwiftKick(sourcePlayer, targetPlayer);
- e.setCancelled(true);
- } else if (boundAbil.equalsIgnoreCase("RapidPunch")) {
- new RapidPunch(sourcePlayer, targetPlayer);
- e.setCancelled(true);
- } else {
- if (ChiPassive.willChiBlock(sourcePlayer, targetPlayer)) {
- ChiPassive.blockChi(targetPlayer);
+ if (sourceBPlayer.getBoundAbility() != null) {
+ if (!sourceBPlayer.isOnCooldown(boundAbil)) {
+ if (sourceBPlayer.canBendPassive(Element.CHI)) {
+ if (e.getCause() == DamageCause.ENTITY_ATTACK && e.getDamage() == 1) {
+ if (sourceBPlayer.getBoundAbility() instanceof ChiAbility) {
+ if (sourceBPlayer.canCurrentlyBendWithWeapons()) {
+ if (sourceBPlayer.isElementToggled(Element.CHI)) {
+ if (boundAbil.equalsIgnoreCase("Paralyze")) {
+ new Paralyze(sourcePlayer, entity);
+ } else if (boundAbil.equalsIgnoreCase("QuickStrike")) {
+ new QuickStrike(sourcePlayer, entity);
+ e.setCancelled(true);
+ } else if (boundAbil.equalsIgnoreCase("SwiftKick")) {
+ new SwiftKick(sourcePlayer, entity);
+ e.setCancelled(true);
+ } else if (boundAbil.equalsIgnoreCase("RapidPunch")) {
+ new RapidPunch(sourcePlayer, entity);
+ e.setCancelled(true);
}
}
}
@@ -941,6 +943,19 @@ public class PKListener implements Listener {
}
}
}
+ } else {
+ if (e.getCause() == DamageCause.ENTITY_ATTACK && e.getDamage() == 1) {
+ if (sourceBPlayer.canCurrentlyBendWithWeapons()) {
+ if (sourceBPlayer.isElementToggled(Element.CHI)) {
+ if (entity instanceof Player) {
+ Player targetPlayer = (Player) entity;
+ if (ChiPassive.willChiBlock(sourcePlayer, targetPlayer)) {
+ ChiPassive.blockChi(targetPlayer);
+ }
+ }
+ }
+ }
+ }
}
}
}
@@ -1009,15 +1024,17 @@ public class PKListener implements Listener {
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
- final UUID uuid = player.getUniqueId();
- RIGHT_CLICK_INTERACT.add(uuid);
-
- new BukkitRunnable() {
- @Override
- public void run() {
- RIGHT_CLICK_INTERACT.remove(uuid);
- }
- }.runTaskLater(plugin, 5);
+ if (!RIGHT_CLICK_INTERACT.contains(player.getUniqueId())) {
+ final UUID uuid = player.getUniqueId();
+ RIGHT_CLICK_INTERACT.add(uuid);
+
+ new BukkitRunnable() {
+ @Override
+ public void run() {
+ RIGHT_CLICK_INTERACT.remove(uuid);
+ }
+ }.runTaskLater(plugin, 5);
+ }
if (event.getHand() == EquipmentSlot.HAND) {
if (bPlayer.canCurrentlyBendWithWeapons()) {
@@ -1033,7 +1050,7 @@ public class PKListener implements Listener {
new EarthSmash(player, ClickType.RIGHT_CLICK);
}
}
- if (Paralyze.isParalyzed(player) || Immobilize.isParalyzed(player) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) {
+ if (MovementHandler.isStopped(player) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) {
event.setCancelled(true);
}
}
@@ -1051,7 +1068,7 @@ public class PKListener implements Listener {
ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK_ENTITY);
}
- if (Paralyze.isParalyzed(player) || Immobilize.isParalyzed(player) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) {
+ if (MovementHandler.isStopped(player) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) {
event.setCancelled(true);
}
@@ -1137,19 +1154,11 @@ public class PKListener implements Listener {
Player player = event.getPlayer();
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
- if (Paralyze.isParalyzed(player)) {
- event.setCancelled(true);
- return;
- }
-
- else if (Immobilize.isParalyzed(player)) {
- event.setCancelled(true);
- return;
- }
-
- else if (Lightning.isParalyzed(player)) {
- event.setCancelled(true);
- return;
+ if (MovementHandler.isStopped(player)) {
+ if (event.getTo().getX() != event.getFrom().getX() || event.getTo().getZ() != event.getFrom().getZ() || event.getTo().getY() > event.getFrom().getY()) {
+ event.setCancelled(true);
+ return;
+ }
}
else if (CoreAbility.hasAbility(player, WaterSpout.class) || CoreAbility.hasAbility(player, AirSpout.class) ) {
@@ -1301,7 +1310,7 @@ public class PKListener implements Listener {
}
}
- if (Paralyze.isParalyzed(player) || Immobilize.isParalyzed(player) || Bloodbending.isBloodbent(player)) {
+ if (MovementHandler.isStopped(player) || Bloodbending.isBloodbent(player)) {
event.setCancelled(true);
return;
}
@@ -1519,7 +1528,7 @@ public class PKListener implements Listener {
if (Suffocate.isBreathbent(player)) {
event.setCancelled(true);
return;
- } else if ((Bloodbending.isBloodbent(player) && !bPlayer.getBoundAbilityName().equalsIgnoreCase("AvatarState")) || Paralyze.isParalyzed(player) || Immobilize.isParalyzed(player)) {
+ } else if ((Bloodbending.isBloodbent(player) && !bPlayer.getBoundAbilityName().equalsIgnoreCase("AvatarState")) || MovementHandler.isStopped(player)) {
event.setCancelled(true);
return;
} else if (bPlayer.isChiBlocked()) {
diff --git a/src/com/projectkorra/projectkorra/ability/AirAbility.java b/src/com/projectkorra/projectkorra/ability/AirAbility.java
index 1234c2ce..7b9e23d9 100644
--- a/src/com/projectkorra/projectkorra/ability/AirAbility.java
+++ b/src/com/projectkorra/projectkorra/ability/AirAbility.java
@@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.ability;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.util.Collision;
import com.projectkorra.projectkorra.airbending.AirSpout;
import com.projectkorra.projectkorra.airbending.Suffocate;
@@ -138,8 +139,16 @@ public abstract class AirAbility extends ElementalAbility {
if (getConfig().getBoolean("Properties.Air.PlaySound")) {
float volume = (float) getConfig().getDouble("Properties.Air.Sound.Volume");
float pitch = (float) getConfig().getDouble("Properties.Air.Sound.Pitch");
+
+ Sound sound = Sound.ENTITY_CREEPER_HURT;
- loc.getWorld().playSound(loc, Sound.valueOf(getConfig().getString("Properties.Air.Sound.Sound")), volume, pitch);
+ try {
+ sound = Sound.valueOf(getConfig().getString("Properties.Air.Sound.Sound"));
+ } catch (IllegalArgumentException exception) {
+ ProjectKorra.log.warning("Your current value for 'Properties.Air.Sound.Sound' is not valid.");
+ } finally {
+ loc.getWorld().playSound(loc, sound, volume, pitch);
+ }
}
}
diff --git a/src/com/projectkorra/projectkorra/ability/AvatarAbility.java b/src/com/projectkorra/projectkorra/ability/AvatarAbility.java
index 90581a1d..441a1953 100644
--- a/src/com/projectkorra/projectkorra/ability/AvatarAbility.java
+++ b/src/com/projectkorra/projectkorra/ability/AvatarAbility.java
@@ -1,6 +1,7 @@
package com.projectkorra.projectkorra.ability;
import com.projectkorra.projectkorra.Element;
+import com.projectkorra.projectkorra.ProjectKorra;
import org.bukkit.Location;
import org.bukkit.Sound;
@@ -32,7 +33,15 @@ public abstract class AvatarAbility extends ElementalAbility {
float volume = (float) getConfig().getDouble("Abilities.Avatar.AvatarState.Sound.Volume");
float pitch = (float) getConfig().getDouble("Abilities.Avatar.AvatarState.Sound.Pitch");
- loc.getWorld().playSound(loc, Sound.valueOf(getConfig().getString("Abilities.Avatar.AvatarState.Sound.Sound")), volume, pitch);
+ Sound sound = Sound.BLOCK_ANVIL_LAND;
+
+ try {
+ sound = Sound.valueOf(getConfig().getString("Properties.Avatar.AvatarState.Sound.Sound"));
+ } catch (IllegalArgumentException exception) {
+ ProjectKorra.log.warning("Your current value for 'Properties.Avatar.AvatarState.Sound.Sound' is not valid.");
+ } finally {
+ loc.getWorld().playSound(loc, sound, volume, pitch);
+ }
}
}
diff --git a/src/com/projectkorra/projectkorra/ability/EarthAbility.java b/src/com/projectkorra/projectkorra/ability/EarthAbility.java
index 8b05d269..bfe555ac 100644
--- a/src/com/projectkorra/projectkorra/ability/EarthAbility.java
+++ b/src/com/projectkorra/projectkorra/ability/EarthAbility.java
@@ -20,6 +20,7 @@ import org.bukkit.util.Vector;
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.util.Collision;
import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.earthbending.RaiseEarth;
@@ -499,7 +500,15 @@ public abstract class EarthAbility extends ElementalAbility {
float volume = (float) getConfig().getDouble("Properties.Earth.EarthSound.Volume");
float pitch = (float) getConfig().getDouble("Properties.Earth.EarthSound.Pitch");
- loc.getWorld().playSound(loc, Sound.valueOf(getConfig().getString("Properties.Earth.EarthSound.Sound")), volume, pitch);
+ Sound sound = Sound.ENTITY_GHAST_SHOOT;
+
+ try {
+ sound = Sound.valueOf(getConfig().getString("Properties.Earth.EarthSound.Sound"));
+ } catch (IllegalArgumentException exception) {
+ ProjectKorra.log.warning("Your current value for 'Properties.Earth.EarthSound.Sound' is not valid.");
+ } finally {
+ loc.getWorld().playSound(loc, sound, volume, pitch);
+ }
}
}
@@ -508,7 +517,15 @@ public abstract class EarthAbility extends ElementalAbility {
float volume = (float) getConfig().getDouble("Properties.Earth.MetalSound.Volume");
float pitch = (float) getConfig().getDouble("Properties.Earth.MetalSound.Pitch");
- loc.getWorld().playSound(loc, Sound.valueOf(getConfig().getString("Properties.Earth.MetalSound.Sound")), volume, pitch);
+ Sound sound = Sound.ENTITY_IRONGOLEM_HURT;
+
+ try {
+ sound = Sound.valueOf(getConfig().getString("Properties.Earth.MetalSound.Sound"));
+ } catch (IllegalArgumentException exception) {
+ ProjectKorra.log.warning("Your current value for 'Properties.Earth.MetalSound.Sound' is not valid.");
+ } finally {
+ loc.getWorld().playSound(loc, sound, volume, pitch);
+ }
}
}
@@ -517,7 +534,15 @@ public abstract class EarthAbility extends ElementalAbility {
float volume = (float) getConfig().getDouble("Properties.Earth.SandSound.Volume");
float pitch = (float) getConfig().getDouble("Properties.Earth.SandSound.Pitch");
- loc.getWorld().playSound(loc, Sound.valueOf(getConfig().getString("Properties.Earth.SandSound.Sound")), volume, pitch);
+ Sound sound = Sound.BLOCK_SAND_BREAK;
+
+ try {
+ sound = Sound.valueOf(getConfig().getString("Properties.Earth.SandSound.Sound"));
+ } catch (IllegalArgumentException exception) {
+ ProjectKorra.log.warning("Your current value for 'Properties.Earth.SandSound.Sound' is not valid.");
+ } finally {
+ loc.getWorld().playSound(loc, sound, volume, pitch);
+ }
}
}
public static void playLavabendingSound(Location loc) {
@@ -525,7 +550,15 @@ public abstract class EarthAbility extends ElementalAbility {
float volume = (float) getConfig().getDouble("Properties.Earth.LavaSound.Volume");
float pitch = (float) getConfig().getDouble("Properties.Earth.LavaSound.Pitch");
- loc.getWorld().playSound(loc, Sound.valueOf(getConfig().getString("Properties.Earth.LavaSound.Sound")), volume, pitch);
+ Sound sound = Sound.BLOCK_LAVA_AMBIENT;
+
+ try {
+ sound = Sound.valueOf(getConfig().getString("Properties.Earth.LavaSound.Sound"));
+ } catch (IllegalArgumentException exception) {
+ ProjectKorra.log.warning("Your current value for 'Properties.Earth.LavaSound.Sound' is not valid.");
+ } finally {
+ loc.getWorld().playSound(loc, sound, volume, pitch);
+ }
}
}
diff --git a/src/com/projectkorra/projectkorra/ability/ElementalAbility.java b/src/com/projectkorra/projectkorra/ability/ElementalAbility.java
index edde86bc..b896aa76 100644
--- a/src/com/projectkorra/projectkorra/ability/ElementalAbility.java
+++ b/src/com/projectkorra/projectkorra/ability/ElementalAbility.java
@@ -21,9 +21,6 @@ import com.projectkorra.rpg.event.EventManager;
* keep CoreAbility from becoming too cluttered.
*/
public abstract class ElementalAbility extends CoreAbility {
-
- private static final Integer[] TRANSPARENT_MATERIAL = { 0, 6, 8, 9, 10, 11, 30, 31, 32, 37, 38, 39, 40, 50, 51, 59, 78, 83, 106, 175 };
- //private static final Integer[] PLANT_IDS = { 6, 18, 31, 37, 38, 39, 40, 59, 81, 83, 86, 99, 100, 103, 104, 105, 106, 111, 161, 175 };
private static final PotionEffectType[] POSITIVE_EFFECTS = { PotionEffectType.ABSORPTION, PotionEffectType.DAMAGE_RESISTANCE, PotionEffectType.FAST_DIGGING, PotionEffectType.FIRE_RESISTANCE, PotionEffectType.HEAL, PotionEffectType.HEALTH_BOOST, PotionEffectType.INCREASE_DAMAGE, PotionEffectType.JUMP, PotionEffectType.NIGHT_VISION, PotionEffectType.REGENERATION, PotionEffectType.SATURATION, PotionEffectType.SPEED, PotionEffectType.WATER_BREATHING };
private static final PotionEffectType[] NEUTRAL_EFFECTS = { PotionEffectType.INVISIBILITY };
private static final PotionEffectType[] NEGATIVE_EFFECTS = { PotionEffectType.POISON, PotionEffectType.BLINDNESS, PotionEffectType.CONFUSION, PotionEffectType.HARM, PotionEffectType.HUNGER, PotionEffectType.SLOW, PotionEffectType.SLOW_DIGGING, PotionEffectType.WEAKNESS, PotionEffectType.WITHER };
@@ -36,15 +33,16 @@ public abstract class ElementalAbility extends CoreAbility {
return isTransparent(player, getName(), block);
}
- public static Integer[] getTransparentMaterial() {
- return TRANSPARENT_MATERIAL;
+ public static Material[] getTransparentMaterials() {
+ return GeneralMethods.NON_OPAQUE;
}
- public static HashSet getTransparentMaterialSet() {
- HashSet set = new HashSet();
- for (int i : TRANSPARENT_MATERIAL) {
- set.add((byte) i);
+ public static HashSet getTransparentMaterialSet() {
+ HashSet set = new HashSet();
+ for (Material material : getTransparentMaterials()) {
+ set.add(material);
}
+
return set;
}
@@ -53,9 +51,11 @@ public abstract class ElementalAbility extends CoreAbility {
if (world.getEnvironment() == Environment.NETHER || world.getEnvironment() == Environment.THE_END) {
return true;
}
+
if (time >= 23500 || time <= 12500) {
return true;
}
+
return false;
}
@@ -73,9 +73,11 @@ public abstract class ElementalAbility extends CoreAbility {
} else {
long days = world.getFullTime() / 24000;
long phase = days % 8;
+
if (phase == 0) {
return true;
}
+
return false;
}
}
@@ -108,6 +110,7 @@ public abstract class ElementalAbility extends CoreAbility {
if (world == null || !GeneralMethods.hasRPG()) {
return false;
}
+
return EventManager.marker.get(world).equalsIgnoreCase("LunarEclipse");
}
@@ -115,6 +118,7 @@ public abstract class ElementalAbility extends CoreAbility {
if (world == null || !GeneralMethods.hasRPG() || !EventManager.marker.containsKey(world)) {
return false;
}
+
return EventManager.marker.get(world).equalsIgnoreCase("SolarEclipse");
}
@@ -122,6 +126,7 @@ public abstract class ElementalAbility extends CoreAbility {
if (block.getType() == Material.ICE || block.getType() == Material.SNOW) {
return true;
}
+
return false;
}
@@ -137,6 +142,7 @@ public abstract class ElementalAbility extends CoreAbility {
if (block.getType() == Material.GOLD_BLOCK || block.getType() == Material.IRON_BLOCK || block.getType() == Material.IRON_ORE || block.getType() == Material.GOLD_ORE || block.getType() == Material.QUARTZ_BLOCK || block.getType() == Material.QUARTZ_ORE) {
return true;
}
+
return false;
}
@@ -146,6 +152,7 @@ public abstract class ElementalAbility extends CoreAbility {
return true;
}
}
+
return false;
}
@@ -155,6 +162,7 @@ public abstract class ElementalAbility extends CoreAbility {
return true;
}
}
+
return false;
}
@@ -164,9 +172,11 @@ public abstract class ElementalAbility extends CoreAbility {
}
long time = world.getTime();
+
if (time >= 12950 && time <= 23050) {
return true;
}
+
return false;
}
@@ -184,6 +194,7 @@ public abstract class ElementalAbility extends CoreAbility {
return true;
}
}
+
return false;
}
@@ -199,6 +210,7 @@ public abstract class ElementalAbility extends CoreAbility {
if (world == null || !GeneralMethods.hasRPG()) {
return false;
}
+
return EventManager.marker.get(world).equalsIgnoreCase("SozinsComet");
}
@@ -206,9 +218,8 @@ public abstract class ElementalAbility extends CoreAbility {
return isTransparent(player, null, block);
}
- @SuppressWarnings("deprecation")
public static boolean isTransparent(Player player, String abilityName, Block block) {
- return Arrays.asList(TRANSPARENT_MATERIAL).contains(block.getTypeId()) && !GeneralMethods.isRegionProtectedFromBuild(player, abilityName, block.getLocation());
+ return Arrays.asList(getTransparentMaterials()).contains(block.getType()) && !GeneralMethods.isRegionProtectedFromBuild(player, abilityName, block.getLocation());
}
public static boolean isUndead(Entity entity) {
@@ -217,6 +228,7 @@ public abstract class ElementalAbility extends CoreAbility {
} else if (entity.getType() == EntityType.ZOMBIE || entity.getType() == EntityType.BLAZE || entity.getType() == EntityType.GIANT || entity.getType() == EntityType.IRON_GOLEM || entity.getType() == EntityType.MAGMA_CUBE || entity.getType() == EntityType.PIG_ZOMBIE || entity.getType() == EntityType.SKELETON || entity.getType() == EntityType.SLIME || entity.getType() == EntityType.SNOWMAN || entity.getType() == EntityType.ZOMBIE) {
return true;
}
+
return false;
}
diff --git a/src/com/projectkorra/projectkorra/ability/FireAbility.java b/src/com/projectkorra/projectkorra/ability/FireAbility.java
index b7935e85..31527092 100644
--- a/src/com/projectkorra/projectkorra/ability/FireAbility.java
+++ b/src/com/projectkorra/projectkorra/ability/FireAbility.java
@@ -19,6 +19,7 @@ import org.bukkit.inventory.ItemStack;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.util.Collision;
import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.firebending.BlazeArc;
@@ -160,7 +161,15 @@ public abstract class FireAbility extends ElementalAbility {
float volume = (float) getConfig().getDouble("Properties.Fire.CombustionSound.Volume");
float pitch = (float) getConfig().getDouble("Properties.Fire.CombustionSound.Pitch");
- loc.getWorld().playSound(loc, Sound.valueOf(getConfig().getString("Properties.Fire.CombustionSound.Sound")), volume, pitch);
+ Sound sound = Sound.ENTITY_FIREWORK_BLAST;
+
+ try {
+ sound = Sound.valueOf(getConfig().getString("Properties.Fire.CombustionSound.Sound"));
+ } catch (IllegalArgumentException exception) {
+ ProjectKorra.log.warning("Your current value for 'Properties.Fire.CombustionSound.Sound' is not valid.");
+ } finally {
+ loc.getWorld().playSound(loc, sound, volume, pitch);
+ }
}
}
@@ -173,7 +182,15 @@ public abstract class FireAbility extends ElementalAbility {
float volume = (float) getConfig().getDouble("Properties.Fire.FireSound.Volume");
float pitch = (float) getConfig().getDouble("Properties.Fire.FireSound.Pitch");
- loc.getWorld().playSound(loc, Sound.valueOf(getConfig().getString("Properties.Fire.FireSound.Sound")), volume, pitch);
+ Sound sound = Sound.BLOCK_FIRE_AMBIENT;
+
+ try {
+ sound = Sound.valueOf(getConfig().getString("Properties.Fire.FireSound.Sound"));
+ } catch (IllegalArgumentException exception) {
+ ProjectKorra.log.warning("Your current value for 'Properties.Fire.FireSound.Sound' is not valid.");
+ } finally {
+ loc.getWorld().playSound(loc, sound, volume, pitch);
+ }
}
}
@@ -193,7 +210,15 @@ public abstract class FireAbility extends ElementalAbility {
float volume = (float) getConfig().getDouble("Properties.Fire.LightningSound.Volume");
float pitch = (float) getConfig().getDouble("Properties.Fire.LightningSound.Pitch");
- loc.getWorld().playSound(loc, Sound.valueOf(getConfig().getString("Properties.Fire.LightningSound.Sound")), volume, pitch);
+ Sound sound = Sound.ENTITY_CREEPER_HURT;
+
+ try {
+ sound = Sound.valueOf(getConfig().getString("Properties.Fire.LightningSound.Sound"));
+ } catch (IllegalArgumentException exception) {
+ ProjectKorra.log.warning("Your current value for 'Properties.Fire.LightningSound.Sound' is not valid.");
+ } finally {
+ loc.getWorld().playSound(loc, sound, volume, pitch);
+ }
}
}
@@ -216,7 +241,6 @@ public abstract class FireAbility extends ElementalAbility {
*
* @param location The Location
*/
- @SuppressWarnings("deprecation")
public static void revertTempFire(Location location) {
if (!TEMP_FIRE.containsKey(location)) {
return;
diff --git a/src/com/projectkorra/projectkorra/ability/WaterAbility.java b/src/com/projectkorra/projectkorra/ability/WaterAbility.java
index 0e91ec36..9d979879 100644
--- a/src/com/projectkorra/projectkorra/ability/WaterAbility.java
+++ b/src/com/projectkorra/projectkorra/ability/WaterAbility.java
@@ -13,6 +13,7 @@ import org.bukkit.util.Vector;
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.util.Collision;
import com.projectkorra.projectkorra.firebending.HeatControl;
import com.projectkorra.projectkorra.util.BlockSource;
@@ -304,7 +305,15 @@ public abstract class WaterAbility extends ElementalAbility {
float volume = (float) getConfig().getDouble("Properties.Water.IceSound.Volume");
float pitch = (float) getConfig().getDouble("Properties.Water.IceSound.Pitch");
- loc.getWorld().playSound(loc, Sound.valueOf(getConfig().getString("Properties.Water.IceSound.Sound")), volume, pitch);
+ Sound sound = Sound.ITEM_FLINTANDSTEEL_USE;
+
+ try {
+ sound = Sound.valueOf(getConfig().getString("Properties.Water.IceSound.Sound"));
+ } catch (IllegalArgumentException exception) {
+ ProjectKorra.log.warning("Your current value for 'Properties.Water.IceSound.Sound' is not valid.");
+ } finally {
+ loc.getWorld().playSound(loc, sound, volume, pitch);
+ }
}
}
@@ -313,7 +322,15 @@ public abstract class WaterAbility extends ElementalAbility {
float volume = (float) getConfig().getDouble("Properties.Water.PlantSound.Volume");
float pitch = (float) getConfig().getDouble("Properties.Water.PlantSound.Pitch");
- loc.getWorld().playSound(loc, Sound.valueOf(getConfig().getString("Properties.Water.PlantSound.Sound")), volume, pitch);
+ Sound sound = Sound.BLOCK_GRASS_STEP;
+
+ try {
+ sound = Sound.valueOf(getConfig().getString("Properties.Water.PlantSound.Sound"));
+ } catch (IllegalArgumentException exception) {
+ ProjectKorra.log.warning("Your current value for 'Properties.Water.PlantSound.Sound' is not valid.");
+ } finally {
+ loc.getWorld().playSound(loc, sound, volume, pitch);
+ }
}
}
@@ -322,7 +339,15 @@ public abstract class WaterAbility extends ElementalAbility {
float volume = (float) getConfig().getDouble("Properties.Water.WaterSound.Volume");
float pitch = (float) getConfig().getDouble("Properties.Water.WaterSound.Pitch");
- loc.getWorld().playSound(loc, Sound.valueOf(getConfig().getString("Properties.Water.WaterSound.Sound")), volume, pitch);
+ Sound sound = Sound.BLOCK_WATER_AMBIENT;
+
+ try {
+ sound = Sound.valueOf(getConfig().getString("Properties.Water.WaterSound.Sound"));
+ } catch (IllegalArgumentException exception) {
+ ProjectKorra.log.warning("Your current value for 'Properties.Water.WaterSound.Sound' is not valid.");
+ } finally {
+ loc.getWorld().playSound(loc, sound, volume, pitch);
+ }
}
}
diff --git a/src/com/projectkorra/projectkorra/ability/util/ComboManager.java b/src/com/projectkorra/projectkorra/ability/util/ComboManager.java
index d3793957..c5dc2ff8 100644
--- a/src/com/projectkorra/projectkorra/ability/util/ComboManager.java
+++ b/src/com/projectkorra/projectkorra/ability/util/ComboManager.java
@@ -46,7 +46,7 @@ public class ComboManager {
DESCRIPTIONS.clear();
INSTRUCTIONS.clear();
- if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.FireCombo.FireKick.Enabled")) {
+ if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.FireKick.Enabled")) {
ArrayList fireKick = new ArrayList<>();
fireKick.add(new AbilityInformation("FireBlast", ClickType.LEFT_CLICK));
fireKick.add(new AbilityInformation("FireBlast", ClickType.LEFT_CLICK));
@@ -57,7 +57,7 @@ public class ComboManager {
INSTRUCTIONS.put("FireKick", "FireBlast > FireBlast > (Hold Shift) > FireBlast.");
}
- if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.FireCombo.FireSpin.Enabled")) {
+ if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.FireSpin.Enabled")) {
ArrayList fireSpin = new ArrayList<>();
fireSpin.add(new AbilityInformation("FireBlast", ClickType.LEFT_CLICK));
fireSpin.add(new AbilityInformation("FireBlast", ClickType.LEFT_CLICK));
@@ -69,7 +69,7 @@ public class ComboManager {
INSTRUCTIONS.put("FireSpin", "FireBlast > FireBlast > FireShield (Left Click) > FireShield (Tap Shift).");
}
- if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.FireCombo.JetBlast.Enabled")) {
+ if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.JetBlast.Enabled")) {
ArrayList jetBlast = new ArrayList<>();
jetBlast.add(new AbilityInformation("FireJet", ClickType.SHIFT_DOWN));
jetBlast.add(new AbilityInformation("FireJet", ClickType.SHIFT_UP));
@@ -83,7 +83,7 @@ public class ComboManager {
INSTRUCTIONS.put("JetBlast", "FireJet (Tap Shift) > FireJet (Tap Shift) > FireShield (Tap Shift) > FireJet.");
}
- if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.FireCombo.JetBlaze.Enabled")) {
+ if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.JetBlaze.Enabled")) {
ArrayList jetBlaze = new ArrayList<>();
jetBlaze.add(new AbilityInformation("FireJet", ClickType.SHIFT_DOWN));
jetBlaze.add(new AbilityInformation("FireJet", ClickType.SHIFT_UP));
@@ -97,7 +97,7 @@ public class ComboManager {
INSTRUCTIONS.put("JetBlaze", "FireJet (Tap Shift) > FireJet (Tap Shift) > Blaze (Tap Shift) > FireJet.");
}
- if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.FireCombo.FireWheel.Enabled")) {
+ if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.FireWheel.Enabled")) {
ArrayList fireWheel = new ArrayList<>();
fireWheel.add(new AbilityInformation("FireShield", ClickType.SHIFT_DOWN));
fireWheel.add(new AbilityInformation("FireShield", ClickType.RIGHT_CLICK_BLOCK));
@@ -108,7 +108,7 @@ public class ComboManager {
INSTRUCTIONS.put("FireWheel", "FireShield (Hold Shift) > Right Click a block in front of you twice > Switch to Blaze > Release Shift.");
}
- if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Air.AirCombo.Twister.Enabled")) {
+ if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Air.Twister.Enabled")) {
ArrayList twister = new ArrayList();
twister.add(new AbilityInformation("AirShield", ClickType.SHIFT_DOWN));
twister.add(new AbilityInformation("AirShield", ClickType.SHIFT_UP));
@@ -119,7 +119,7 @@ public class ComboManager {
INSTRUCTIONS.put("Twister", "AirShield (Tap Shift) > Tornado (Hold Shift) > AirBlast (Left Click)");
}
- if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Air.AirCombo.AirStream.Enabled")) {
+ if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Air.AirStream.Enabled")) {
ArrayList airStream = new ArrayList<>();
airStream.add(new AbilityInformation("AirShield", ClickType.SHIFT_DOWN));
airStream.add(new AbilityInformation("AirSuction", ClickType.LEFT_CLICK));
@@ -129,7 +129,7 @@ public class ComboManager {
INSTRUCTIONS.put("AirStream", "AirShield (Hold Shift) > AirSuction (Left Click) > AirBlast (Left Click)");
}
- if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Air.AirCombo.AirSweep.Enabled")) {
+ if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Air.AirSweep.Enabled")) {
ArrayList airSweep = new ArrayList<>();
airSweep.add(new AbilityInformation("AirSwipe", ClickType.LEFT_CLICK));
airSweep.add(new AbilityInformation("AirSwipe", ClickType.LEFT_CLICK));
@@ -140,7 +140,7 @@ public class ComboManager {
INSTRUCTIONS.put("AirSweep", "AirSwipe (Left Click) > AirSwipe (Left Click) > AirBurst (Hold Shift) > AirBurst (Left Click)");
}
- if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Water.WaterCombo.IceWave.Enabled")) {
+ if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Water.IceWave.Enabled")) {
ArrayList iceWave = new ArrayList<>();
iceWave.add(new AbilityInformation("WaterSpout", ClickType.SHIFT_UP));
iceWave.add(new AbilityInformation("PhaseChange", ClickType.LEFT_CLICK));
@@ -149,7 +149,7 @@ public class ComboManager {
INSTRUCTIONS.put("IceWave", "Create a WaterSpout Wave > PhaseChange (Left Click)");
}
- if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Water.WaterCombo.IceBullet.Enabled")) {
+ if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Water.IceBullet.Enabled")) {
ArrayList iceBullet = new ArrayList<>();
iceBullet.add(new AbilityInformation("WaterBubble", ClickType.SHIFT_DOWN));
iceBullet.add(new AbilityInformation("WaterBubble", ClickType.SHIFT_UP));
@@ -166,7 +166,7 @@ public class ComboManager {
COMBO_ABILITIES.put("IceBulletRightClick", new ComboAbilityInfo("IceBulletRightClick", iceBulletRight, IceBulletRightClick.class));
}
- if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Chi.ChiCombo.Immobilize.Enabled")) {
+ if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Chi.Immobilize.Enabled")) {
ArrayList immobilize = new ArrayList<>();
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK_ENTITY));
immobilize.add(new AbilityInformation("SwiftKick", ClickType.LEFT_CLICK_ENTITY));
diff --git a/src/com/projectkorra/projectkorra/airbending/AirBlast.java b/src/com/projectkorra/projectkorra/airbending/AirBlast.java
index 74d534ab..3daf3dff 100644
--- a/src/com/projectkorra/projectkorra/airbending/AirBlast.java
+++ b/src/com/projectkorra/projectkorra/airbending/AirBlast.java
@@ -181,7 +181,7 @@ public class AirBlast extends AirAbility {
}
public static void setOrigin(Player player) {
- Location location = GeneralMethods.getTargetedLocation(player, getSelectRange(), GeneralMethods.NON_OPAQUE);
+ Location location = GeneralMethods.getTargetedLocation(player, getSelectRange(), getTransparentMaterials());
if (location.getBlock().isLiquid() || GeneralMethods.isSolid(location.getBlock())) {
return;
} else if (GeneralMethods.isRegionProtectedFromBuild(player, "AirBlast", location)) {
diff --git a/src/com/projectkorra/projectkorra/airbending/AirSuction.java b/src/com/projectkorra/projectkorra/airbending/AirSuction.java
index 19a4c8be..5cff90a2 100644
--- a/src/com/projectkorra/projectkorra/airbending/AirSuction.java
+++ b/src/com/projectkorra/projectkorra/airbending/AirSuction.java
@@ -73,7 +73,7 @@ public class AirSuction extends AirAbility {
origin = player.getEyeLocation();
}
- location = GeneralMethods.getTargetedLocation(player, range, GeneralMethods.NON_OPAQUE);
+ location = GeneralMethods.getTargetedLocation(player, range, getTransparentMaterials());
direction = GeneralMethods.getDirection(location, origin).normalize();
Entity entity = GeneralMethods.getTargetedEntity(player, range);
@@ -119,7 +119,7 @@ public class AirSuction extends AirAbility {
}
public static void setOrigin(Player player) {
- Location location = GeneralMethods.getTargetedLocation(player, getSelectRange(), GeneralMethods.NON_OPAQUE);
+ Location location = GeneralMethods.getTargetedLocation(player, getSelectRange(), getTransparentMaterials());
if (location.getBlock().isLiquid() || GeneralMethods.isSolid(location.getBlock())) {
return;
} else if (GeneralMethods.isRegionProtectedFromBuild(player, "AirSuction", location)) {
diff --git a/src/com/projectkorra/projectkorra/airbending/Suffocate.java b/src/com/projectkorra/projectkorra/airbending/Suffocate.java
index 475b91cd..69ddcd5a 100644
--- a/src/com/projectkorra/projectkorra/airbending/Suffocate.java
+++ b/src/com/projectkorra/projectkorra/airbending/Suffocate.java
@@ -117,7 +117,7 @@ public class Suffocate extends AirAbility {
//List entities = GeneralMethods.getEntitiesAroundPoint(location, 1.5);
List entities = new ArrayList();
for (int i = 0; i < 6; i++) {
- Location location = GeneralMethods.getTargetedLocation(player, i, getTransparentMaterial());
+ Location location = GeneralMethods.getTargetedLocation(player, i, getTransparentMaterials());
entities = GeneralMethods.getEntitiesAroundPoint(location, 1.7);
if (entities.contains(player))
entities.remove(player);
diff --git a/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java b/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java
index d1930509..488fd6f9 100644
--- a/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java
+++ b/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java
@@ -100,7 +100,7 @@ public class AirStream extends AirAbility implements ComboAbility {
if (target != null && target.getLocation().distanceSquared(currentLoc) > 49) {
destination = target.getLocation();
} else {
- destination = GeneralMethods.getTargetedLocation(player, range, getTransparentMaterial());
+ destination = GeneralMethods.getTargetedLocation(player, range, getTransparentMaterials());
}
direction = GeneralMethods.getDirection(currentLoc, destination).normalize();
diff --git a/src/com/projectkorra/projectkorra/chiblocking/Paralyze.java b/src/com/projectkorra/projectkorra/chiblocking/Paralyze.java
index ef3fd43f..352a046e 100644
--- a/src/com/projectkorra/projectkorra/chiblocking/Paralyze.java
+++ b/src/com/projectkorra/projectkorra/chiblocking/Paralyze.java
@@ -1,23 +1,21 @@
package com.projectkorra.projectkorra.chiblocking;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
import org.bukkit.Location;
+import org.bukkit.Sound;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
-import com.projectkorra.projectkorra.BendingPlayer;
+import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.airbending.Suffocate;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
+import com.projectkorra.projectkorra.util.MovementHandler;
public class Paralyze extends ChiAbility {
- private static final Map ENTITIES = new ConcurrentHashMap<>();
-
@Attribute(Attribute.COOLDOWN)
private long cooldown;
private Entity target;
@@ -49,34 +47,18 @@ public class Paralyze extends ChiAbility {
}
private static void paralyze(Entity entity) {
- ENTITIES.put(entity, System.currentTimeMillis());
if (entity instanceof Creature) {
((Creature) entity).setTarget(null);
}
-
+
if (entity instanceof Player) {
if (Suffocate.isChannelingSphere((Player) entity)) {
Suffocate.remove((Player) entity);
}
- }
- }
-
- //TODO change paralyze to use Spigot metadata rather than checking this class
- public static boolean isParalyzed(Entity entity) {
- if (entity instanceof Player) {
- BendingPlayer bPlayer = BendingPlayer.getBendingPlayer((Player) entity);
- if (bPlayer != null && bPlayer.isAvatarState()) {
- return false;
- }
- }
- if (ENTITIES.containsKey(entity)) {
- if (System.currentTimeMillis() < ENTITIES.get(entity) + getDuration()) {
- return true;
- }
- ENTITIES.remove(entity);
- }
- return false;
-
+ }
+ MovementHandler mh = new MovementHandler((LivingEntity) entity);
+ mh.stop(getDuration()/1000*20, Element.CHI.getColor() + "* Paralyzed *");
+ entity.getWorld().playSound(entity.getLocation(), Sound.ENTITY_ENDERDRAGON_HURT, 2, 0);
}
@Override
@@ -116,8 +98,4 @@ public class Paralyze extends ChiAbility {
this.target = target;
}
- public static Map getEntities() {
- return ENTITIES;
- }
-
}
diff --git a/src/com/projectkorra/projectkorra/chiblocking/RapidPunch.java b/src/com/projectkorra/projectkorra/chiblocking/RapidPunch.java
index 8581fe53..0c2f3cd2 100644
--- a/src/com/projectkorra/projectkorra/chiblocking/RapidPunch.java
+++ b/src/com/projectkorra/projectkorra/chiblocking/RapidPunch.java
@@ -1,27 +1,26 @@
package com.projectkorra.projectkorra.chiblocking;
-import com.projectkorra.projectkorra.GeneralMethods;
-import com.projectkorra.projectkorra.ability.ChiAbility;
-import com.projectkorra.projectkorra.airbending.Suffocate;
-import com.projectkorra.projectkorra.attribute.Attribute;
-import com.projectkorra.projectkorra.chiblocking.passive.ChiPassive;
-import com.projectkorra.projectkorra.util.DamageHandler;
-
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
+import com.projectkorra.projectkorra.ability.ChiAbility;
+import com.projectkorra.projectkorra.airbending.Suffocate;
+import com.projectkorra.projectkorra.attribute.Attribute;
+import com.projectkorra.projectkorra.chiblocking.passive.ChiPassive;
+import com.projectkorra.projectkorra.util.DamageHandler;
+
public class RapidPunch extends ChiAbility {
@Attribute(Attribute.DAMAGE)
private double damage;
@Attribute("Hits")
private int punches;
- private int distance;
@Attribute(Attribute.COOLDOWN)
private long cooldown;
private int numPunches;
+ private long interval, last = 0;
private Entity target;
public RapidPunch(Player sourceplayer, Entity targetentity) {
@@ -29,36 +28,39 @@ public class RapidPunch extends ChiAbility {
if (!bPlayer.canBend(this)) {
return;
}
+
this.damage = getConfig().getDouble("Abilities.Chi.RapidPunch.Damage");
this.punches = getConfig().getInt("Abilities.Chi.RapidPunch.Punches");
- this.distance = getConfig().getInt("Abilities.Chi.RapidPunch.Distance");
this.cooldown = getConfig().getLong("Abilities.Chi.RapidPunch.Cooldown");
- this.target = GeneralMethods.getTargetedEntity(player, distance);
+ this.interval = getConfig().getLong("Abilities.Chi.RapidPunch.Interval");
+ this.target = targetentity;
+ bPlayer.addCooldown(this);
start();
}
@Override
public void progress() {
if (numPunches >= punches || target == null || !(target instanceof LivingEntity)) {
- bPlayer.addCooldown(this);
remove();
return;
}
- LivingEntity lt = (LivingEntity) target;
- DamageHandler.damageEntity(target, damage, this);
-
- if (target instanceof Player) {
- if (ChiPassive.willChiBlock(player, (Player) target)) {
- ChiPassive.blockChi((Player) target);
- }
- if (Suffocate.isChannelingSphere((Player) target)) {
- Suffocate.remove((Player) target);
+ if (System.currentTimeMillis() >= last + interval) {
+ LivingEntity lt = (LivingEntity) target;
+ DamageHandler.damageEntity(target, damage, this);
+
+ if (target instanceof Player) {
+ if (ChiPassive.willChiBlock(player, (Player) target)) {
+ ChiPassive.blockChi((Player) target);
+ }
+ if (Suffocate.isChannelingSphere((Player) target)) {
+ Suffocate.remove((Player) target);
+ }
}
+
+ lt.setNoDamageTicks(0);
+ numPunches++;
}
-
- lt.setNoDamageTicks(0);
- numPunches++;
}
@Override
@@ -102,14 +104,6 @@ public class RapidPunch extends ChiAbility {
this.punches = punches;
}
- public int getDistance() {
- return distance;
- }
-
- public void setDistance(int distance) {
- this.distance = distance;
- }
-
public int getNumPunches() {
return numPunches;
}
diff --git a/src/com/projectkorra/projectkorra/chiblocking/combo/Immobilize.java b/src/com/projectkorra/projectkorra/chiblocking/combo/Immobilize.java
index 92187353..2b2b9a55 100644
--- a/src/com/projectkorra/projectkorra/chiblocking/combo/Immobilize.java
+++ b/src/com/projectkorra/projectkorra/chiblocking/combo/Immobilize.java
@@ -1,26 +1,21 @@
package com.projectkorra.projectkorra.chiblocking.combo;
import java.util.ArrayList;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
+import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.ability.ComboAbility;
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
+import com.projectkorra.projectkorra.util.MovementHandler;
public class Immobilize extends ChiAbility implements ComboAbility {
- /**
- * a Map containing every entity which is paralyzed, and the time in
- * milliseconds at which they will be unparalyzed.
- */
- private static final Map PARALYZED_ENTITIES = new ConcurrentHashMap<>();
-
private long duration;
private long cooldown;
private Entity target;
@@ -28,8 +23,8 @@ public class Immobilize extends ChiAbility implements ComboAbility {
public Immobilize(Player player) {
super(player);
- this.cooldown = getConfig().getLong("Abilities.Chi.ChiCombo.Immobilize.Cooldown");
- this.duration = getConfig().getLong("Abilities.Chi.ChiCombo.Immobilize.ParalyzeDuration");
+ this.cooldown = getConfig().getLong("Abilities.Chi.Immobilize.Cooldown");
+ this.duration = getConfig().getLong("Abilities.Chi.Immobilize.ParalyzeDuration");
target = GeneralMethods.getTargetedEntity(player, 5);
if (!bPlayer.canBendIgnoreBinds(this)) {
return;
@@ -39,7 +34,6 @@ public class Immobilize extends ChiAbility implements ComboAbility {
return;
} else {
paralyze(target, duration);
- start();
bPlayer.addCooldown(this);
}
}
@@ -52,55 +46,8 @@ public class Immobilize extends ChiAbility implements ComboAbility {
* @param duration The time in milliseconds the target will be paralyzed
*/
private static void paralyze(Entity target, Long duration) {
- if (target != null) {
- PARALYZED_ENTITIES.put(target, (System.currentTimeMillis() + duration));
- }
- }
-
- /**
- * Convenience method to see if a Player is paralyzed by a Immobilize. Calls
- * {@link Immobilize#isParalyzed(Entity)} with the Player casted to an Entity.
- *
- * @param player The player to check if they're paralyzed
- * @return True if the player is paralyzed, false otherwise
- */
- public static boolean isParalyzed(Player player) {
- return isParalyzed((Entity) player);
-
- }
-
- /**
- * Checks if an entity is paralyzed by a Immobilize.
- *
- * @param entity The entity to check if they're paralyzed
- * @return True if the entity is paralyzed, false otherwise
- */
- public static boolean isParalyzed(Entity entity) {
- return PARALYZED_ENTITIES.containsKey(entity);
- }
-
- /**
- * Checks the status of all paralyzed entities. If their paralysis has
- * expired, it removes them from {@link Immobilize#PARALYZED_ENTITIES
- * paralyzedEntities} and removes the instance of the combo from
- * {@link Immobilize#instances instances}.
- */
- public static void handleParalysis() {
- for (Entity entity : PARALYZED_ENTITIES.keySet()) {
- entity.setFallDistance(0);
- if (PARALYZED_ENTITIES.get(entity) <= System.currentTimeMillis()) {
- PARALYZED_ENTITIES.remove(entity);
-
- for (Immobilize immobilize : getAbilities(Immobilize.class)) {
- if (immobilize.target == null) {
- immobilize.remove();
- continue;
- } else if (immobilize.target.equals(entity)) {
- immobilize.remove();
- }
- }
- }
- }
+ MovementHandler mh = new MovementHandler((LivingEntity) target);
+ mh.stop(duration/1000*20, Element.CHI.getColor() + "* Immobilized *");
}
@Override
@@ -110,8 +57,6 @@ public class Immobilize extends ChiAbility implements ComboAbility {
@Override
public void progress() {
- // TODO Auto-generated method stub
-
}
@Override
@@ -161,10 +106,6 @@ public class Immobilize extends ChiAbility implements ComboAbility {
this.target = target;
}
- public static Map getParalyzedEntities() {
- return PARALYZED_ENTITIES;
- }
-
public void setCooldown(long cooldown) {
this.cooldown = cooldown;
}
diff --git a/src/com/projectkorra/projectkorra/chiblocking/passive/ChiPassive.java b/src/com/projectkorra/projectkorra/chiblocking/passive/ChiPassive.java
index bf6a1c44..8e098bd8 100644
--- a/src/com/projectkorra/projectkorra/chiblocking/passive/ChiPassive.java
+++ b/src/com/projectkorra/projectkorra/chiblocking/passive/ChiPassive.java
@@ -1,6 +1,11 @@
package com.projectkorra.projectkorra.chiblocking.passive;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.scheduler.BukkitRunnable;
+
import com.projectkorra.projectkorra.BendingPlayer;
+import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.ability.CoreAbility;
@@ -9,9 +14,7 @@ import com.projectkorra.projectkorra.chiblocking.AcrobatStance;
import com.projectkorra.projectkorra.chiblocking.QuickStrike;
import com.projectkorra.projectkorra.chiblocking.SwiftKick;
import com.projectkorra.projectkorra.configuration.ConfigManager;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
+import com.projectkorra.projectkorra.util.ActionBar;
public class ChiPassive {
@@ -24,16 +27,16 @@ public class ChiPassive {
ChiAbility stance = bPlayer.getStance();
QuickStrike quickStrike = CoreAbility.getAbility(player, QuickStrike.class);
SwiftKick swiftKick = CoreAbility.getAbility(player, SwiftKick.class);
- double newChance = 0;
+ double newChance = getChance();
if (stance != null && stance instanceof AcrobatStance) {
- newChance = getChance() + ((AcrobatStance) stance).getChiBlockBoost();
+ newChance += ((AcrobatStance) stance).getChiBlockBoost();
}
if (quickStrike != null) {
- newChance = getChance() + quickStrike.getBlockChance();
+ newChance += quickStrike.getBlockChance();
} else if (swiftKick != null) {
- newChance = getChance() + swiftKick.getBlockChance();
+ newChance += swiftKick.getBlockChance();
}
if (Math.random() > newChance / 100.0) {
@@ -54,13 +57,19 @@ public class ChiPassive {
return;
}
bPlayer.blockChi();
-
- Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(ProjectKorra.plugin, new Runnable() {
+ player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ENDERDRAGON_HURT, 2, 0);
+
+ long start = System.currentTimeMillis();
+ new BukkitRunnable() {
@Override
public void run() {
- bPlayer.unblockChi();
+ ActionBar.sendActionBar(Element.CHI.getColor() + "* Chiblocked *", player);
+ if (System.currentTimeMillis() >= start + getDuration()) {
+ bPlayer.unblockChi();
+ cancel();
+ }
}
- }, getTicks());
+ }.runTaskTimer(ProjectKorra.plugin, 0, 1);
}
public static double getExhaustionFactor() {
diff --git a/src/com/projectkorra/projectkorra/chiblocking/util/ChiblockingManager.java b/src/com/projectkorra/projectkorra/chiblocking/util/ChiblockingManager.java
index a4c3a653..37c5d1fa 100644
--- a/src/com/projectkorra/projectkorra/chiblocking/util/ChiblockingManager.java
+++ b/src/com/projectkorra/projectkorra/chiblocking/util/ChiblockingManager.java
@@ -1,13 +1,10 @@
package com.projectkorra.projectkorra.chiblocking.util;
-import com.projectkorra.projectkorra.ProjectKorra;
-import com.projectkorra.projectkorra.chiblocking.Paralyze;
-import com.projectkorra.projectkorra.chiblocking.Smokescreen;
-
import org.bukkit.Bukkit;
-import org.bukkit.Material;
import org.bukkit.entity.Player;
-import org.bukkit.util.Vector;
+
+import com.projectkorra.projectkorra.ProjectKorra;
+import com.projectkorra.projectkorra.chiblocking.Smokescreen;
public class ChiblockingManager implements Runnable {
public ProjectKorra plugin;
@@ -20,12 +17,6 @@ public class ChiblockingManager implements Runnable {
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
Smokescreen.removeFromHashMap(player);
- if (Paralyze.isParalyzed(player)) {
- if (player.getLocation().subtract(0, 0.1, 0).getBlock().getType().equals(Material.AIR)) {
- player.setVelocity(new Vector(0, -0.4, 0));
- }
- player.setFallDistance(0F);
- }
}
}
diff --git a/src/com/projectkorra/projectkorra/command/BindCommand.java b/src/com/projectkorra/projectkorra/command/BindCommand.java
index cddd8aff..c442b60f 100644
--- a/src/com/projectkorra/projectkorra/command/BindCommand.java
+++ b/src/com/projectkorra/projectkorra/command/BindCommand.java
@@ -123,7 +123,7 @@ public class BindCommand extends PKCommand {
if (args.size() == 0) {
if (bPlayer != null) {
for (CoreAbility coreAbil : CoreAbility.getAbilities()) {
- if (!coreAbil.isHiddenAbility() && bPlayer.canBind(coreAbil) && !(coreAbil instanceof PassiveAbility && coreAbil instanceof ComboAbility) && !abilities.contains(coreAbil.getName())) {
+ if (!coreAbil.isHiddenAbility() && bPlayer.canBind(coreAbil) && !(coreAbil instanceof PassiveAbility || coreAbil instanceof ComboAbility) && !abilities.contains(coreAbil.getName())) {
abilities.add(coreAbil.getName());
}
}
diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java
index 7c6b7fdb..cc15bdc8 100644
--- a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java
+++ b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java
@@ -554,7 +554,7 @@ public class ConfigManager {
config.addDefault("Properties.Earth.SandSound.Sound", "BLOCK_SAND_BREAK");
config.addDefault("Properties.Earth.SandSound.Volume", 1);
config.addDefault("Properties.Earth.SandSound.Pitch", 1);
- config.addDefault("Properties.Earth.LavaSound.Sound", "LIQUID_LAVA");
+ config.addDefault("Properties.Earth.LavaSound.Sound", "BLOCK_LAVA_AMBIENT");
config.addDefault("Properties.Earth.LavaSound.Volume", 1);
config.addDefault("Properties.Earth.LavaSound.Pitch", 1);
@@ -1399,9 +1399,9 @@ public class ConfigManager {
config.addDefault("Abilities.Chi.RapidPunch.Enabled", true);
config.addDefault("Abilities.Chi.RapidPunch.Damage", 1);
- config.addDefault("Abilities.Chi.RapidPunch.Distance", 3);
config.addDefault("Abilities.Chi.RapidPunch.Cooldown", 6000);
config.addDefault("Abilities.Chi.RapidPunch.Punches", 3);
+ config.addDefault("Abilities.Chi.RapidPunch.Interval", 500);
config.addDefault("Abilities.Chi.Smokescreen.Enabled", true);
config.addDefault("Abilities.Chi.Smokescreen.Cooldown", 25000);
diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java b/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java
index 99e063f3..7da1c4c9 100644
--- a/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java
+++ b/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java
@@ -513,7 +513,7 @@ public class EarthSmash extends EarthAbility {
return null;
}
- List blocks = GeneralMethods.getBlocksAroundPoint(GeneralMethods.getTargetedLocation(player, grabRange, GeneralMethods.NON_OPAQUE), 1);
+ List blocks = GeneralMethods.getBlocksAroundPoint(GeneralMethods.getTargetedLocation(player, grabRange, getTransparentMaterials()), 1);
for (EarthSmash smash : getAbilities(EarthSmash.class)) {
if (reqState == null || smash.state == reqState) {
for (Block block : blocks) {
diff --git a/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWall.java b/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWall.java
index 01f9b1e9..c65eb9c5 100644
--- a/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWall.java
+++ b/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWall.java
@@ -160,7 +160,7 @@ public class LavaSurgeWall extends LavaAbility {
if (forming) {
ArrayList blocks = new ArrayList();
- Location loc = GeneralMethods.getTargetedLocation(player, (int) range, 8, 9, 79);
+ Location loc = GeneralMethods.getTargetedLocation(player, (int) range, Material.WATER, Material.STATIONARY_WATER, Material.ICE);
location = loc.clone();
Vector dir = player.getEyeLocation().getDirection();
Vector vec;
@@ -283,12 +283,11 @@ public class LavaSurgeWall extends LavaAbility {
}
}
- @SuppressWarnings("deprecation")
public static void form(Player player) {
if (!hasAbility(player, LavaSurgeWall.class)) {
new LavaSurgeWave(player);
return;
- } else if (isLavabendable(player, player.getTargetBlock((HashSet) null, SURGE_WAVE_RANGE))) {
+ } else if (isLavabendable(player, player.getTargetBlock((HashSet) null, SURGE_WAVE_RANGE))) {
new LavaSurgeWave(player);
return;
}
diff --git a/src/com/projectkorra/projectkorra/firebending/HeatControl.java b/src/com/projectkorra/projectkorra/firebending/HeatControl.java
index 2a21b206..a0f38111 100644
--- a/src/com/projectkorra/projectkorra/firebending/HeatControl.java
+++ b/src/com/projectkorra/projectkorra/firebending/HeatControl.java
@@ -142,7 +142,6 @@ public class HeatControl extends FireAbility {
}
}
- @SuppressWarnings("deprecation")
@Override
public void progress() {
@@ -180,8 +179,8 @@ public class HeatControl extends FireAbility {
}
Set blocks = new HashSet<>();
- for (int material : GeneralMethods.NON_OPAQUE) {
- blocks.add(Material.getMaterial(material));
+ for (Material material : getTransparentMaterials()) {
+ blocks.add(material);
}
for (Block block : GeneralMethods.getBlocksAroundPoint(player.getLocation(), extinguishRadius)) {
diff --git a/src/com/projectkorra/projectkorra/firebending/combo/FireComboStream.java b/src/com/projectkorra/projectkorra/firebending/combo/FireComboStream.java
index ea03448b..e2f9ea80 100644
--- a/src/com/projectkorra/projectkorra/firebending/combo/FireComboStream.java
+++ b/src/com/projectkorra/projectkorra/firebending/combo/FireComboStream.java
@@ -92,7 +92,7 @@ public class FireComboStream extends BukkitRunnable {
return;
} else if (collides && checkCollisionCounter % checkCollisionDelay == 0) {
for (Entity entity : GeneralMethods.getEntitiesAroundPoint(location, collisionRadius)) {
- if (entity instanceof LivingEntity && !entity.equals(coreAbility.getPlayer())) {
+ if (entity instanceof LivingEntity && !entity.equals(coreAbility.getPlayer()) && !entity.isDead()) {
collision((LivingEntity) entity, direction, coreAbility);
}
}
diff --git a/src/com/projectkorra/projectkorra/firebending/lightning/Lightning.java b/src/com/projectkorra/projectkorra/firebending/lightning/Lightning.java
index 6bbbf43b..8ce360d9 100644
--- a/src/com/projectkorra/projectkorra/firebending/lightning/Lightning.java
+++ b/src/com/projectkorra/projectkorra/firebending/lightning/Lightning.java
@@ -2,7 +2,6 @@ package com.projectkorra.projectkorra.firebending.lightning;
import java.util.ArrayList;
import java.util.List;
-import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.block.Block;
@@ -12,10 +11,12 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
+import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.LightningAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
+import com.projectkorra.projectkorra.util.MovementHandler;
public class Lightning extends LightningAbility {
@@ -24,7 +25,6 @@ public class Lightning extends LightningAbility {
}
private static final int POINT_GENERATION = 5;
- private static List paralyzed = new ArrayList<>();
private boolean charged;
private boolean hitWater;
@@ -122,28 +122,13 @@ public class Lightning extends LightningAbility {
* @param lent The LivingEntity that is being damaged
*/
public void electrocute(LivingEntity lent) {
- final UUID uuid = lent.getUniqueId();
- final LivingEntity flent = lent;
playLightningbendingSound(lent.getLocation());
playLightningbendingSound(player.getLocation());
DamageHandler.damageEntity(lent, damage, this);
if (Math.random() <= stunChance) {
- paralyzed.add(uuid);
- if (!(lent instanceof Player)) {
- lent.setAI(false);
- }
- new BukkitRunnable() {
-
- @Override
- public void run() {
- paralyzed.remove(uuid);
- if (!(flent instanceof Player)) {
- flent.setAI(true);
- }
- }
-
- }.runTaskLater(ProjectKorra.plugin, (long) stunDuration);
+ MovementHandler mh = new MovementHandler(lent);
+ mh.stop((long) stunDuration, Element.LIGHTNING.getColor() + "* Electrocuted *");
}
}
@@ -167,10 +152,6 @@ public class Lightning extends LightningAbility {
}
return false;
}
-
- public static boolean isParalyzed(Entity e) {
- return paralyzed.contains(e.getUniqueId());
- }
/**
* Progresses the instance of this ability by 1 tick. This is the heart of
diff --git a/src/com/projectkorra/projectkorra/util/MovementHandler.java b/src/com/projectkorra/projectkorra/util/MovementHandler.java
new file mode 100644
index 00000000..3c3cfd8a
--- /dev/null
+++ b/src/com/projectkorra/projectkorra/util/MovementHandler.java
@@ -0,0 +1,112 @@
+package com.projectkorra.projectkorra.util;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.metadata.FixedMetadataValue;
+import org.bukkit.scheduler.BukkitRunnable;
+
+import com.projectkorra.projectkorra.ProjectKorra;
+
+/**
+ * An object to control how an entity moves.
+ *
Current functions include stopping.
+ * @author Simplicitee
+ *
+ */
+public class MovementHandler {
+
+ private LivingEntity entity;
+ private BukkitRunnable runnable;
+ private ResetTask reset = null;
+
+ public MovementHandler(LivingEntity entity) {
+ this.entity = entity;
+ }
+
+ /**
+ * This stops the movement of the entity once
+ * they land on the ground, acting as a "paralyze"
+ * @param duration how long the entity should be stopped for (in ticks)
+ */
+ public void stop(long duration, String message) {
+ if (entity instanceof Player) {
+ long start = System.currentTimeMillis();
+ Player player = (Player) entity;
+ player.setMetadata("movement:stop", new FixedMetadataValue(ProjectKorra.plugin, 0));
+ runnable = new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ ActionBar.sendActionBar(message, player);
+ if (System.currentTimeMillis() >= start + duration/20*1000) {
+ player.removeMetadata("movement:stop", ProjectKorra.plugin);
+ reset();
+ }
+ }
+
+ };
+ runnable.runTaskTimer(ProjectKorra.plugin, 0, 1);
+ } else {
+ runnable = new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ allowMove();
+ }
+
+ };
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ if (entity.isOnGround()) {
+ entity.setAI(false);
+ cancel();
+ runnable.runTaskLater(ProjectKorra.plugin, duration);
+ }
+ }
+
+ }.runTaskTimer(ProjectKorra.plugin, 0, 1);
+ }
+ }
+
+ private void allowMove() {
+ if (!(entity instanceof Player)) {
+ entity.setAI(true);
+ }
+ if (reset != null) {
+ reset.run();
+ }
+ }
+
+ /**
+ * Cancels the current task and allows the entity to move freely
+ */
+ public void reset() {
+ runnable.cancel();
+ allowMove();
+ }
+
+ public LivingEntity getEntity() {
+ return entity;
+ }
+
+ public void setResetTask(ResetTask reset) {
+ this.reset = reset;
+ }
+
+ /**
+ * Functional interface, called when the entity is allowed to
+ * move again, therefore "reseting" it's AI
+ * @author Simplicitee
+ *
+ */
+ public interface ResetTask {
+ public void run();
+ }
+
+ public static boolean isStopped(Entity entity) {
+ return entity.hasMetadata("movement:stop");
+ }
+}
diff --git a/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java b/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java
index c792dea8..17590d41 100644
--- a/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java
+++ b/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java
@@ -237,7 +237,7 @@ public class SurgeWall extends WaterAbility {
}
ArrayList blocks = new ArrayList();
- Location targetLoc = GeneralMethods.getTargetedLocation(player, (int) range, 8, 9, 79);
+ Location targetLoc = GeneralMethods.getTargetedLocation(player, (int) range, Material.WATER, Material.STATIONARY_WATER, Material.ICE);
location = targetLoc.clone();
Vector eyeDir = player.getEyeLocation().getDirection();
Vector vector;
diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java b/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java
index 76ae4ca0..3684ef37 100644
--- a/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java
+++ b/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java
@@ -444,7 +444,7 @@ public class WaterManipulation extends WaterAbility {
Entity target = GeneralMethods.getTargetedEntity(player, range);
if (target == null) {
- location = GeneralMethods.getTargetedLocation(player, range, getTransparentMaterial());
+ location = GeneralMethods.getTargetedLocation(player, range, getTransparentMaterials());
} else {
location = ((LivingEntity) target).getEyeLocation();
}
diff --git a/src/com/projectkorra/projectkorra/waterbending/blood/Bloodbending.java b/src/com/projectkorra/projectkorra/waterbending/blood/Bloodbending.java
index acc170af..c546f201 100644
--- a/src/com/projectkorra/projectkorra/waterbending/blood/Bloodbending.java
+++ b/src/com/projectkorra/projectkorra/waterbending/blood/Bloodbending.java
@@ -89,7 +89,7 @@ public class Bloodbending extends BloodAbility {
//List entities = GeneralMethods.getEntitiesAroundPoint(location, 1.5);
List entities = new CopyOnWriteArrayList();
for (int i = 0; i < range; i++) {
- Location location = GeneralMethods.getTargetedLocation(player, i, getTransparentMaterial());
+ Location location = GeneralMethods.getTargetedLocation(player, i, getTransparentMaterials());
entities = GeneralMethods.getEntitiesAroundPoint(location, 1.7);
if (entities.contains(player))
entities.remove(player);
@@ -262,7 +262,7 @@ public class Bloodbending extends BloodAbility {
return;
}
- Location location = GeneralMethods.getTargetedLocation(player, 6, getTransparentMaterial());
+ Location location = GeneralMethods.getTargetedLocation(player, 6, getTransparentMaterials());
double distance = 0;
if (location.getWorld().equals(target.getWorld())) {
distance = location.distance(target.getLocation());
diff --git a/src/com/projectkorra/projectkorra/waterbending/ice/IceBlast.java b/src/com/projectkorra/projectkorra/waterbending/ice/IceBlast.java
index 4358a4b8..ce417cd9 100644
--- a/src/com/projectkorra/projectkorra/waterbending/ice/IceBlast.java
+++ b/src/com/projectkorra/projectkorra/waterbending/ice/IceBlast.java
@@ -180,7 +180,7 @@ public class IceBlast extends IceAbility {
LivingEntity target = (LivingEntity) GeneralMethods.getTargetedEntity(player, range, new ArrayList());
if (target == null) {
- destination = GeneralMethods.getTargetedLocation(player, range, getTransparentMaterial());
+ destination = GeneralMethods.getTargetedLocation(player, range, getTransparentMaterials());
} else {
destination = target.getEyeLocation();
}
diff --git a/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java b/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java
index 61ab4537..e7ceb6af 100644
--- a/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java
+++ b/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java
@@ -246,7 +246,7 @@ public class IceSpikeBlast extends IceAbility {
LivingEntity target = (LivingEntity) GeneralMethods.getTargetedEntity(player, range);
if (target == null) {
- destination = GeneralMethods.getTargetedLocation(player, range, getTransparentMaterial());
+ destination = GeneralMethods.getTargetedLocation(player, range, getTransparentMaterials());
} else {
destination = target.getEyeLocation();
}
@@ -370,7 +370,6 @@ public class IceSpikeBlast extends IceAbility {
}
}
- @SuppressWarnings("deprecation")
private static void waterBottle(Player player) {
long range = getConfig().getLong("Abilities.Water.IceSpike.Projectile.Range");
@@ -383,7 +382,7 @@ public class IceSpikeBlast extends IceAbility {
Location destination;
if (target == null) {
- destination = GeneralMethods.getTargetedLocation(player, range, getTransparentMaterial());
+ destination = GeneralMethods.getTargetedLocation(player, range, getTransparentMaterials());
} else {
destination = GeneralMethods.getPointOnLine(player.getEyeLocation(), target.getEyeLocation(), range);
}
diff --git a/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsFreeze.java b/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsFreeze.java
index 13e4f3ea..c00126ef 100644
--- a/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsFreeze.java
+++ b/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsFreeze.java
@@ -75,7 +75,7 @@ public class WaterArmsFreeze extends IceAbility {
Vector dir = player.getLocation().getDirection();
location = waterArms.getActiveArmEnd().add(dir.normalize().multiply(1));
- direction = GeneralMethods.getDirection(location, GeneralMethods.getTargetedLocation(player, iceRange, new Integer[] { 8, 9, 79, 174 })).normalize();
+ direction = GeneralMethods.getDirection(location, GeneralMethods.getTargetedLocation(player, iceRange, Material.WATER, Material.STATIONARY_WATER, Material.ICE, Material.PACKED_ICE)).normalize();
} else {
return;
}
diff --git a/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsSpear.java b/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsSpear.java
index 4e1bd7fa..4414ad8b 100644
--- a/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsSpear.java
+++ b/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsSpear.java
@@ -183,7 +183,7 @@ public class WaterArmsSpear extends WaterAbility {
new TempBlock(location.getBlock(), Material.STATIONARY_WATER, (byte) 8);
getIceBlocks().put(location.getBlock(), System.currentTimeMillis() + 600L);
- Vector direction = GeneralMethods.getDirection(initLocation, GeneralMethods.getTargetedLocation(player, spearRange, new Integer[] { 8, 9, 79, 174 })).normalize();
+ Vector direction = GeneralMethods.getDirection(initLocation, GeneralMethods.getTargetedLocation(player, spearRange, Material.WATER, Material.STATIONARY_WATER, Material.ICE, Material.PACKED_ICE)).normalize();
location = location.add(direction.clone().multiply(1));
spearLocations.add(location.clone());