setVelocity() method broken in 1.7.2? & Also Double Jumping

Discussion in 'Plugin Development' started by Drkmaster83, Dec 7, 2013.

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

    Drkmaster83

    I cannot for the life of me get the setVelocity() method to work on an entity with the new development build. Is it the build or is it me?
    Code:
    @EventHandler
    public void onEntityDamageByEntity(EntityDamageByEntityEvent event)
    {
    if(event.getDamager() instanceof Player)
    {
    Player damager = (Player) event.getDamager();
    if(damager.getItemInHand().getType().equals(Material.FIREWORK))
    {
    Entity player = event.getEntity();
    player.getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK);
    player.setVelocity(new Vector(0.0D, 2.0D, 0.0D));
    }
    }
    }
    
    All events are registered. The firework fires off when it's in my hand and doesn't when I don't have a firework in my hand. However, the entity just receives the normal knockback that it always does.

    Don't question the name of the entity, as it used to be a Player object, I was just too lazy to change it.

    EDIT: Also, DoubleJumping (using PlayerToggleFlightEvent and .setAllowFlight(true)) is broken, I suspect this all sprouts from entity.setVelocity()
     
  2. Offline

    Drkmaster83

    Bump, please.
     
  3. Offline

    NathanWolf

    Entity.setVelocity is working fine for me in 1.7, as is setAllowFlight. I'm not sure you can alter the velocity of a firework, though.
     
  4. Offline

    Drkmaster83

    I'm listening to EntityDamageByEntity, and when the damaged is a player, it launches a firework at the damaged's location. However, it's also supposed to set their velocity to shoot them up. Instead, you punch them once and it only launches the firework. If you punch them 2 times in quick succession (2 punches in a second), it then both launches the firework and the velocity. It launches two fireworks, however, since the event is called twice.
     
  5. Offline

    NathanWolf

    Hm... I'd suggest trying it without the firework, and see if that "fixes" it? Maybe the player is somehow colliding with the firework, though I guess I doubt it.
     
Thread Status:
Not open for further replies.

Share This Page