## Fixes
* Fixed Combos and possibly Passives appearing in `/pk b <Ability>` auto-tabbing.
* Fixed Combos not loading properly on certain servers.
* Fixed issue with `PreciousStones` by updating to the latest version to resolve API change issues.
* Fixed `RapidPunch` damage.
* Fixed incorrect summation of chiblocking chance.
* Fixed possible issue in PKListener#onPlayerInteraction()
* Fixed `Earth.LavaSound`.
* Fixed Chi attempting to chiblock targets with any move.
* Fixed hitting an entity with `TempArmor` not ignoring armor.
* Fixed `Immobilize` config path.

## Additions
* Added "Contributing" section to the `README` to help guide active community members.
* Added more detail to the `PULL_REQUEST_TEMPLATE` to allow for more uniform pull requests. 
* Added many new blocks to our ability block interaction.
* Added check to combo collisions to discard dead entities.
* Added functionality to allow chiblocking abilities to affect all entities.
* Added exception handling to the configurable `Sound` options to prevent `IllegalArgumentExcpetions`.
* Added sounds and `ActionBar` messages to being Bloodbent, Electrocuted, Immobilized, MetalClipped, and Paralyzed. (Abilities: `Bloodbending`, `Lightning`, `Immobilize`, `MetalClips`, and `Paralyze`)
* Added sound and `ActionBar` message for being Chiblocked.
* Added interval config option to `RapidPunch`. (time between each punch)

## API Changes
* Updated to `Spigot 1.12.1`.
    * Confirmed to be backward compatible with `Spigot 1.12` and `Spigot 1.11.2`.
* Renamed `ElementalAbility#getTransparentMaterial()` to `ElementalAbility#getTransparentMaterials()`.
* Converted most `byte`/`int` dependent `Material` logic to use `Material` instead. 
    * `ElementalAbility#getTransparentMaterialSet()` now returns a `HashSet<Material>` instead of a `HashSet<Byte>`.
    * `ElementalAbility#getTransparentMaterials()` and `GeneralMethods.NON_OPAQUE` now return `Material[]` instead of `Integer[]`.
    * `GeneralMethods#getTargetedLocation()` now takes a `varargs Material[]` instead of a `varargs Integer[]`.
* Removed `ElementalAbility.TRANSPARENT_MATERIAL`. It was outdated and became irrelevent after `GeneralMethods.NON_OPAQUE` was updated.
* Removed `Java 7` Travi-CI  JDK check.
* Updated `pom.xml` to build in `Java 8`.
* Added new `MovementHandler` utility class to control entity movement. (currently only capable of stopping movement.
This commit is contained in:
Christopher Martin 2017-08-06 00:18:12 -07:00 committed by GitHub
parent 0ab240cd93
commit 102112ffdd
42 changed files with 479 additions and 344 deletions

View file

@ -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.

View file

@ -2,7 +2,6 @@ language: java
script: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
sudo: false
jdk:
- oraclejdk7
- oraclejdk8
notifications:
slack:

View file

@ -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.

Binary file not shown.

Binary file not shown.

31
pom.xml
View file

@ -4,7 +4,7 @@
<groupId>com.projectkorra</groupId>
<artifactId>projectkorra</artifactId>
<version>1.8.5</version>
<version>1.8.6</version>
<packaging>jar</packaging>
<name>ProjectKorra</name>
@ -16,14 +16,14 @@
</repositories>
<dependencies>
<!-- Spigot API -->
<!-- <dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>LATEST</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/spigot-1.12-R0.1-SNAPSHOT.jar</systemPath>
</dependency> -->
<!-- Spigot API -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>Spigot-Server</artifactId>
<version>LATEST</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/spigot-1.12.1.jar</systemPath>
</dependency>
<!-- Factions -->
<dependency>
<groupId>com.massivecraft</groupId>
@ -70,7 +70,7 @@
<artifactId>PreciousStones</artifactId>
<version>LATEST</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/PreciousStones 9.7.1.jar</systemPath>
<systemPath>${project.basedir}/lib/PreciousStones 10.6.1.jar</systemPath>
</dependency>
<!-- PK RPG -->
<dependency>
@ -136,13 +136,6 @@
<scope>system</scope>
<systemPath>${project.basedir}/lib/GLib.jar</systemPath>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>Spigot-Server</artifactId>
<version>LATEST</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/spigot-1.12-R0.1-SNAPSHOT.jar</systemPath>
</dependency>
</dependencies>
<build>
@ -165,8 +158,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>

View file

@ -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();

View file

@ -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");
}
/**

View file

@ -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<Entity>());
}
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<Byte> trans = new HashSet<Byte>();
trans.add((byte) 0);
HashSet<Material> trans = new HashSet<Material>();
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 **/

View file

