ArenaPVP: Saving Arenas

Discussion in 'Spigot Plugin Development' started by pas5w0rd, May 28, 2017.

  1. Hey there!

    How can I save arenas/spawn locs to a file and then randomise them for each arenapvp mode?
    I can do all the checking if its being used stuff.


    Thanks!
    :D
     
  2. Maybe try and save the arena in the config with the value of the location.
    What it should look like:
    Code (Text):
    arena_one: 45 64 57
    arena_two: 43 44 56
    arena_three: 54 245 64
    arena_four: 54 87 686
    Now for randomizing, get the amount of keys in config and use a random to select which one.
     
  3. I use something that looks like this:

    Code (Text):
    arenas:
      arena_1:
        X: 1
        Y: 2
        Z: 3
        Yaw: 34
        PITCH: 180
      arena_2:
        X: 1
        Y: 2
        Z: 3
        Yaw: 34
        PITCH: 180
    Just looks a bit neater than the code suggested above plus allows for Yaw/Pitch configuration, which could be a problem unless you make it so the eyes of the players look at the other player at their spawn point, which isn't a bad idea.
     
  4. Inkzzz

    Resource Staff

    Serialise the data into a String. It's much easier to handle and is faster as you only read one section from the configuration file, not many different variables etc.