Skip to content
givemeapples edited this page Apr 25, 2015 · 6 revisions

PlotMaster Setup

The basic setup for PlotMaster is designed to be pretty simple, containing a lot of default values that should fit most servers needs with minor tweaks. However, nearly everything that controls the way PlotMaster works can be configured to your liking. The configuration file for PlotMaster is called config.json and is located in the root of the PlotMaster configuration folder. Since this plugin uses json instead of yml which most people are probably used to, I will start this tutorial by going over json and how I will reference different parts of the config.

Json

Why did I choose to use Json? There are a few reasons. First off, it is hugely easier, cleaner and more straightforward to code with. Secondly, the Gson parser that I use is faster than the SnakeYML parser that Bukkit uses. Lastly, it allows the config to be more customizable and extensible than if I were to use yml.

So, lets dive into using json. Here is an example of a json file.

{
  "school": "Example School 1",
  "enrolled": 900,
  "students": [
    {
       "first": "Oliver",
       "last" : "Queen",   
       "grade": 11
    },
    {
       "first": "Slade",
       "last": "Wilson",
       "grade" : 12
    }
   ],
  "address": {
     "street": "123 Example Drive",
     "city": "Starling City",
  }
}

Lets look at this piece by piece. (Please note, spacing does not matter in json. The above example could have been all on a single line, each value is seperated by a ,, [], or {} depending on the type)

"school": "Example School 1", is a "key value" pair. I would refer to this as school with a value of Example School 1. If I said, set school to Example School 2, this would be the value you changed.

"students": [ is the beginning of an array. Arrays can contain an arbitrary amount of values, seperated by commas. In this example, we have 2 student object values (objects are enclosed with {}). If I was to refer to the array itself, I would just say the student array. If I wanted to refer to a specific object in this array (say I want to get the first name of the first student) I would say students[1].first. If I was referring to an arbitrary student or to all students, I would reference it by students[].first or just students.first. You can add more values to an array.

"address": { is an object in json. Objects themselves contain more key value pairs, arrays or objects. In the above example there are two key/value pairs in the address object. address.street and address.city

Clone this wiki locally