Solved Most convenient way to move a player?

Discussion in 'Plugin Development' started by Ligachamp, Mar 30, 2016.

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


    Hello guys,

    since this are just some thoughts about a possible plugin, I just have a question to you.

    What is the most convenient way to make a player move by a plugin, like he would move normally?

    The API says nothing about player movement, referring to the Player interface. The move event also just gives me information about when a player did just move... So where can I tell a player to move?

    Best regards,
  2. Offline


    Set his velocity, thag usually makes s smooth experience.
  3. Offline


    But is setting his velocity enough to make him move? I thought that it just changes the speed he moves, when he gets moved by a client?

    Also, how do I tell him in which direction he has to move? Didn't you maybe misundertsood my intention? I want to move the player automatically by a plugin ;)

    EDIT: Oh ok, now I found it. I forgot that a Player is a subclass of Entity ^^"

    EDIT2: @mcdorli is there any (link to an) example, how the velocity Vector has to be build (needed values etc.)?
    Last edited: Mar 30, 2016
  4. Offline


    setting the player's velocity is the smoothest way to move a player. No, you're thinking of "WalkSpeed" or "FlySpeed". Velocity is what get applied to the player when the player needs to be moved in another direction (E.g. standing above an explosion, beinng pushed by a piston.)

    Use the ".setVelocity()" method and create a new Vector with all the X/Y/Z values for each direction. You'll get a better idea of the values you should use if you play around with them.
    bwfcwalshy likes this.
  5. Offline


    My first edit was referring to the fact, that this isn't the movement speed ;) I just looked over the API too fast again, so I apologize ^^"

    I understood now how to do this, thx alot! :) But I have one last question: In this case I must use a Vector from the bukkit packages instead of the java util one?
  6. Offline


    Yes, the java utils one is a row of information, sort of like an array, the bukkit one is the Physics version, it has 3 components, x, y and z.
  7. Offline


    Thx for the answer! Solved :)
Thread Status:
Not open for further replies.

Share This Page