Setting multiple spawns

Discussion in 'Plugin Development' started by xNamesi, Nov 23, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    xNamesi

    How would i create multiple spawns that gets saved in my config.yml file

    I need the command /addspawn to create a new line in the config file and store a location of where the player is standing. Then when they do /addspawn a second time it will create a new line and add aonother location, each with incrementing values e.g. 1, 2, 3,
    Code:java
    1. //Setting spawnpoints
    2. if(commandLabel.equalsIgnoreCase("addspawn")) {
    3. if(args.length == 0){
    4. p.sendMessage(ChatColor.RED + "Add a number after it");
    5. }else{
    6. Location location = p.getLocation();
    7.  
    8. }
    9. }
     
  2. Offline

    WesJD

    When they do it check the highest spawn added and then add one to it. Wazzah, put their location and you're done.
     
  3. Offline

    SuperOriginal

    For incrementing the key: get the the size of the keyset, and add 1.

    For storing locations: store their world name, their x, y, z, pitch, and yaw.

    When you want to get the location back you can do new Location(World, x,y,z,(float)pitch,(float)yaw)

    To get the world from its name, use Bukkit#getServer()#getWorld(name)
     
  4. Offline

    Skionz

  5. Offline

    SuperOriginal

    Skionz I'm assuming it's an arena plugin with a spawn for each player.
     
Thread Status:
Not open for further replies.

Share This Page