TP every player to her spawn [SkyWars] ¿HOW?

Discussion in 'Plugin Development' started by PistoFrancoPuumm, Jul 22, 2016.

Thread Status:
Not open for further replies.
  1. When an admin setup an arena doing: /sw spawn 0,1,2,3 or a random int do that code:

    Code:
    if (args[0].equalsIgnoreCase("spawn")) {
        int target = Integer.parseInt(args[1]);
        pl.getConfig().set("arena.player."+target+".x", p.getLocation().getBlockX()); // get the location of the sender
        pl.getConfig().set("arena.player."+target+".y", p.getLocation().getBlockY());    pl.getConfig().set("arena.player."+target+".z", p.getLocation().getBlockZ());
        pl.getConfig().set("arena.player."+target+".pitch", p.getLocation().getPitch());
        pl.getConfig().set("arena.player."+target+".yaw", p.getLocation().getYaw());
        pl.saveConfig();
        if(integerList.contains(target)){
            Util.broadcast(ChatColor.RED+""+target+" can't be added to at list");
        }else {
            integerList.add(target);
            Util.broadcast(ChatColor.GREEN+""+target+" added to at list");
        }
        pl.getConfig().set("arena.player.totalplayers",integerList.size());
        Util.broadcast(ChatColor.GREEN + "Player " + ChatColor.AQUA + target + ChatColor.GREEN + " spawn has been set!");
        return true;
    }
    that makes that in config.yml:
    http://imgur.com/a/ecaZ9

    Then, later i get that information from another class... but here is the problem...

    Code:
    public void tpPlayers(){
        pl.getConfig().getInt("arena.player.totalplayers"); // thats an arraylist... and i only get the size of it, to know how many players have
    }
    
    I am looking for do a loop for(pl.getConfig.getInt("arena.player.totalplayers").size)
    and TP every player to her island... but i don't know how to do it... can you help me?
    i ran out of ideas.. :C
     
    Last edited: Jul 22, 2016
  2. i tried it, but when reload / close the server, that list will start at 0 another time... Then, i save it here.
     
Thread Status:
Not open for further replies.

Share This Page