3 The config system
Thijs Wiefferink edited this page 2017-02-12 20:58:08 +01:00

Structure

The config system supports global, group and individual settings. The config.yml file only contains global settings and profiles, these profiles can be assigned with the inheritance system. The default.yml file contains all settings that can be changed globally, in a group or in a individual region and will change properties of all regions. When you create a group with the build-in commands a groups.yml file will appear, this contains the created groups. Settings specified in a group of the groups.yml file will affect all regions that are added to that group. Each region has its own file inside the /regions folder located inside the AreaShop folder, this file contains the individual region information and settings.

Example

The image below shows what happens when AreaShop for example wants to know the price (or any other setting as listed in default.yml) of House-1.

Getting a region setting

Files and their contents

config.yml

Global settings that change the way the plugin functions or looks.

default.yml

Global settings that affect all regions, all settings found in this file can also be used in the groups.yml file and region files (which override the setting in default.yml).

groups.yml Example

Group settings, overwrite settings of default.yml, can be overridden by region settings.

houses:
  name: Houses
  priority: 0
  regions:
  - house_1
  - house_2
  - house_3
  - house_4
  - house_5
  general:
    # Add settings from general section in default.yml here
  rent:
    price: 500
    duration: 5 days
    # Add settings from rent section in default.yml here
  buy:
    # Add settings from buy section in default.yml here
plots:
  name: Plots
  priority: 0
  regions:
  - plot_1
  - plot_2
  - plot_3

<region>.yml Example

Stores region information and settings. All settings of default.yml can also be put in here to only apply to this region. Also stores information about the region itself, like the world or the attached signs. Below is an example with a bunch of data that could be stored here. The region file will have the name of the WorldGuard region with .yml behind it (totally lowercase).

general:
  name: house_1
  type: rent
  world: world
  signs:
    '0':
      location:
        world: world
        x: 155.0
        y: 113.0
        z: 312.0
      signType: WALL_SIGN
      facing: WEST
  teleportLocation:
    world: world
    x: 130.22022644807146
    y: 265.7245692888291
    z: 293.1215880485074
    yaw: '70.01706'
    pitch: '67.05002'
  ## Add settings from the 'general' section from default.yml at this level (below 'general')
rent:
  price: 10.0
  duration: 1 m
  rentedUntil: 1409317702057
  renter: 5becddb3-d9ff-3505-ac41-8434309e226c
  renterName: NLThijs48
  timesExtended: 0
  ## Add settings from the 'rent' section of default.yml at this level (below 'rent')

Variables for the config.yml settings

The following variables can be used in all <something>Profile settings. If a value for a variable does not exist for the current region state (for example the %player% when a region is not sold/rented), then the variable will not get replaced. Check an always up-to-date list by opening the config.yml in the repository.

Variable Description
%region% The region name (with correct capitalization).
%player% The name of the player that rents/buys the region (with correct capitalization).
%uuid% The uuid of the player that rents/buys the region.
%friends% The names of friends added to this region separated by , .
%friendsuuid% The UUID's of friends added to this region separated by , .
%price% The price of the region formatted with the configured characters before and after the number.
%rawprice% The price without formatting, like 10.0 or 7.77.
%duration% The duration of a rent region, for example 1 d, 4 minutes or 2 years.
%world% The name of the world that the region is in.
%type% The type of the region, rent or buy.
%until% The end time of a rent formatted as configured with timeFormatChat.
%untilshort% The end time of a rent formatted as configured with timeFormatSign.
%width% The width of the region (amount of blocks on the x-axis).
%depth% The depth of the region (amount of blocks on the z-axis).
%height% The height of the region (amount of blocks on the y-axis).
%timeleft% The time left on the rent (uses the unit of time that fits best, minutes used from 121 seconds till 120 minutes).
%clicker% The name of the player that clicked the sign (only to be used in the signProfiles section).
%resellprice% The price of a region when it is in resell mode.
%rawresellprice% The resellprice without formatting, like 10.0 or 7.77.
%moneyback% The amount of money the player will get back when unrenting/selling the region (formatted with currency characters).
%rawmoneyback% The moneyback without formatting, like 10.0 or 7.77.
%moneybackpercent% The percentage of the price the player will get back when unrenting.
%maxextends% The maximum number of extends a player can do on the region.
%extendsleft% The number of extends that are left (maxextends - timesextended).
%maxrenttime% The maximum time you can rent a region in advance (human readable).
%inactivetime% The maximum time a player may be inactive before unrent/sell (human readable).
%year% The current year.
%month% The current month in the year.
%day% The current day in the month.
%hour% The current hour in the day (0-23).
%minute% The current minute of the hour.
%second% The current second of the minute.
%millisecond% The current millisecond of the second.
%epoch% The number of milliseconds since January 1, 1970 (Unix Epoch).