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.EntityTeleportEvent;
|
||||
import org.bukkit.event.entity.EntityToggleGlideEvent;
|
||||
import org.bukkit.event.entity.EntityToggleSwimEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
|
@ -1330,18 +1331,19 @@ public class PKListener implements Listener {
|
|||
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);
|
||||
|
||||
final CoreAbility coreAbil = bPlayer.getBoundAbility();
|
||||
final String abil = bPlayer.getBoundAbilityName();
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ public abstract class ElementalAbility extends CoreAbility {
|
|||
}
|
||||
|
||||
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 com.projectkorra.projectkorra.ability.CoreAbility;
|
||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
||||
import com.projectkorra.projectkorra.ability.PassiveAbility;
|
||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||
|
@ -13,6 +12,7 @@ import com.projectkorra.projectkorra.waterbending.WaterSpout;
|
|||
import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArms;
|
||||
|
||||
public class FastSwim extends WaterAbility implements PassiveAbility {
|
||||
|
||||
private long cooldown;
|
||||
private double swimSpeed;
|
||||
private long duration;
|
||||
|
@ -22,6 +22,10 @@ public class FastSwim extends WaterAbility implements PassiveAbility {
|
|||
if (this.bPlayer.isOnCooldown(this)) {
|
||||
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.swimSpeed = ConfigManager.getConfig().getDouble("Abilities.Water.Passive.FastSwim.SpeedFactor");
|
||||
|
@ -36,16 +40,19 @@ public class FastSwim extends WaterAbility implements PassiveAbility {
|
|||
remove();
|
||||
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.player.isSneaking() && ElementalAbility.isWater(this.player.getLocation().getBlock()) && !this.bPlayer.isOnCooldown(this)) {
|
||||
if (this.duration != 0 && System.currentTimeMillis() > this.getStartTime() + this.duration) {
|
||||
this.bPlayer.addCooldown(this);
|
||||
remove();
|
||||
return;
|
||||
if (!this.player.isSneaking()) {
|
||||
if (isWater(this.player.getLocation().getBlock()) && !this.bPlayer.isOnCooldown(this)) {
|
||||
player.setVelocity(this.player.getEyeLocation().getDirection().clone().normalize().multiply(this.swimSpeed));
|
||||
}
|
||||
this.player.setVelocity(this.player.getEyeLocation().getDirection().clone().normalize().multiply(this.swimSpeed));
|
||||
} else if (!this.player.isSneaking()) {
|
||||
} else {
|
||||
this.bPlayer.addCooldown(this);
|
||||
remove();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue