Merge remote-tracking branch 'refs/remotes/ProjectKorra/master'

This commit is contained in:
Benford 2016-02-07 21:23:26 -05:00
commit b439c84056
9 changed files with 48 additions and 66 deletions

View file

@ -290,7 +290,6 @@ public abstract class WaterAbility extends ElementalAbility {
public static void stopBending() { public static void stopBending() {
PhaseChangeFreeze.removeAllCleanup(); PhaseChangeFreeze.removeAllCleanup();
WaterSpout.removeAllCleanup();
SurgeWall.removeAllCleanup(); SurgeWall.removeAllCleanup();
SurgeWave.removeAllCleanup(); SurgeWave.removeAllCleanup();
WaterArms.removeAllCleanup(); WaterArms.removeAllCleanup();

View file

@ -74,6 +74,7 @@ public class AirCombo extends AirAbility implements ComboAbility {
this.speed = getConfig().getDouble("Abilities.Air.AirCombo.Twister.Speed"); this.speed = getConfig().getDouble("Abilities.Air.AirCombo.Twister.Speed");
this.cooldown = getConfig().getLong("Abilities.Air.AirCombo.Twister.Cooldown"); this.cooldown = getConfig().getLong("Abilities.Air.AirCombo.Twister.Cooldown");
this.twisterHeight = getConfig().getDouble("Abilities.Air.AirCombo.Twister.Height"); this.twisterHeight = getConfig().getDouble("Abilities.Air.AirCombo.Twister.Height");
this.twisterRadius = getConfig().getDouble("Abilities.Air.AirCombo.Twister.Radius");
this.twisterDegreeParticles = getConfig().getDouble("Abilities.Air.AirCombo.Twister.DegreesPerParticle"); this.twisterDegreeParticles = getConfig().getDouble("Abilities.Air.AirCombo.Twister.DegreesPerParticle");
this.twisterHeightParticles = getConfig().getDouble("Abilities.Air.AirCombo.Twister.HeightPerParticle"); this.twisterHeightParticles = getConfig().getDouble("Abilities.Air.AirCombo.Twister.HeightPerParticle");
this.twisterRemoveDelay = getConfig().getLong("Abilities.Air.AirCombo.Twister.RemoveDelay"); this.twisterRemoveDelay = getConfig().getLong("Abilities.Air.AirCombo.Twister.RemoveDelay");

View file

@ -20,17 +20,21 @@ public class AcrobatStance extends ChiAbility {
return; return;
} }
this.speed = getConfig().getInt("Abilities.Chi.AcrobatStance.Speed"); this.speed = getConfig().getInt("Abilities.Chi.AcrobatStance.Speed") + 1;
this.jump = getConfig().getInt("Abilities.Chi.AcrobatStance.Jump"); this.jump = getConfig().getInt("Abilities.Chi.AcrobatStance.Jump") + 1;
this.chiBlockBoost = getConfig().getDouble("Abilities.Chi.AcrobatStance.ChiBlockBoost"); this.chiBlockBoost = getConfig().getDouble("Abilities.Chi.AcrobatStance.ChiBlockBoost");
this.paralyzeDodgeBoost = getConfig().getDouble("Abilities.Chi.AcrobatStance.ParalyzeChanceDecrease"); this.paralyzeDodgeBoost = getConfig().getDouble("Abilities.Chi.AcrobatStance.ParalyzeChanceDecrease");
ChiAbility stance = bPlayer.getStance(); ChiAbility stance = bPlayer.getStance();
if (stance != null && !(stance instanceof AcrobatStance)) { if (stance != null) {
stance.remove(); stance.remove();
bPlayer.setStance(this); if (stance instanceof AcrobatStance) {
bPlayer.setStance(null);
return;
}
} }
start(); start();
bPlayer.setStance(this);
} }
@Override @Override
@ -41,10 +45,10 @@ public class AcrobatStance extends ChiAbility {
} }
if (!player.hasPotionEffect(PotionEffectType.SPEED)) { if (!player.hasPotionEffect(PotionEffectType.SPEED)) {
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, speed)); player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, speed, true));
} }
if (!player.hasPotionEffect(PotionEffectType.JUMP)) { if (!player.hasPotionEffect(PotionEffectType.JUMP)) {
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, jump)); player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, jump, true));
} }
} }

View file

