NoSuchMethod: Player.setVelocity

Hello everyone (again…),

I’ve got another problem. I am trying to set to boosts the players speed by the following code.

    public void onPlayerMove(DisplaceEntityEvent.Move.TargetPlayer event) {
        Optional<Player> optPlayer = event.getCause().first(Player.class);
        if (!optPlayer.isPresent()) {

        Player player = optPlayer.get();
        Location location = player.getLocation();
        BlockState JumpPadTriggerBlock = player.getWorld().getBlock((int)location.getPosition().getX(), (int)location.getPosition().getY(), (int)location.getPosition().getZ());
        String JumpPadTriggeredBlockName = JumpPadTriggerBlock.getType().getName();

        if (JumpPadTriggeredBlockName.equals("minecraft:stone_pressure_plate")) {
            BlockState JumpPadBlock = player.getWorld().getBlock((int)location.getPosition().getX(), (int)location.getPosition().getY() -1, (int)location.getPosition().getZ());
            String JumpPadBlockName = JumpPadBlock.getType().getName();

            if (JumpPadBlockName.equals("minecraft:redstone_block")) {
                player.setVelocity(new Vector3d(player.getVelocity().getX(), 1.0D, player.getVelocity().getZ()));

My goal is to create a similar boosts as in most of the lobby servers.

BTW. I tried to use BlockTypes but I didn’t work.

Thanks in advance,

If player.setVelocity does not exist then you are testing on an old version of SpongeForge/Vanilla. Update it to the latest

I am using 3.0
But I will try to update.

Edit: Still getting the error.
Downloaded these files:
forge-1.8-, yeah I ran the installer and copied the files

Your Forge versions should match up in the filenames (see here). For example, you have:

So you should be getting Forge Build 1694 to match up with your spongeforge build

I am now using the same version and it still does not work.

Event is being fired but velocity does not change.

Why are you setting the velocity to the player’s position * 5? That doesn’t seem right to me

Saw this in a similar bukkit plugin :smiley:
I also tried to do something like this
player.setVelocity(new Vector3d(player.getVelocity().getX(), 100.0D, player.getVelocity().getZ()));
Shouldn’t this throw me into the air?

I think it should, yes.

BTW you can make that neater by doing player.setVelocity(player.getVelocity().add(0, 100, 0))

Oh, I didn’t know that, thanks.
But nevertheless, the velocity does not change.
I added a the line before in the same scope and this is definitely being called.

bump :confused:
The DataTransactionResult returns true aswell.

@Cludch You should post this to the bug tracker then so someone can take a look.