Push player?

Hello, i want to push an player, to a direction,
i think i have to get position, and add? i’m not sure, and how can i get the direction of the player is looking at?
can you help me?

Player#getLocation() - Location<World>
Player#getRotation() - Vector3d
--
Player#setLocation(Location<World>) - void
Player#setRotation(Vector3d) - void
Player#setLocationAndRotation(Location<World>, Vector3d) - void

yes, and how can i push the player?

With ‘push’ you mean apply a velocity to the player so that he is ‘pushed’ into a direction? If so, you need to combine the previously mentioned methods with Player#setVelocity(Vector3d vector3d).

okey? but i don’t have Player#setVelocity();
is it normal?

Not really, I think you should update your SpongeAPI :stuck_out_tongue:.

if i don’t have velocity, can i offer velocity manually?
your code say it, i’m thinking i can

If you’re SpongeAPI is not up to date you won’t be able to offer the key manually. Just update your SpongeAPI.

i have the last spongeforge, i use gradle to use the last spongeapi.
it worked before, has it changed? do i have to download the last spongeapi? do i have to put in my mod folder? or where?

Can you please post your gradle.build file and the code in question?

my gradle:
[spoiler=“gradle code”]
/*

  • This build file was auto generated by running the Gradle ‘init’ task
  • by ‘TheSebakl’ at ‘22/11/15 23:29’ with Gradle 2.6
  • This generated file contains a sample Java project to get you started.
  • For more details take a look at the Java Quickstart chapter in the Gradle
  • user guide available at Chapter 7. Java Quickstart
    */

// Apply the java plugin to add support for Java
apply plugin: ‘java’

// In this section you declare where to find the dependencies of your project
repositories {
// Use ‘jcenter’ for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
mavenCentral()
maven {
name = ‘sponge’
url = ‘http://repo.spongepowered.org/maven
}
jcenter()
}

// In this section you declare the dependencies for your production and test code
dependencies {
// The production code uses the SLF4J logging API at compile time
compile ‘org.slf4j:slf4j-api:1.7.12’
compile ‘org.spongepowered:spongeapi:3.0.0’
// Declare the dependency for your favourite test framework you want to use in your tests.
// TestNG is also supported by the Gradle Test task. Just change the
// testCompile dependency to testCompile ‘org.testng:testng:6.8.1’ and add
// ‘test.useTestNG()’ to your build script.
testCompile ‘junit:junit:4.12’
}

[/spoiler]
my code:
[spoiler=“code”]
public void pushplayer(Player pl, Vector3d vector){
pl. ???
}

[/spoiler]
my code is not very important because it’s a function where it push the player by a vector, …

Api version 3.1.0 or 3.1-SNAOSHOT is the latest one.

okey, but i try to change 3.0.0 with 3.1.0 or 3.1, but doesn’t work

for the moment, i take the version manualy