Copying Movements of Player to another

Discussion in 'Plugin Development' started by Demyxa, May 15, 2021.

  1. Offline


    I want to make a player replicate my Movements. I tried using .setVelocity but that doesn't seem to apply to simple movements. Would I have to replicate my key presses then?

    Current onWalk Code, meant to replicate movement.

        public void onWalk (PlayerMoveEvent e) {
            if (paar.containsKey(e.getPlayer())) { //check if player is "holding hands"
                Player halter = e.getPlayer();
                Vector movement = halter.getVelocity(); //copy their momentum
                paar.get(halter).setVelocity(movement); //set their momentum
  2. Offline


    Just use getFrom() and getTo() and then subtract the difference and teleport the other player with the increment. You will also need to cancel the PlayerMoveEvent if the other player that's being controlled tries to move.

Share This Page