Solved Help with velocity kicking me for flying

Discussion in 'Spigot Plugin Development' started by FalconSeeker, Jun 18, 2018.

  1. Code (Text):
        private void Levitate(Player player, int length) {

            new BukkitRunnable() {
              int time = length*20;
                @Override
                public void run() {
                    time--;
                    player.setVelocity(new Vector(0D, .1D, 0D));
                    if (time == 0) {
                        return;
                    }
                }
            }.runTaskTimer(main, 0L, 1L);
        }
    }
    [12:10:34 WARN]: Falcon_Seeker was kicked for floating too long!
    [12:10:34 INFO]: Falcon_Seeker lost connection: Flying is not enabled on this server
    [12:10:34 INFO]: Falcon_Seeker left the game.
    [12:10:34 WARN]: handleDisconnection() called twice
     
  2. Would p.setAllowFlight work? I am trying it right now
     
  3. I'm assuming by the "Solved" tag that worked for you, but doesn't that also let them double-tap space to enter creative mode flight?
     
  4. no because i also did
    Code (Text):
                    player.setFlying(false);
                    player.setVelocity(new Vector(player.getVelocity().getX(), .5D, player.getVelocity().getZ()));
                    if (time == 0) {
                        player.setAllowFlight(false);
                        cancel();
                        return;
                    }