@ -17,15 +17,19 @@ public class WarriorStance extends ChiAbility {
if (!bPlayer.canBend(this)) { if (!bPlayer.canBend(this)) {
return; return;
} }
this.strength = getConfig().getInt("Abilities.Chi.WarriorStance.Strength"); this.strength = getConfig().getInt("Abilities.Chi.WarriorStance.Strength") - 1;
this.resistance = getConfig().getInt("Abilities.Chi.WarriorStance.Resistance"); this.resistance = getConfig().getInt("Abilities.Chi.WarriorStance.Resistance");
ChiAbility stance = bPlayer.getStance(); ChiAbility stance = bPlayer.getStance();
if (stance != null && !(stance instanceof WarriorStance)) { if (stance != null) {
stance.remove(); stance.remove();
bPlayer.setStance(this); if (stance instanceof WarriorStance) {
bPlayer.setStance(null);
return;
}
} }
start(); start();
bPlayer.setStance(this);
} }
@Override @Override
@ -36,10 +40,10 @@ public class WarriorStance extends ChiAbility {
} }
if (!player.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) { if (!player.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) {
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 60, resistance)); player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 60, resistance, true));
} }
if (!player.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) { if (!player.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) {
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 60, strength)); player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 60, strength, true));
} }
} }

View file

@ -74,7 +74,7 @@ public class Commands {
public static String[] lightningaliases = { "lightningbending", "lightning" }; public static String[] lightningaliases = { "lightningbending", "lightning" };
//Miscellaneous //Miscellaneous
public static String[] commandaliases = { "b", "pk", "bending", "mtla", "tla", "korra", "bend" }; public static String[] commandaliases = { "b", "pk", "projectkorra", "bending", "mtla", "tla", "korra", "bend" };
private void init() { private void init() {
PluginCommand projectkorra = plugin.getCommand("projectkorra"); PluginCommand projectkorra = plugin.getCommand("projectkorra");

View file

@ -42,6 +42,7 @@ public class IceSpikeBlast extends IceAbility {
private Location firstDestination; private Location firstDestination;
private Location destination; private Location destination;
private TempBlock source; private TempBlock source;
private TempBlock originalSource;
public IceSpikeBlast(Player player) { public IceSpikeBlast(Player player) {
super(player); super(player);
@ -214,6 +215,7 @@ public class IceSpikeBlast extends IceAbility {
} }
progressing = false; progressing = false;
} }
originalSource.revertBlock();
bPlayer.addCooldown("IceSpikeBlast", cooldown); bPlayer.addCooldown("IceSpikeBlast", cooldown);
} }
@ -255,7 +257,7 @@ public class IceSpikeBlast extends IceAbility {
sourceBlock.setType(Material.AIR); sourceBlock.setType(Material.AIR);
} }
new TempBlock(sourceBlock, Material.AIR, data); originalSource = new TempBlock(sourceBlock, Material.AIR, data);
} }
public static void activate(Player player) { public static void activate(Player player) {

View file

@ -339,6 +339,14 @@ public class WaterArmsWhip extends WaterAbility {
GRABBED_ENTITIES.remove(grabbedEntity); GRABBED_ENTITIES.remove(grabbedEntity);
return; return;
} }
if (grabbedEntity instanceof Player && hasAbility((Player) grabbedEntity, WaterArmsWhip.class)) {
WaterArmsWhip waw = getAbility((Player) grabbedEntity, WaterArmsWhip.class);
if (waw.getAbility().equals(Whip.GRAB)) {
grabbed = false;
GRABBED_ENTITIES.remove(grabbedEntity);
return;
}
}
Location newLocation = grabbedEntity.getLocation(); Location newLocation = grabbedEntity.getLocation();
double distance = location.distance(newLocation); double distance = location.distance(newLocation);

View file

@ -13,14 +13,15 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import java.util.ArrayList;
import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public class WaterSpout extends WaterAbility { public class WaterSpout extends WaterAbility {
private static final ConcurrentHashMap<Block, Block> AFFECTED_BLOCKS = new ConcurrentHashMap<Block, Block>(); private static final ConcurrentHashMap<Block, Block> AFFECTED_BLOCKS = new ConcurrentHashMap<Block, Block>();
private static final ConcurrentHashMap<Block, Block> NEW_AFFECTED_BLOCKS = new ConcurrentHashMap<Block, Block>(); private List<TempBlock> blocks = new ArrayList<TempBlock>();
private static final ConcurrentHashMap<Block, Long> REVERT_BLOCKS = new ConcurrentHashMap<Block, Long>();
private boolean canBendOnPackedIce; private boolean canBendOnPackedIce;
private boolean useParticles; private boolean useParticles;
@ -90,18 +91,23 @@ public class WaterSpout extends WaterAbility {
Block block = loc.getBlock(); Block block = loc.getBlock();
if (block.getType().equals(Material.AIR) || !GeneralMethods.isSolid(block)) { if (block.getType().equals(Material.AIR) || !GeneralMethods.isSolid(block)) {
REVERT_BLOCKS.put(block, 0L); blocks.add(new TempBlock(block, Material.STATIONARY_WATER, (byte) 1));
new TempBlock(block, Material.STATIONARY_WATER, (byte) 1); AFFECTED_BLOCKS.put(block, block);
} }
} }
} }
@Override @Override
public void progress() { public void progress() {
for (TempBlock tb : blocks) {
AFFECTED_BLOCKS.remove(tb.getBlock());
tb.revertBlock();
}
if (player.isDead() || !player.isOnline() || !bPlayer.canBind(this)) { if (player.isDead() || !player.isOnline() || !bPlayer.canBind(this)) {
remove(); remove();
return; return;
} else { } else {
blocks.clear();
player.setFallDistance(0); player.setFallDistance(0);
player.setSprinting(false); player.setSprinting(false);
if ((new Random()).nextInt(4) == 0) { if ((new Random()).nextInt(4) == 0) {
@ -119,13 +125,10 @@ public class WaterSpout extends WaterAbility {
block = location.clone().add(0, i, 0).getBlock(); block = location.clone().add(0, i, 0).getBlock();
if (!TempBlock.isTempBlock(block)) { if (!TempBlock.isTempBlock(block)) {
new TempBlock(block, Material.STATIONARY_WATER, (byte) 8); blocks.add(new TempBlock(block, Material.STATIONARY_WATER, (byte) 8));
}
if (!AFFECTED_BLOCKS.containsKey(block)) {
AFFECTED_BLOCKS.put(block, block); AFFECTED_BLOCKS.put(block, block);
} }
rotateParticles(block); rotateParticles(block);
NEW_AFFECTED_BLOCKS.put(block, block);
} }
displayWaterSpiral(location.clone().add(.5, 0, .5)); displayWaterSpiral(location.clone().add(.5, 0, .5));
@ -147,6 +150,10 @@ public class WaterSpout extends WaterAbility {
public void remove() { public void remove() {
super.remove(); super.remove();
revertBaseBlock(); revertBaseBlock();
for (TempBlock tb : blocks) {
AFFECTED_BLOCKS.remove(tb.getBlock());
tb.revertBlock();
}
} }
public void revertBaseBlock() { public void revertBaseBlock() {
@ -206,7 +213,7 @@ public class WaterSpout extends WaterAbility {
return -1; return -1;
} }
if (!AFFECTED_BLOCKS.contains(blocki)) { if (!blocks.contains(blocki)) {
if (isWater(blocki)) { if (isWater(blocki)) {
if (!TempBlock.isTempBlock(blocki)) { if (!TempBlock.isTempBlock(blocki)) {
revertBaseBlock(); revertBaseBlock();
@ -241,40 +248,6 @@ public class WaterSpout extends WaterAbility {
return -1; return -1;
} }
public static void progressAllCleanup() {
NEW_AFFECTED_BLOCKS.clear();
revertAllBlocks(false);
for (Block block : AFFECTED_BLOCKS.keySet()) {
if (!NEW_AFFECTED_BLOCKS.containsKey(block)) {
AFFECTED_BLOCKS.remove(block);
TempBlock.revertBlock(block, Material.AIR);
}
}
}
private static void revertAllBlocks(boolean ignoreTime) {
for (Block block : REVERT_BLOCKS.keySet()) {
long time = REVERT_BLOCKS.get(block);
if (System.currentTimeMillis() > time || ignoreTime) {
if (TempBlock.isTempBlock(block)) {
TempBlock.revertBlock(block, Material.AIR);
}
REVERT_BLOCKS.remove(block);
}
}
}
public static void removeAllCleanup() {
revertAllBlocks(true);
REVERT_BLOCKS.clear();
for (Block block : AFFECTED_BLOCKS.keySet()) {
TempBlock.revertBlock(block, Material.AIR);
AFFECTED_BLOCKS.remove(block);
}
}
public static boolean removeSpouts(Location loc0, double radius, Player sourcePlayer) { public static boolean removeSpouts(Location loc0, double radius, Player sourcePlayer) {
boolean removed = false; boolean removed = false;
Location loc1 = sourcePlayer.getLocation().getBlock().getLocation(); Location loc1 = sourcePlayer.getLocation().getBlock().getLocation();
@ -402,12 +375,4 @@ public class WaterSpout extends WaterAbility {
return AFFECTED_BLOCKS; return AFFECTED_BLOCKS;
} }
public static ConcurrentHashMap<Block, Block> getNewAffectedBlocks() {
return NEW_AFFECTED_BLOCKS;
}
public static ConcurrentHashMap<Block, Long> getRevertBlocks() {
return REVERT_BLOCKS;
}
} }

View file

@ -15,7 +15,6 @@ public class WaterbendingManager implements Runnable {
WaterPassive.handlePassive(); WaterPassive.handlePassive();
PhaseChangeFreeze.handleFrozenBlocks(); PhaseChangeFreeze.handleFrozenBlocks();
HealingWaters.heal(); HealingWaters.heal();
WaterSpout.progressAllCleanup();
Torrent.progressAllCleanup(); Torrent.progressAllCleanup();
WaterArms.progressAllCleanup(); WaterArms.progressAllCleanup();
} }