mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 11:40:40 +00:00
Fastswim and kelp bugs
This commit is contained in:
parent
ec081a4d65
commit
7c3bd13535
3 changed files with 26 additions and 17 deletions
|
@ -46,6 +46,7 @@ import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
|
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityTeleportEvent;
|
import org.bukkit.event.entity.EntityTeleportEvent;
|
||||||
import org.bukkit.event.entity.EntityToggleGlideEvent;
|
import org.bukkit.event.entity.EntityToggleGlideEvent;
|
||||||
|
import org.bukkit.event.entity.EntityToggleSwimEvent;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
|
@ -1330,18 +1331,19 @@ public class PKListener implements Listener {
|
||||||
BlockSource.update(player, ClickType.SHIFT_DOWN);
|
BlockSource.update(player, ClickType.SHIFT_DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PassiveManager.hasPassive(player, CoreAbility.getAbility(FerroControl.class))) {
|
|
||||||
new FerroControl(player);
|
|
||||||
} else if (PassiveManager.hasPassive(player, CoreAbility.getAbility(FastSwim.class))) {
|
|
||||||
new FastSwim(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
AirScooter.check(player);
|
AirScooter.check(player);
|
||||||
|
|
||||||
final CoreAbility coreAbil = bPlayer.getBoundAbility();
|
final CoreAbility coreAbil = bPlayer.getBoundAbility();
|
||||||
final String abil = bPlayer.getBoundAbilityName();
|
final String abil = bPlayer.getBoundAbilityName();
|
||||||
if (coreAbil == null) {
|
if (coreAbil == null) {
|
||||||
|
if (PassiveManager.hasPassive(player, CoreAbility.getAbility(FerroControl.class))) {
|
||||||
|
new FerroControl(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PassiveManager.hasPassive(player, CoreAbility.getAbility(FastSwim.class))) {
|
||||||
|
new FastSwim(player);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ public abstract class ElementalAbility extends CoreAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isWater(final Material material) {
|
public static boolean isWater(final Material material) {
|
||||||
return material == Material.WATER || material == Material.SEAGRASS || material == Material.TALL_SEAGRASS || material == Material.KELP_PLANT;
|
return material == Material.WATER || material == Material.SEAGRASS || material == Material.TALL_SEAGRASS || material == Material.KELP_PLANT || material == Material.KELP;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
|
||||||
import com.projectkorra.projectkorra.ability.PassiveAbility;
|
import com.projectkorra.projectkorra.ability.PassiveAbility;
|
||||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
|
@ -13,6 +12,7 @@ import com.projectkorra.projectkorra.waterbending.WaterSpout;
|
||||||
import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArms;
|
import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArms;
|
||||||
|
|
||||||
public class FastSwim extends WaterAbility implements PassiveAbility {
|
public class FastSwim extends WaterAbility implements PassiveAbility {
|
||||||
|
|
||||||
private long cooldown;
|
private long cooldown;
|
||||||
private double swimSpeed;
|
private double swimSpeed;
|
||||||
private long duration;
|
private long duration;
|
||||||
|
@ -22,6 +22,10 @@ public class FastSwim extends WaterAbility implements PassiveAbility {
|
||||||
if (this.bPlayer.isOnCooldown(this)) {
|
if (this.bPlayer.isOnCooldown(this)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player.isSneaking()) { // the sneak event calls before they actually start sneaking
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.cooldown = ConfigManager.getConfig().getLong("Abilities.Water.Passive.FastSwim.Cooldown");
|
this.cooldown = ConfigManager.getConfig().getLong("Abilities.Water.Passive.FastSwim.Cooldown");
|
||||||
this.swimSpeed = ConfigManager.getConfig().getDouble("Abilities.Water.Passive.FastSwim.SpeedFactor");
|
this.swimSpeed = ConfigManager.getConfig().getDouble("Abilities.Water.Passive.FastSwim.SpeedFactor");
|
||||||
|
@ -36,16 +40,19 @@ public class FastSwim extends WaterAbility implements PassiveAbility {
|
||||||
remove();
|
remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.duration > 0 && System.currentTimeMillis() > this.getStartTime() + this.duration) {
|
||||||
|
this.bPlayer.addCooldown(this);
|
||||||
|
remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.bPlayer.getBoundAbility() == null || (this.bPlayer.getBoundAbility() != null && !this.bPlayer.getBoundAbility().isSneakAbility())) {
|
if (this.bPlayer.getBoundAbility() == null || (this.bPlayer.getBoundAbility() != null && !this.bPlayer.getBoundAbility().isSneakAbility())) {
|
||||||
if (this.player.isSneaking() && ElementalAbility.isWater(this.player.getLocation().getBlock()) && !this.bPlayer.isOnCooldown(this)) {
|
if (!this.player.isSneaking()) {
|
||||||
if (this.duration != 0 && System.currentTimeMillis() > this.getStartTime() + this.duration) {
|
if (isWater(this.player.getLocation().getBlock()) && !this.bPlayer.isOnCooldown(this)) {
|
||||||
this.bPlayer.addCooldown(this);
|
player.setVelocity(this.player.getEyeLocation().getDirection().clone().normalize().multiply(this.swimSpeed));
|
||||||
remove();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
this.player.setVelocity(this.player.getEyeLocation().getDirection().clone().normalize().multiply(this.swimSpeed));
|
} else {
|
||||||
} else if (!this.player.isSneaking()) {
|
|
||||||
this.bPlayer.addCooldown(this);
|
this.bPlayer.addCooldown(this);
|
||||||
remove();
|
remove();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue