Solved Vector Velocity Junk.

Discussion in 'Plugin Development' started by Whoneedspacee, Jan 24, 2016.

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


    package me.firstflames;
    import org.bukkit.ChatColor;
    import org.bukkit.Location;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerToggleSneakEvent;
    import org.bukkit.event.player.PlayerToggleSprintEvent;
    import org.bukkit.util.Vector;
    public class WaveDashListener extends JavaPlugin implements Listener{
    Vector leftMove = new Vector(1,0,0);
    private int doDash = 1;
    public void onEnable() {
    getServer().getPluginManager().registerEvents(this, this);
    public void PlayerInteract(PlayerToggleSneakEvent event) {
    Player p = event.getPlayer();
    Vector playerVelocity = p.getVelocity();
    double playerVelX = playerVelocity.getX();
    double playerVelZ = playerVelocity.getZ();
    double playerVelY = playerVelocity.getY();
    if (doDash == 0){
    doDash = 1;
    else if (playerVelX > 0 && doDash == 1){
    p.sendMessage(ChatColor.RED + "Wooosh!!");
    p.sendMessage("X: " + playerVelX);
    p.sendMessage("Y: " + playerVelY);
    doDash = 0;
    I've been messing around with this for a few hours but it only detects a change in the x and z velocitys if I am sprint jumping mid-air then I shift. It doesn't seem to detect a change in velocity if I am running on the ground, I want this plugin to basically be like wave dashing in melee but more like if I am moving in one of the four directions, then it will push me in that direction. Let me know if I'm being an idiot or if this idea wont even work.
  2. Offline


    @Whoneedspacee Hhahahahahahaha wavedashing, interesting concept dude.
  3. Offline


    I'm pretty much trying to check if someone is going in a certain direction, so if their is a better way to do this than I am already doing then that'd be nice. It's only going to be in 90 degree increments so you cant do it diagonally, so I don't know if that would make it easier to tell me.

    Solved on my own, got event.getfrom and event.getto and got the x y z coords from those, went from there.

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

Share This Page