Various Fixes (read desc) / Cleanup

Fixes grabbing EarthSmash after you shoot it
Fixes IceSpiking IceSpike projectiles
Fixes Selecting flowing water

Cleans unused/warnings
This commit is contained in:
OmniCypher 2016-01-02 19:36:55 -08:00
parent f37f03e25f
commit 7f0e671f4b
10 changed files with 21 additions and 26 deletions

View file

@ -642,7 +642,6 @@ public class EarthMethods {
revertAirBlock(i, false);
}
@SuppressWarnings("deprecation")
public static void revertAirBlock(int i, boolean force) {
if (!tempair.containsKey(i))
return;

View file

@ -10,7 +10,6 @@ import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.WaterMethods;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@ -116,13 +115,6 @@ public class EarthSmash {
}
if (grabbedSmash != null && grabbedSmash.state == State.LIFTED) {
grabbedSmash.state = State.GRABBED;
grabbedSmash.grabbedRange = grabbedSmash.loc.distance(player.getEyeLocation());
grabbedSmash.player = player;
return;
}
if (grabbedSmash != null && grabbedSmash.state == State.SHOT) {
grabbedSmash.state = State.GRABBED;
grabbedSmash.grabbedRange = grabbedSmash.loc.distance(player.getEyeLocation());
grabbedSmash.player = player;

View file

@ -5,7 +5,6 @@ import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.earthbending.EarthMethods;
import com.projectkorra.projectkorra.waterbending.WaterMethods;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@ -179,11 +178,12 @@ public class BlockSource {
* @return a valid bendable block, or null if none was found.
*/
@SuppressWarnings("deprecation")
public static Block getDynamicWaterSourceBlock(Player player, int autoRange, int selectRange, BlockSourceType sourceType, ClickType clickType, boolean auto, boolean dynamic, boolean water, boolean ice, boolean plant) {
update(player, selectRange, clickType);
BlockSourceInformation info = getValidBlockSourceInformation(player, selectRange, sourceType, clickType);
if (info != null && dynamic) {
if (WaterMethods.isWater(info.getBlock()) && water) {
if (WaterMethods.isWater(info.getBlock()) && info.getBlock().getState().getRawData() == 0x0 && water) {
return info.getBlock();
} else if (WaterMethods.isIcebendable(info.getBlock()) && ice) {
return info.getBlock();
@ -223,7 +223,6 @@ public class BlockSource {
// Check the block in front of the player's eyes, it may have been created by a
// WaterBottle.
sourceBlock = WaterMethods.getWaterSourceBlock(player, selectRange, water, ice, plant);
}
if (auto && (sourceBlock == null || sourceBlock.getLocation().distance(player.getEyeLocation()) > autoRange)) {
sourceBlock = WaterMethods.getRandomWaterBlock(player, player.getLocation(), autoRange, water, ice, plant);

View file

@ -83,6 +83,11 @@ public class IceSpike {
} else {
this.block = player.getTargetBlock((HashSet<Material>) null, (int) range);
}
for(IceSpike2 icespike : IceSpike2.instances.values()) {
if(icespike.getBlock().equals(block)) {
return;
}
}
origin = block.getLocation();
location = origin.clone();

View file

@ -447,4 +447,12 @@ public class IceSpike2 {
public void setDefaultdamage(double defaultdamage) {
this.defaultdamage = defaultdamage;
}
public Block getBlock() {
return sourceblock;
}
public void setBlock(Block block) {
this.sourceblock = block;
}
}

View file

@ -54,10 +54,7 @@ public class WaterCombo {
"Abilities.Water.WaterCombo.IceBullet.Cooldown");
public static long ICE_BULLET_SHOOT_TIME = ProjectKorra.plugin.getConfig().getLong(
"Abilities.Water.WaterCombo.IceBullet.ShootTime");
private static int icebullet_selectRange = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.WaterCombo.IceBullet.SelectRange");
//private boolean IceBulletisAuto;
public static ArrayList<WaterCombo> instances = new ArrayList<WaterCombo>();
public static ConcurrentHashMap<Block, TempBlock> frozenBlocks = new ConcurrentHashMap<Block, TempBlock>();

View file

@ -535,8 +535,6 @@ public class WaterManipulation {
@SuppressWarnings("deprecation")
public static void moveWater(Player player) {
BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName());
if (prepared.containsKey(player)) {
if (instances.containsKey(prepared.get(player))) {
instances.get(prepared.get(player)).moveWater();

View file

@ -154,7 +154,7 @@ public class WaterMethods {
Block block = location.clone().add(vector.clone().multiply(i)).getBlock();
if (GeneralMethods.isRegionProtectedFromBuild(player, "WaterManipulation", location))
continue;
if (isWater(block) && water) {
if (isWater(block) && block.getData() == 0x0 && water) {
if (TempBlock.isTempBlock(block)) {
TempBlock tb = TempBlock.get(block);
byte full = 0x0;
@ -180,6 +180,7 @@ public class WaterMethods {
* @param radius
* @return random block
*/
@SuppressWarnings("deprecation")
public static Block getRandomWaterBlock(Player player, Location location, int radius, boolean water, boolean ice, boolean plant) {
List<Integer> checked = new ArrayList<Integer>();
List<Block> blocks = GeneralMethods.getBlocksAroundPoint(location, radius);
@ -191,7 +192,7 @@ public class WaterMethods {
checked.add(index);
Block block = blocks.get(index);
if (block.getRelative(BlockFace.UP).getType() == Material.AIR) {
if (isWater(block) && water) {
if (isWater(block) && block.getState().getRawData() == 0x0 && water) {
BlockSource.randomBlocks.add(block);
return block;
}

View file

@ -9,7 +9,6 @@ import com.projectkorra.projectkorra.util.Flight;
import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;

View file

@ -6,11 +6,8 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.SubElement;
import com.projectkorra.projectkorra.ability.AvatarState;
import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.TempBlock;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -419,8 +416,8 @@ public class WaterWave {
return radius;
}
public void setRadius(int range) {
this.selectRange = range;
public static void setRadius(int range) {
selectRange = range;
}
public double getRange() {