From 7a0c763923ab775e30b16e472a3dc7ba3a720cde Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 28 Dec 2022 21:40:43 +0100 Subject: [PATCH] Fix SpaceListener --- .../listener/special/SpaceListener.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/misslewars/listener/special/SpaceListener.java b/src/de/steamwar/misslewars/listener/special/SpaceListener.java index cd60bf2..aed8278 100644 --- a/src/de/steamwar/misslewars/listener/special/SpaceListener.java +++ b/src/de/steamwar/misslewars/listener/special/SpaceListener.java @@ -31,6 +31,7 @@ import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; @@ -50,7 +51,19 @@ public class SpaceListener extends BasicListener { Player player = event.getPlayer(); player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 3)); player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, Integer.MAX_VALUE, 3)); - }, 1); + player.setHealthScale(0.25); + }, 5); + } + + @EventHandler + public void onPlayerRespawn(PlayerRespawnEvent event) { + if (!Config.Space) return; + Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), () -> { + Player player = event.getPlayer(); + player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 3)); + player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, Integer.MAX_VALUE, 3)); + player.setHealthScale(0.25); + }, 5); } @EventHandler