Can't resolve location constructor

Hey,
When I try to create a new Location object in my mysql class, intellij says “Cannot resolve constructor”.

This is how I tried to perform the action:

Location location = new Location(world, x, y, z);

My imports:

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.UUID;
import org.spongepowered.api.world.Location;

import javax.sql.DataSource;

import org.slf4j.Logger;
import org.spongepowered.api.service.sql.SqlService;

x, y and z -> int, world -> String

So can you show me my mistake ?
What did I do wrong ?
Greets

If you check the JavaDocs, you will see that that isn’t a valid constructor.

Ok …
thanks dude. I saw this already, but yesterday , I createt a topic (here) and somebody said me, that my code would be right …

Please can you show me, how I can create a Location object with x,y,z and the worldname ?
Thanks :slight_smile:

EDIT: I just dont understand, how to get the Extent object …

Since the World object extends Extent, you can use that in place of Extent

To get the world by name:

//Have a game object called game
Optional<World> worldOptional = game.getServer().getWorld("worldname");
//Make sure the world optional is present
if(worldOptional.isPresent()){
    World world = worldOptional.get();
}

Not sure if this code will compile properly, but I believe that it will.

Same error again …

@Hitzk0pf
You forget this section of code:

//Make sure the world optional is present
if(worldOptional.isPresent()){
    //Get the actual world object from the optional
    World world = worldOptional.get();
}

OHHH I’m sorry… I thought this is only a check and forgot to look at the section in the if :smiley:

Another short question: I saw, that you updatet your economy plugin. Does it use the internal sponge “economy system” now ? I heard of it, but i’m not up to date there :smile:

When you think, that my question does not fit here, please send me a PN ^^
Greets :smile:

1 Like

No problem, don’t forget to mark the thread as solved!