(HELP) launching sponge plugin help needed!

Discussion in 'Bukkit Help' started by Phyla, Jan 20, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Phyla

    Well trying to make a launching sponge plugin to launch you but deal no damage when you land. So, when you take regular fall damage withjout the sponge you take fall damage naturally which is what I want. When you get launched from the sponge and land, you take no fall damage.

    Here's the problem: after using the sponge to launch me I no longer take fall damage from eg: jumping off a tree etc. I want it so that after you are launched, you take regular fall damage again and the only time you take no fall damage is when you're using the sponge launcher!

    Here's the code if you're interested in helping me :/

    Code:java
    1. public class Launchpad implements Listener {
    2.  
    3. private ArrayList<Player> jumpers = new ArrayList<Player>();
    4.  
    5. @EventHandler
    6. public void onPlayerMove(PlayerMoveEvent e) {
    7. if (e.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == Material.SPONGE) {
    8. jumpers.add(e.getPlayer());
    9. e.getPlayer().setVelocity(e.getPlayer().getLocation().getDirection().multiply(3));
    10. e.getPlayer().setVelocity(new Vector(e.getPlayer().getVelocity().getX(), 1.0D, e.getPlayer().getVelocity().getZ()));
    11. }
    12. }
    13.  
    14. @EventHandler
    15. public void onDamage(EntityDamageEvent e) {
    16. Player p = (Player)e.getEntity();
    17. if (e.getCause() == DamageCause.FALL && jumpers.contains(p)) {
    18. e.setCancelled(true);
    19. jumpers.remove(p);
    20. return;
    21. }
    22. }
    23. }
     
  2. Offline

    DuoDex

    Phyla Please go put this in the Plugin Help forum. That's where it belongs, AND I have no idea what you're doing wrong. (Not a coder or dev, although I'm working on it!).
     
Thread Status:
Not open for further replies.

Share This Page