• Es freut uns dass du in unser Minecraft Forum gefunden hast. Hier kannst du mit über 130.000 Minecraft Fans über Minecraft diskutieren, Fragen stellen und anderen helfen. In diesem Minecraft Forum kannst du auch nach Teammitgliedern, Administratoren, Moderatoren , Supporter oder Sponsoren suchen. Gerne kannst du im Offtopic Bereich unseres Minecraft Forums auch über nicht Minecraft spezifische Themen reden. Wir hoffen dir gefällt es in unserem Minecraft Forum!

List<Location> Problem

Galliar12

Kuhfänger
Registriert
16 Juli 2011
Beiträge
85
Diamanten
0
Minecraft
Galliar12
Hey Leute, habe ein Problem:

Code:
            int i = 1;
            if (i >= this.plugin.respawn.size()) {
                i = 1;
            } else {
            i++;
            Location loc = (Location)this.plugin.respawn.get(i);
            p.teleport(loc);

Ich werde mit diesem Code immer wieder an die gleiche Stelle teleportiert, und zwar an den letzten Eintrag der Liste.

Würde mich über Ideen wie ich dieses Problem lösen kann freuen :)
 

Galliar12

Kuhfänger
Registriert
16 Juli 2011
Beiträge
85
Diamanten
0
Minecraft
Galliar12
Das einzigste was noch sinnvoll ist zu posten ist wie ich das speicher:

Code:
        this.plugin.respawn.add(p.getLocation());
        int i = this.plugin.respawn.size();
        String str = "Spawner." + i;
        this.plugin.cfgrespawner.set(str + ".world", p.getLocation().getWorld()
                .getName());
        this.plugin.cfgrespawner.set(str + ".x", p.getLocation().getBlockX());
        this.plugin.cfgrespawner.set(str + ".y", p.getLocation().getBlockY());
        this.plugin.cfgrespawner.set(str + ".z", p.getLocation().getBlockZ());
        this.plugin.cfgrespawner.set(str + ".yaw", p.getLocation().getYaw());
        this.plugin.cfgrespawner
                .set(str + ".pitch", p.getLocation().getPitch());

        try {
            this.plugin.cfgrespawner.save(plugin.respawner);
        } catch (IOException ex) {
            Logger.getLogger(this.plugin.getName())
                    .log(Level.WARNING,
                            "Error while saving the spawners file. Please contact the plugin author of this plugin with the following error",
                            ex);
        }

Nope, soll ein Random Spawn plugin sein, also wenn man Join man zu einem dieser Punkte tp wird.
 
Oben