Jump to content

Recommended Posts

Posted

Hallo wie kann ich eigentlich spielr in andere welten telepotieren ich habe das bisher:

private static HashMap<Location> loc;

public static World world;


    WorldCreator w = WorldCreator.name("NP");
    world = Bukkit.createWorld(w);

ich brauche es nur um das Game-Profile zu updaten also soll man nur kurtz in die welt np und dann wieder zurück telepotiert werden (also dahin wo man war) deshalb habe ich auch eine hasmap gemach die die location speichern soll aber wie kann ich deinen spieler telepotieren und die location speichern:

Posted

Erstell doch einfach eine Location, da musst du ja die Welt + Koordinaten angeben.

 

PS: Ne HashMap benötigt 2 Werte, ein Key und ne Value

 

HashMap<String, Location> hashmap = new HashMap<String,Location>();

 

Posted

Hi,

player.teleport(new Location(Bukkit.getWorld("WeltName"), X, Y, Z));

sollte denke funktionieren solange die Welt "WeltName" existiert.

 

-Yuki

Posted

Du holst dir die Location, mit p.getLocation(). Die fügst du dann als value in die HashMap (Key ist dann der Spielername). Wenn du die Location dann wieder brauchst holst du dir die Location per Spielernamen wieder aus der Hashmap.

 

Das könntest du dafür gebrauchen:

 

hashmap.put(key, value)

hashmap.get(key)

hashmap.remove(key)

 

Dabei können Key und value jedes Objekt sein, du hast aber in deiner Hashmap ja als Key nen String und als Value ne Location definiert, daher musst besagte auch nehemen.

 

//Handy

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...
B
B