Solved Deny player jumping....

Discussion in 'Plugin Development' started by stamline, Apr 9, 2014.

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

    stamline

    Hi, i want to make a DeadEnd plugin. But i didn´t know how to stop a player from jumping.....
     
  2. Offline

    rfsantos1996


    Code:java
    1. @EventHandler(ignoreCancelled = false)
    2. public void onMove(PlayerMoveEvent e) {
    3. Location from = e.getFrom(), to = e.getTo();
    4. if(from.getY() < to.getY()) { // OBS: care on what you do with this
    5. e.getPlayer().teleport(new Location(from.getWorld(), from.getX(), from.getY(), from.getZ(), to.getYaw(), to.getPitch());
    6. e.setCancelled(true); // I always have an issue with cancelling this, so I just teleport them
    7. }
    8. }
     
  3. Offline

    bennie3211

    but on some servers (I thought ShotBow BomberMan) has denied it with giving the player a jumpboost effect, im not sure if this cancels the jumping when you set the lvl to the MAX value?
     
  4. Offline

    Alshain01

    FYI, That won't work. Well, it will work... but it will also stop you from climbing stairs and may cause you to drown.
     
    KingFaris11 likes this.
  5. Offline

    Gamecube762

    I'd try a negative jump boost, I don't know if you can do negative potion effects, but its worth a shot.
     
    Gater12 likes this.
  6. Offline

    rfsantos1996

    I tought this as a Mini-game and not real gameplay, so I didnt meant to use that on every player or in every situation.
     
  7. Offline

    chromestone

    You could create an instance of a specific player event listener with a array list of players in game, then when the game is over you can cancel that event listener i think?
     
  8. Offline

    stamline

    Thanks to everyone!:)
    rfsantos1996 The code worked but i found a better way for my problem, but thanks :D
    I used:
    Code:java
    1. Player player = event.getPlayer();
    2. player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1000000, 250));


    Yeah, that worked:
    Code:java
    1. Player player = event.getPlayer();
    2. player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1000000, 250));


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
    westjet likes this.
Thread Status:
Not open for further replies.

Share This Page