@ -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);
}
@ -469,6 +470,10 @@ public class PKListener implements Listener {
FireDamageTimer.dealFlameDamage(entity);
}
if (TempArmor.hasTempArmor((LivingEntity)entity)) {
event.setDamage(DamageModifier.ARMOR, 0);
}
if (entity instanceof Player) {
Player player = (Player) entity;
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
@ -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);
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);
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()) {

View file

@ -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;
@ -139,7 +140,15 @@ public abstract class AirAbility extends ElementalAbility {
float volume = (float) getConfig().getDouble("Properties.Air.Sound.Volume");
float pitch = (float) getConfig().getDouble("Properties.Air.Sound.Pitch");
loc.getWorld().playSound(loc, Sound.valueOf(getConfig().getString("Properties.Air.Sound.Sound")), volume, pitch);
Sound sound = Sound.ENTITY_CREEPER_HURT;
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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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<Byte> getTransparentMaterialSet() {
HashSet<Byte> set = new HashSet<Byte>();
for (int i : TRANSPARENT_MATERIAL) {
set.add((byte) i);
public static HashSet<Material> getTransparentMaterialSet() {
HashSet<Material> set = new HashSet<Material>();
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;
}

View file

@ -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;

View file

@ -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);
}
}
}

View file

@ -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<AbilityInformation> 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<AbilityInformation> 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<AbilityInformation> 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<AbilityInformation> 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<AbilityInformation> 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<AbilityInformation> twister = new ArrayList<AbilityInformation>();
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<AbilityInformation> 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<AbilityInformation> 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<AbilityInformation> 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<AbilityInformation> 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<AbilityInformation> immobilize = new ArrayList<>();
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK_ENTITY));
immobilize.add(new AbilityInformation("SwiftKick", ClickType.LEFT_CLICK_ENTITY));

View file

@ -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)) {

View file

@ -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)) {

View file

@ -117,7 +117,7 @@ public class Suffocate extends AirAbility {
//List<Entity> entities = GeneralMethods.getEntitiesAroundPoint(location, 1.5);
List<Entity> entities = new ArrayList<Entity>();
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);

View file

@ -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();

View file

@ -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<Entity, Long> ENTITIES = new ConcurrentHashMap<>();
@Attribute(Attribute.COOLDOWN)
private long cooldown;
private Entity target;
@ -49,7 +47,6 @@ public class Paralyze extends ChiAbility {
}
private static void paralyze(Entity entity) {
ENTITIES.put(entity, System.currentTimeMillis());
if (entity instanceof Creature) {
((Creature) entity).setTarget(null);
}
@ -59,24 +56,9 @@ public class Paralyze extends ChiAbility {
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<Entity, Long> getEntities() {
return ENTITIES;
}
}

View file

@ -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 (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);
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;
}

View file

@ -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<Entity, Long> 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<Entity, Long> getParalyzedEntities() {
return PARALYZED_ENTITIES;
}
public void setCooldown(long cooldown) {
this.cooldown = cooldown;
}

View file

@ -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();
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ENDERDRAGON_HURT, 2, 0);
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(ProjectKorra.plugin, new Runnable() {
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() {

View file

@ -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);
}
}
}

View file

@ -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());
}
}

View file

@ -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);

View file

@ -513,7 +513,7 @@ public class EarthSmash extends EarthAbility {
return null;
}
List<Block> blocks = GeneralMethods.getBlocksAroundPoint(GeneralMethods.getTargetedLocation(player, grabRange, GeneralMethods.NON_OPAQUE), 1);
List<Block> 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) {

View file

@ -160,7 +160,7 @@ public class LavaSurgeWall extends LavaAbility {
if (forming) {
ArrayList<Block> blocks = new ArrayList<Block>();
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<Byte>) null, SURGE_WAVE_RANGE))) {
} else if (isLavabendable(player, player.getTargetBlock((HashSet<Material>) null, SURGE_WAVE_RANGE))) {
new LavaSurgeWave(player);
return;
}

View file

@ -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<Material> 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)) {

View file

@ -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);
}
}

View file

@ -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<UUID> 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 *");
}
}
@ -168,10 +153,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
* the ability, it checks if it needs to remove itself, and handles the

View file

@ -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.
* <br>Current functions include <b>stopping</b>.
* @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 <b>(in ticks)</b>
*/
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");
}
}

View file

@ -237,7 +237,7 @@ public class SurgeWall extends WaterAbility {
}
ArrayList<Block> blocks = new ArrayList<Block>();
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;

View file

@ -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();
}

View file

@ -89,7 +89,7 @@ public class Bloodbending extends BloodAbility {
//List<Entity> entities = GeneralMethods.getEntitiesAroundPoint(location, 1.5);
List<Entity> entities = new CopyOnWriteArrayList<Entity>();
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());

View file

@ -180,7 +180,7 @@ public class IceBlast extends IceAbility {
LivingEntity target = (LivingEntity) GeneralMethods.getTargetedEntity(player, range, new ArrayList<Entity>());
if (target == null) {
destination = GeneralMethods.getTargetedLocation(player, range, getTransparentMaterial());
destination = GeneralMethods.getTargetedLocation(player, range, getTransparentMaterials());
} else {
destination = target.getEyeLocation();
}

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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());