Merge pull request #467 from StrangeOne101/master

Multiple Fixes
This commit is contained in:
OmniCypher 2016-04-01 09:57:08 -07:00
commit 4a1bc7b8c8
6 changed files with 43 additions and 31 deletions

View file

@ -202,12 +202,13 @@ public abstract class WaterAbility extends ElementalAbility {
continue;
} else if (isWaterbendable(player, null, block) && (!isPlant(block) || plantbending)) {
if (TempBlock.isTempBlock(block)) {
TempBlock tb = TempBlock.get(block);
continue;
/*TempBlock tb = TempBlock.get(block);
byte full = 0x0;
if (tb.getState().getRawData() != full
&& (tb.getState().getType() != Material.WATER || tb.getState().getType() != Material.STATIONARY_WATER)) {
continue;
}
}*/
}
return block;
}
@ -228,11 +229,7 @@ public abstract class WaterAbility extends ElementalAbility {
public static boolean isIcebendable(Player player, Material material, boolean onlyIce) {
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if(onlyIce) {
return bPlayer == null ? null : isIce(material) && bPlayer.canIcebend() && isIce(material);
} else {
return bPlayer == null ? null : isIce(material) && bPlayer.canIcebend();
}
return bPlayer == null ? null : isIce(material) && bPlayer.canIcebend() && (!onlyIce || material == Material.ICE);
}
public static boolean isPlantbendable(Player player, Material material, boolean onlyLeaves) {

View file

@ -12,6 +12,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import java.util.HashSet;
import java.util.Set;
public class HeatControlExtinguish extends FireAbility {
@ -20,6 +21,7 @@ public class HeatControlExtinguish extends FireAbility {
private long cooldown;
private Location location;
@SuppressWarnings("deprecation")
public HeatControlExtinguish(Player player) {
super(player);
@ -33,7 +35,11 @@ public class HeatControlExtinguish extends FireAbility {
this.range = getDayFactor(this.range);
this.radius = getDayFactor(this.radius);
if (isMeltable(player.getTargetBlock((HashSet<Material>) null, (int) range))) {
Set<Material> blocks = new HashSet<Material>();
for (Integer mat : GeneralMethods.NON_OPAQUE) {
blocks.add(Material.getMaterial(mat));
}
if (isMeltable(player.getTargetBlock(blocks, (int) range))) {
new HeatControlMelt(player);
return;
}

View file

@ -14,6 +14,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.material.MaterialData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
@ -41,7 +42,6 @@ public class IceSpikeBlast extends IceAbility {
private Location firstDestination;
private Location destination;
private TempBlock source;
private TempBlock originalSource;
public IceSpikeBlast(Player player) {
super(player);
@ -203,7 +203,8 @@ public class IceSpikeBlast extends IceAbility {
sourceBlock = block;
source = new TempBlock(sourceBlock, Material.ICE, data);
} else if (prepared) {
playFocusWaterEffect(sourceBlock);
if (sourceBlock != null)
playFocusWaterEffect(sourceBlock);
}
}
@ -221,11 +222,10 @@ public class IceSpikeBlast extends IceAbility {
}
progressing = false;
}
originalSource.revertBlock();
}
private void returnWater() {
new WaterReturn(player, sourceBlock);
new WaterReturn(player, location.getBlock());
}
private void throwIce() {
@ -257,12 +257,12 @@ public class IceSpikeBlast extends IceAbility {
settingUp = true;
prepared = false;
if (isPlant(sourceBlock)) {
/*if (isPlant(sourceBlock)) {
new PlantRegrowth(player, sourceBlock);
sourceBlock.setType(Material.AIR);
}
originalSource = new TempBlock(sourceBlock, Material.AIR, data);
originalSource = new TempBlock(sourceBlock, Material.AIR, data);*/
}
public static void activate(Player player) {
@ -382,16 +382,19 @@ public class IceSpikeBlast extends IceAbility {
return;
}
MaterialData data = block.getState().getData();
block.setType(Material.WATER);
block.setData((byte) 0x0);
block.setData((byte)0);
IceSpikeBlast iceSpike = new IceSpikeBlast(player);
iceSpike.throwIce();
iceSpike.sourceBlock = null;
if (iceSpike.progressing) {
WaterReturn.emptyWaterBottle(player);
} else {
block.setType(Material.AIR);
}
block.setType(data.getItemType());
block.setData(data.getData());
}
}
}

View file

@ -19,6 +19,7 @@ import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
public class IceSpikePillar extends IceAbility {
@ -46,6 +47,7 @@ public class IceSpikePillar extends IceAbility {
private Vector direction;
private ConcurrentHashMap<Block, Block> affectedBlocks;
private ArrayList<LivingEntity> damaged;
protected boolean inField = false;
public IceSpikePillar(Player player) {
super(player);
@ -107,7 +109,7 @@ public class IceSpikePillar extends IceAbility {
loadAffectedBlocks();
if (block.getType() == Material.ICE) {
if (isIcebendable(block)) {
if (canInstantiate()) {
start();
time = System.currentTimeMillis() - interval;
@ -161,7 +163,7 @@ public class IceSpikePillar extends IceAbility {
}
private boolean canInstantiate() {
if (block.getType() != Material.ICE) {
if (!isIcebendable(block.getType())) {
return false;
}
for (Block block : affectedBlocks.keySet()) {
@ -179,7 +181,7 @@ public class IceSpikePillar extends IceAbility {
if (System.currentTimeMillis() - time >= interval) {
time = System.currentTimeMillis();
if (progress < height) {
moveEarth();
risePillar();
removeTimestamp = System.currentTimeMillis();
} else {
if (removeTimestamp != 0 && removeTimestamp + removeTimer <= System.currentTimeMillis()) {
@ -193,7 +195,7 @@ public class IceSpikePillar extends IceAbility {
}
}
private boolean moveEarth() {
private boolean risePillar() {
progress++;
Block affectedBlock = location.clone().add(direction).getBlock();
location = location.add(direction);
@ -210,7 +212,9 @@ public class IceSpikePillar extends IceAbility {
}
affectedBlock.setType(Material.ICE);
playIcebendingSound(block.getLocation());
if (!inField || new Random().nextInt((int) ((height + 1) * 1.5)) == 0) {
playIcebendingSound(block.getLocation());
}
loadAffectedBlocks();
if (location.distanceSquared(origin) >= height * height) {

View file

@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.waterbending;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.IceAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import org.bukkit.Location;
import org.bukkit.Material;
@ -46,15 +47,15 @@ public class IceSpikePillarField extends IceAbility {
for (int x = (int) -(radius - 1); x <= (radius - 1); x++) {
for (int z = (int) -(radius - 1); z <= (radius - 1); z++) {
for (int y = -1; y <= 1; y++) {
Block testBlock = player.getWorld().getBlockAt(locX + x, locY + y, locZ + z);
Block testBlock = player.getWorld().getBlockAt(locX + x, locY + y, locZ + z);
if (testBlock.getType() == Material.ICE
if (WaterAbility.isIcebendable(player, testBlock.getType(), false)
&& testBlock.getRelative(BlockFace.UP).getType() == Material.AIR
&& !(testBlock.getX() == player.getEyeLocation().getBlock().getX()
&& testBlock.getZ() == player.getEyeLocation().getBlock().getZ())) {
iceBlocks.add(testBlock);
for(Block iceBlockForSound : iceBlocks) {
playIcebendingSound(iceBlockForSound.getLocation());
for (int i = 0; i < iceBlocks.size() / 2 + 1; i++) {
playIcebendingSound(iceBlocks.get(i).getLocation());
}
}
}
@ -90,7 +91,8 @@ public class IceSpikePillarField extends IceAbility {
}
if (targetBlock.getRelative(BlockFace.UP).getType() != Material.ICE) {
new IceSpikePillar(player, targetBlock.getLocation(), (int) damage, thrownForce, cooldown);
IceSpikePillar pillar = new IceSpikePillar(player, targetBlock.getLocation(), (int) damage, thrownForce, cooldown);
pillar.inField = true;
bPlayer.addCooldown("IceSpikePillarField", cooldown);
iceBlocks.remove(targetBlock);
}

View file

@ -58,8 +58,8 @@ public class OctopusForm extends WaterAbility {
if (oldOctopus.formed) {
oldOctopus.attack();
return;
} else if (!oldOctopus.sourceSelected) {
return;
} else if (oldOctopus.sourceSelected) {
oldOctopus.remove();
}
}
@ -92,7 +92,6 @@ public class OctopusForm extends WaterAbility {
sourceLocation = sourceBlock.getLocation();
sourceSelected = true;
start();
bPlayer.addCooldown(this);
}
}
@ -100,6 +99,7 @@ public class OctopusForm extends WaterAbility {
if (sourceSelected) {
sourceSelected = false;
settingUp = true;
bPlayer.addCooldown(this);
} else if (settingUp) {
settingUp = false;
forming = true;