How to create an arena and save it to arena.yml

Discussion in 'Plugin Development' started by greeves12, Jul 25, 2016.

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

    greeves12

    I'm creating a new minigame plugin and I've ran into a few troubles, I'm trying to figure out how to save the arena to the arena.yml file yet it doesn't work. Ill post some of the code I used.
    Code:
    public class CreateArena {
    public static void createArena(String ArenaName, String ArenaType, Player p)
    {
    if(!ArenasFile.getData().contains("Arenas." + ArenaName + ".Type"))
    ArenasFile.getData().set("Arenas." + ArenaName + ".Type", ArenaType.toUpperCase());ArenasFile.saveData();ArenasFile.reloadData();p.sendMessage("Arena Created");}
    }
    
    
    }
    Code:
    public class CreateArenaCommand {
    public static void createArena(String ArenaName, String ArenaType, Player p) {
        if (ArenaType.equalsIgnoreCase("BB")) {
            ArenaName = ArenaName + "ball";
    CreateArena.createArena(ArenaName, ArenaType.toUpperCase(), p);
    
            ArenasFile.saveData();
        }
    }
     
  2. Offline

    Zombie_Striker

    Check your encapsulation. You are missing a bracket. Also, format your code. There is no reason for all those statements to be on the same line.

    What do you mean by "doesn't work"? What currently happens?
     
  3. Offline

    greeves12

    It doesn't write anything into the AreanFile.yml as it should
     
  4. @greeves12
    You need to show us full classes, for example, what is this "ArenasFile"? Also, please follow naming conventions, variable names should be camelCase.
     
    Last edited: Jul 26, 2016
  5. Offline

    greeves12

    Thanks for the reply but I actually got it to work last night, I had to create an id for each arena.
     
  6. Offline

    Zombie_Striker

    @greeves12
    If your problem has been solved,mark this thread as solved.
     
Thread Status:
Not open for further replies.

Share This Page