# How to Start

## Requirements

\
**1) Spigot**

{% hint style="warning" %}
You need Spigot or Paper for the plugin to work. Don't use Craftbukkit.
{% endhint %}

**2) PlaceholderAPI**

{% hint style="info" %}
This dependency is optional but extremely recommended. It will allow you to display the value of the created variables wherever you want.\
<https://www.spigotmc.org/resources/placeholderapi.6245/>
{% endhint %}

## Installation

To install the plugin on your server just place the ServerVariables.jar file inside your plugins folder. Remember to use a Spigot/Paper server. Examples will be generated in the `config.yml` file, you can use them as a reference or delete them.

### Config.yml

This is the main file where you can add new variables. To create a new variable just add a new configuration section in the config in the "variables" path.&#x20;

### Variables folder

You can also create more files inside the **variables** folder, where you can add new variables. This is a good practice to keep everything more organized. These variables should also be created under the "variables" path.

{% hint style="warning" %}
Remember to use a different name for each of the variables!
{% endhint %}

## Your First Variable

Let's create our first variable. We want players on our server to have a custom currency called "Scorps", so they can use this money to buy special items.

Since each player will have their own amount of "Scorps", the variable should be of PLAYER type. Let's start adding that to the config, with the name of the variable.

```yaml
variables:
  scorps:
    variable_type: PLAYER
```

Now, we know that this currency is a numerical value so we must select whether it will have decimals or not. In my case I don't want decimals, so the value type of the variable should be INTEGER.

```yaml
variables:
  scorps:
    variable_type: PLAYER
    value_type: INTEGER
```

Finally, a very important detail is to set a default or initial value for the variable. All players will start with this amount of scorps.

```yaml
variables:
  scorps:
    variable_type: PLAYER
    value_type: INTEGER
    initial_value: 5
```

In these simple steps you have created your first variable. How can I use it now? There are many ways you can. For example, if you have a GUI plugin that support click conditions (like CommandPanels), you can sell a custom item depending on the amount of scorps the player has. You just need to use the following PlaceholderAPI variable to get the player's scorps:

`%servervariables_value_scorps%`

To modify the scorps of the player you can use one of these three commands:

* /svar set scorps \<amount> \<player>
* /svar add scorps \<amount> \<player>
* /svar reduce scorps \<amount> \<player>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ajneb97.gitbook.io/servervariables/how-to-start.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
