Fixed sea bounce.

This commit is contained in:
tastybento 2018-06-03 15:32:40 -07:00
parent f6a52a4290
commit 8b68cea6a1

View File

@ -60,6 +60,15 @@ public class AcidEffect implements Listener {
wetPlayers.remove(e.getEntity());
}
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onSeaBounce(PlayerMoveEvent e) {
Player player = e.getPlayer();
if (!player.getGameMode().equals(GameMode.CREATIVE) && !player.getGameMode().equals(GameMode.SPECTATOR)
&& player.getWorld().equals(addon.getIslandWorld()) && player.getLocation().getBlockY() < 1) {
player.setVelocity(new Vector(player.getVelocity().getX(), 1D, player.getVelocity().getZ()));
}
}
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerMove(PlayerMoveEvent e) {
Player player = e.getPlayer();
@ -67,7 +76,7 @@ public class AcidEffect implements Listener {
if ((addon.getSettings().getAcidRainDamage() == 0 && addon.getSettings().getAcidDamage() == 0)
|| player.isDead()
|| player.getGameMode().equals(GameMode.CREATIVE)
|| player.getGameMode().toString().startsWith("SPECTATOR")
|| player.getGameMode().equals(GameMode.SPECTATOR)
|| addon.getPlayers().isInTeleport(player.getUniqueId())
|| !player.getWorld().equals(addon.getIslandWorld())
|| player.hasPermission("acidisland.mod.noburn")
@ -112,13 +121,6 @@ public class AcidEffect implements Listener {
}
// Find out if they are at the bottom of the sea and if so bounce them
// back up
if (playerLoc.getBlockY() < 1) {
final Vector v = new Vector(player.getVelocity().getX(), 1D, player.getVelocity().getZ());
player.setVelocity(v);
}
// If they are already burning in acid then return
if (burningPlayers.contains(player)) {
// plugin.getLogger().info("DEBUG: no acid water is false");