mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 19:50:37 +00:00
Various Fixes
This commit is contained in:
parent
deca36dea6
commit
b3d9d3bb18
9 changed files with 48 additions and 66 deletions
|
@ -290,7 +290,6 @@ public abstract class WaterAbility extends ElementalAbility {
|
|||
|
||||
public static void stopBending() {
|
||||
PhaseChangeFreeze.removeAllCleanup();
|
||||
WaterSpout.removeAllCleanup();
|
||||
SurgeWall.removeAllCleanup();
|
||||
SurgeWave.removeAllCleanup();
|
||||
WaterArms.removeAllCleanup();
|
||||
|
|
|
@ -74,6 +74,7 @@ public class AirCombo extends AirAbility implements ComboAbility {
|
|||
this.speed = getConfig().getDouble("Abilities.Air.AirCombo.Twister.Speed");
|
||||
this.cooldown = getConfig().getLong("Abilities.Air.AirCombo.Twister.Cooldown");
|
||||
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.twisterHeightParticles = getConfig().getDouble("Abilities.Air.AirCombo.Twister.HeightPerParticle");
|
||||
this.twisterRemoveDelay = getConfig().getLong("Abilities.Air.AirCombo.Twister.RemoveDelay");
|
||||
|
|
|
@ -20,17 +20,21 @@ public class AcrobatStance extends ChiAbility {
|
|||
return;
|
||||
}
|
||||
|
||||
this.speed = getConfig().getInt("Abilities.Chi.AcrobatStance.Speed");
|
||||
this.jump = getConfig().getInt("Abilities.Chi.AcrobatStance.Jump");
|
||||
this.speed = getConfig().getInt("Abilities.Chi.AcrobatStance.Speed") + 1;
|
||||
this.jump = getConfig().getInt("Abilities.Chi.AcrobatStance.Jump") + 1;
|
||||
this.chiBlockBoost = getConfig().getDouble("Abilities.Chi.AcrobatStance.ChiBlockBoost");
|
||||
this.paralyzeDodgeBoost = getConfig().getDouble("Abilities.Chi.AcrobatStance.ParalyzeChanceDecrease");
|
||||
|
||||
ChiAbility stance = bPlayer.getStance();
|
||||
if (stance != null && !(stance instanceof AcrobatStance)) {
|
||||
if (stance != null) {
|
||||
stance.remove();
|
||||
bPlayer.setStance(this);
|
||||
if (stance instanceof AcrobatStance) {
|
||||
bPlayer.setStance(null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
start();
|
||||
bPlayer.setStance(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,10 +45,10 @@ public class AcrobatStance extends ChiAbility {
|
|||
}
|
||||
|
||||
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)) {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, jump));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, jump, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,15 +17,19 @@ public class WarriorStance extends ChiAbility {
|
|||
if (!bPlayer.canBend(this)) {
|
||||
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");
|
||||
|
||||
ChiAbility stance = bPlayer.getStance();
|
||||
if (stance != null && !(stance instanceof WarriorStance)) {
|
||||
if (stance != null) {
|
||||
stance.remove();
|
||||
bPlayer.setStance(this);
|
||||
if (stance instanceof WarriorStance) {
|
||||
bPlayer.setStance(null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
start();
|
||||
bPlayer.setStance(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,10 +40,10 @@ public class WarriorStance extends ChiAbility {
|
|||
}
|
||||
|
||||
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)) {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 60, strength));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 60, strength, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class Commands {
|
|||
public static String[] lightningaliases = { "lightningbending", "lightning" };
|
||||
|
||||
//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() {
|
||||
PluginCommand projectkorra = plugin.getCommand("projectkorra");
|
||||
|
|
|
@ -42,6 +42,7 @@ public class IceSpikeBlast extends IceAbility {
|
|||
private Location firstDestination;
|
||||
private Location destination;
|
||||
private TempBlock source;
|
||||
private TempBlock originalSource;
|
||||
|
||||
public IceSpikeBlast(Player player) {
|
||||
super(player);
|
||||
|
@ -214,6 +215,7 @@ public class IceSpikeBlast extends IceAbility {
|
|||
}
|
||||
progressing = false;
|
||||
}
|
||||
originalSource.revertBlock();
|
||||
bPlayer.addCooldown("IceSpikeBlast", cooldown);
|
||||
}
|
||||
|
||||
|
@ -255,7 +257,7 @@ public class IceSpikeBlast extends IceAbility {
|
|||
sourceBlock.setType(Material.AIR);
|
||||
}
|
||||
|
||||
new TempBlock(sourceBlock, Material.AIR, data);
|
||||
originalSource = new TempBlock(sourceBlock, Material.AIR, data);
|
||||
}
|
||||
|
||||
public static void activate(Player player) {
|
||||
|
|
|
@ -339,6 +339,14 @@ public class WaterArmsWhip extends WaterAbility {
|
|||
GRABBED_ENTITIES.remove(grabbedEntity);
|
||||
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();
|
||||
double distance = location.distance(newLocation);
|
||||
|
|
|
@ -13,14 +13,15 @@ import org.bukkit.block.Block;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class WaterSpout extends WaterAbility {
|
||||
|
||||
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 static final ConcurrentHashMap<Block, Long> REVERT_BLOCKS = new ConcurrentHashMap<Block, Long>();
|
||||
private List<TempBlock> blocks = new ArrayList<TempBlock>();
|
||||
|
||||
private boolean canBendOnPackedIce;
|
||||
private boolean useParticles;
|
||||
|
@ -90,18 +91,23 @@ public class WaterSpout extends WaterAbility {
|
|||
|
||||
Block block = loc.getBlock();
|
||||
if (block.getType().equals(Material.AIR) || !GeneralMethods.isSolid(block)) {
|
||||
REVERT_BLOCKS.put(block, 0L);
|
||||
new TempBlock(block, Material.STATIONARY_WATER, (byte) 1);
|
||||
blocks.add(new TempBlock(block, Material.STATIONARY_WATER, (byte) 1));
|
||||
AFFECTED_BLOCKS.put(block, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void progress() {
|
||||
for (TempBlock tb : blocks) {
|
||||
AFFECTED_BLOCKS.remove(tb.getBlock());
|
||||
tb.revertBlock();
|
||||
}
|
||||
if (player.isDead() || !player.isOnline() || !bPlayer.canBind(this)) {
|
||||
remove();
|
||||
return;
|
||||
} else {
|
||||
blocks.clear();
|
||||
player.setFallDistance(0);
|
||||
player.setSprinting(false);
|
||||
if ((new Random()).nextInt(4) == 0) {
|
||||
|
@ -119,13 +125,10 @@ public class WaterSpout extends WaterAbility {
|
|||
block = location.clone().add(0, i, 0).getBlock();
|
||||
|
||||
if (!TempBlock.isTempBlock(block)) {
|
||||
new TempBlock(block, Material.STATIONARY_WATER, (byte) 8);
|
||||
}
|
||||
if (!AFFECTED_BLOCKS.containsKey(block)) {
|
||||
blocks.add(new TempBlock(block, Material.STATIONARY_WATER, (byte) 8));
|
||||
AFFECTED_BLOCKS.put(block, block);
|
||||
}
|
||||
rotateParticles(block);
|
||||
NEW_AFFECTED_BLOCKS.put(block, block);
|
||||
}
|
||||
|
||||
displayWaterSpiral(location.clone().add(.5, 0, .5));
|
||||
|
@ -147,6 +150,10 @@ public class WaterSpout extends WaterAbility {
|
|||
public void remove() {
|
||||
super.remove();
|
||||
revertBaseBlock();
|
||||
for (TempBlock tb : blocks) {
|
||||
AFFECTED_BLOCKS.remove(tb.getBlock());
|
||||
tb.revertBlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void revertBaseBlock() {
|
||||
|
@ -206,7 +213,7 @@ public class WaterSpout extends WaterAbility {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (!AFFECTED_BLOCKS.contains(blocki)) {
|
||||
if (!blocks.contains(blocki)) {
|
||||
if (isWater(blocki)) {
|
||||
if (!TempBlock.isTempBlock(blocki)) {
|
||||
revertBaseBlock();
|
||||
|
@ -241,40 +248,6 @@ public class WaterSpout extends WaterAbility {
|
|||
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) {
|
||||
boolean removed = false;
|
||||
Location loc1 = sourcePlayer.getLocation().getBlock().getLocation();
|
||||
|
@ -402,12 +375,4 @@ public class WaterSpout extends WaterAbility {
|
|||
return AFFECTED_BLOCKS;
|
||||
}
|
||||
|
||||
public static ConcurrentHashMap<Block, Block> getNewAffectedBlocks() {
|
||||
return NEW_AFFECTED_BLOCKS;
|
||||
}
|
||||
|
||||
public static ConcurrentHashMap<Block, Long> getRevertBlocks() {
|
||||
return REVERT_BLOCKS;
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,6 @@ public class WaterbendingManager implements Runnable {
|
|||
WaterPassive.handlePassive();
|
||||
PhaseChangeFreeze.handleFrozenBlocks();
|
||||
HealingWaters.heal();
|
||||
WaterSpout.progressAllCleanup();
|
||||
Torrent.progressAllCleanup();
|
||||
WaterArms.progressAllCleanup();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue