Chiss' double jump mechanic

This commit is contained in:
Virizion 2016-02-04 22:05:46 -05:00
parent a76e570b8a
commit b0b43524da

View File

@ -41,8 +41,10 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.world.StructureGrowEvent; import org.bukkit.event.world.StructureGrowEvent;
import org.bukkit.material.Bed; import org.bukkit.material.Bed;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
@ -1652,6 +1654,37 @@ public class SpeedBuilders extends SoloGame
} }
} }
@EventHandler
public void moveSetFlight(PlayerMoveEvent event)
{
if (!IsLive())
return;
if (_state != SpeedBuildersState.BUILDING)
return;
if (!GetTeamList().get(0).HasPlayer(event.getPlayer()))
return;
if (UtilEnt.isGrounded(event.getPlayer()) && !event.getPlayer().isFlying())
event.getPlayer().setAllowFlight(true);
}
@EventHandler
public void flightToggleJump(PlayerToggleFlightEvent event)
{
if (!GetTeamList().get(0).HasPlayer(event.getPlayer()))
return;
event.setCancelled(true);
event.getPlayer().setAllowFlight(false);
event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.GHAST_FIREBALL, 1f, 1f);
UtilAction.velocity(event.getPlayer(), new Vector(0, 1, 0));
}
@Override @Override
public void EndCheck() public void EndCheck()
{ {