> For the complete documentation index, see [llms.txt](https://wiki.innouniq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.innouniq.com/plugins/archieve/voting-until-4.2.0.md).

# Voting - Until 4.2.0

{% hint style="info" %}
New documentation for this resource under construction.
{% endhint %}

## Description <a href="#description" id="description"></a>

Minecraft extension, which allows players to determine about various situations using voting system.

## Prerequisites <a href="#prerequisites" id="prerequisites"></a>

Before you run Voting plugin on your server, there are a few requirements that you should check.

* Ensure you are using Minecraft version **1.8.8** or **later**. (Versions below 1.8.8 are not supported!)
* Your server has installed **Java8** or later.
* Make sure that you have already installed plugins [**TheCore**](https://www.spigotmc.org/resources/thecore.84131/)

## Installation <a href="#installation" id="installation"></a>

1. Put `Voting.jar` into plugins folder at your server.

> Downloaded .zip file contains more .jar file depending on the server version. Choose the one that fits your server.

1. Restart your server.
2. Done

[![discord-banner\_e1\_1200.png](https://wiki.innouniq.com/discord-banner_e1_1200.png)](https://discord.gg/vPHWEapDGR)

## Commands & Permissions <a href="#commands-permissions" id="commands-permissions"></a>

| Command Description  | Command                                     | Permission                           |
| -------------------- | ------------------------------------------- | ------------------------------------ |
| **Player section**   |                                             |                                      |
| Open Voting GUI      | /Voting \[Open]                             | Voting.GUI.Open                      |
| Start a round        | /Voting \<Unit> \[Parameters]               | Voting.Round.Start.\<Unit>           |
| Place a vote         | /Voting \<Agree/Disagree>                   | Voting.Vote.Place                    |
| Help                 | /Voting Help \[Player]                      | Voting.Help.Player                   |
| Information          | /Voting Info \[Player]                      | Voting.Info.Player                   |
|                      |                                             |                                      |
| **Admin section**    |                                             |                                      |
| Advanced Help        | /VotingAdmin Help Admin                     | Voting.Help.Admin                    |
| Advanced Information | /VotingAdmin Info Admin                     | Voting.Info.Admin                    |
| Set world's alias    | /VotingAdmin Alias Set \<World> \<Alias>    | Voting.Administration.Alias          |
| Remove world's alias | /VotingAdmin Alias Remove \<World> \<Alias> | Voting.Administration.Alias          |
| Reload plugin        | /VotingAdmin Reload \[All]                  | Voting.Administration.Reload.All     |
| Reload locale        | /VotingAdmin Reload Locale                  | Voting.Administration.Reload.Locale  |
| Reload options       | /VotingAdmin Reload Options                 | Voting.Administration.Reload.Options |
| Reload units         | /VotingAdmin Reload Units                   | Voting.Administration.Reload.Units   |

#### Additional Permissions <a href="#additional-permissions" id="additional-permissions"></a>

| Description           | Permission                      | Covers                                 |
| --------------------- | ------------------------------- | -------------------------------------- |
| Player                | Voting.Player                   | Base player's actions \*               |
| Admin                 | Voting.Administration           | Complete package of all permissions \* |
| Admin's tab completer | Voting.Administration.Base      |                                        |
| Reload                | Voting.Administration.Reload.\* | Permissions of Reload                  |
| Create sign           | Voting.Sign.Create              |                                        |
| Destroy sign          | Voting.Sign.Destroy             |                                        |
| Start any round       | Voting.Round.Start.\*           |                                        |
| See result ratio      | Voting.Round.ResultRatio        |                                        |

\* Permission does not cover ability to start a round

## Configuration <a href="#configuration" id="configuration"></a>

Resource is fully customizable, so here is detailed explanation of variables at configuration files.

### Config <a href="#config" id="config"></a>

#### Localization <a href="#localization" id="localization"></a>

Fully customizable localized messages. Just make duplicate of EN.yml file(In the same folder!). Rename it and into **config.yml**, write the name of the file.

Example of the Locale file:

```yaml
#LocaleFile: EN.yml
Prefix:
  Base: "&9&lVoting &e\u2771"
  ...
```

Copy

```yaml
#LocaleFile: SK.yml (Slovak)
Prefix:
  Base: "&9&lHlasovanie &e\u2771"
  ...
```

Copy

#### Analytics <a href="#analytics" id="analytics"></a>

Plugin sends anonymous data such as version of this resource, your server version and addition data of configuration. These data will help me in future development.\
All requests are asynchronous, so it has no impact on server's performance.

If you don't want to share these data, you can easily disable it.

```yaml
Analytics:
  Active: false
```

Copy

**Data collected from your server about Voting**

Example:

* Base

```
Versions:
    Plugin: 3.0.0
    Server: 1.16.X
```

Copy

* AdditionalData

```json
{
   "VotingUnit":{
      "Category":{
         "Weather":5,
         "Custom":2
      },
      "Count":7
   },
   "Options":{
      "Round":{
         "Animation":{
            "Speed":100,
            "Activity":true
         },
         "Duration":60,
         "Pause":{
            "PersonalActivity":true,
            "GlobalActivity":true
         }
      },
      "Visual":{
         "BossBar":{
            "Activity":true
         },
         "ActionBar":{
            "Activity":true,
            "Progress":{
               "Char":"●",
               "Count":10
            }
         }
      },
      "Economy":{
         "Activity":false,
         "Type":"NONE"
      }
   }
}
```

Copy

### Options <a href="#options" id="options"></a>

Options file is divided to sections.

#### Command <a href="#command" id="command"></a>

Plugin manages **2** main commands `Voting` and `VotingAdmin`. Each command can have aliases.

> Alias is a command, which invokes the same action as the main command.

#### Economy <a href="#economy" id="economy"></a>

By enabling economy, you can charge players for placing a vote or starting a voting round.

Plugin supports **3** Economy providers `Vault`, `PlayerPoints` and `Experiences`.\
If you want to use any one of it, at first, you need to enable it!

> There is required that enabled providers are also installed on the server!

> Experiences does not require any additional plugin! Player's current experiences are used here.

**Types used in configuration file**

* `VAULT_WRAPPER`
* `PLAYER_POINTS`
* `EXPERIENCE`

#### Round <a href="#round" id="round"></a>

In this section you can configure core of the plugin. **Duration** of the round, **minimum count of players** required to start the round. And much more.

**Pause**

There are **2** types of pauses, which prevents to start next round immediately after one round has ended.

**Explanation of types**

* **Global** - No one will be able to start a round until pause ends.
* **Personal** - In short, you can configure, that player will be able to start round only once in a 15 minutes.

> Personal pause is not applied when player wants to place a vote!

**Animation**

At changing **time** in a world you can use smoothy animation. Sun or Moon is moving across the sky so it looks like it has speed up the time.

You can specify speed of the animation. Available range is **<50;750>**

> Speed **100** means that time change from **0** to **23999** takes **12** seconds.

```yaml
TimeChangeAnimation:
  Speed: 100
```

Copy

> This feature is only available for **Weather** units.

#### Visual <a href="#visual" id="visual"></a>

Section represents components displayed at chats, boss bars and action bars.

**Chat**

At displaying message to players, **prefix** and **message** are joined by specified char, default by space. But if you want to remove this space or add annother char, you can specify it in configuration file.

```yaml
Chat:
  MessageJoiningChar: " "
```

Copy

**BossBar**

Via **BossBar** players are able to see current information about running round.

**Available color values**

`PINK`, `BLUE`, `RED`, `GREEN`, `YELLOW`, `PURPLE`, `WHITE`

**Available style values**

`SOLID`, `SEGMENTED_6`, `SEGMENTED_10`, `SEGMENTED_12`, `SEGMENTED_20`

**ActionBar**

Via **ActionBar** players are able to see current result of running round.\
Result is shown in percentual ratio and you can define colors of its possitive, resp. negative part. Also you can define **char** and **count** of these chars shown in ratio.

**Intervals**

These information can be displayed in specified **intervals** and these itervals are mainly associtated with **BossBar** and **ActionBar**.

Imagine interval in math, but reversed because of countdown which is decresing.\
If we want to display BossBar since **30** seconds to **10** seconds, we use interval `30:11`(`FROM:TO+1`). Plus **1** because of we want to hide BossBar in 10 seconds. (If we keep 10 seconds in the iterval, BossBar will be hidden in 9 seconds.)

### Signs <a href="#signs" id="signs"></a>

You can create Voting signs around the world. By interacting with sign, players can **place a vote** or **start** a round assigned to that sign.

#### VotingUnit Sign <a href="#votingunit-sign" id="votingunit-sign"></a>

1. \*\*Voting\*\*
2. \<VotingUnitName>
3.
4.

#### Vote Sign <a href="#vote-sign" id="vote-sign"></a>

1. \*\*Vote\*\*
2. \<Agree/Disagree/Yes/No>
3.
4.

### VotingUnit <a href="#votingunit" id="votingunit"></a>

Voting Unit, later only ***VU***, is a core of the resource. You can also name it **Voting Situation**. Players place votes about these units.

> Plugin offers **7** predefined VU and you can easily extend or reduce this set.

#### Creating VotingUnit in the configuration file <a href="#creating-votingunit-in-the-configuration-file" id="creating-votingunit-in-the-configuration-file"></a>

Configuration file `VotingUnits.yml` is located at main folder of the resource.

**Types**

* `GLOBAL` - Only one round can run at one moment.
* `LOCAL` - In each world, round can run independently on round in another world.

> At **Local** type, there is able to run more than one voting round at the same time. E.g. *Day* for Survival world and *Night* for SkyBlock world.

> **Global** and **Local** round cannot run at the same time!

**Categories**

* `WEATHER` - Allows to change weather using built-in methods. Time change animation is available at this category.
* `CUSTOM` - VotingUnit that fits right for your server.

**Immediate initiator's vote**

This flag indicates, that player, initiator, places vote immediately at starting a round.

**Price**

We mentioned above that you can chagre players for placing a vote or starting a voting round.\
Price for *placing a vote* can be different like for *starting* a voting round.

**World Restriction**

You can restrict in which world will not be able to start voting round.

**Result Commands**

After the end of the round, you can specify commands, which will be invoked.

**Types of commands**

* `Global` - Commands are performed only once. Especially used at custom units.
* `Participant` - Commands are performed for each player separately
  * `Success` - Commands performed when round success
    * `All` - Commands executed for all players. (At Local round, under 'All players' is meant players in that world.)
    * `Voters` - Commands executed only for players which placed a *positive* vote
  * `Failure` - Commands performed when round fails
    * `All` - Commands executed for all players. (At Local round, under 'All players' is meant players in that world.)
    * `Voters` - Commands executed only for players which placed a *negative* vote

**Example of commands**

```yaml
Result:
  Command:
    Global:
      - "kick {target}"
    Participant:
      Success:
        All:
          - "tell {player} Round has succeed."
        Voters:
          - "karma give {player} 5"
      Failure:
        All:
          - "tell {player} Round has failed."
        Voters:
          - "karma take {player} 5"
```

Copy

> These commands do not have to be used all. You can choose only that types, which fits your expectations.\
> **E.g.,** If you want to use only global commands, you do not have to use Participant section!

***

> Next parts are divided in order to category.

**Weather Category**

At first, let's clarify basic information.

* **1 Minecraft Day = 24000 Ticks = 20 Minutes**
* Tick **0** reprecents **06:00** and tick **13000** reprecents **19:00**
* More information about daylight cycle is avaialable [**here**](https://minecraft.gamepedia.com/Daylight_cycle#24-hour_Minecraft_day)

When round with weather category success, these values are applied:

```yaml
Result:
  Time: <Value> #Value indicates time in a day. Range <0;23999>
  Rain: <Flag> #Flag indicates rainy weather
  Lighting: <Flag> #Flag indicates stormy weather
  Duration: <Value> #Value indicates how long takes result.
```

Copy

> These **4** values can be used separately.\
> **E.g.,** In one VU you will use only *Time* value and in another VU, you will use *Rain*, *Lighting* and *Duration* value.

**Example of Weather VU**

```yaml
DAY: #Key of the unit. Used in intern methods, localizations file.
  Name: Day #Readable name of the unit. Used in tab-completer.
  Type: GLOBAL
  Category: WEATHER
  ImmediateInitiatorVote:
    Active: true
  Price:
    Start: 0
    Vote: 0
  Restriction:
    World: [ ]
  Result:
    Time: 0 #Sets time to 6 o'clock
```

Copy

> Do not forget to set Alias for the weather VU in localzation file.\
> Path `Alias.Unit.Weather.<VU-Key>`

**Custom Category**

Via this category you can create own situations, which perfectly fits your server.

There is better to explain the whole mechanism with an example. We will create VU which **kicks** player from the server, if round success.

> This category works with parameters typed in command located behind *Name* of the VU.

We need to define **2** parameters. First parameters represents whom to kick and second is a reason.

> Our final command for start this round is **/Voting Kick \<Player> \<Reason>**

**Types of parameters**

* `PLAYER` - Accepts only online player as a parameter.
* `WORLD` - Accepts only name of world.
* `PAYLOAD` - Accepts more than one word. Sentence.

Our first parameter is named **player**, or target for better meaning.

> Each parameter has to have its name. This name is used as a replacement at localization file and at executed commands after the end of the round.

There can occur situation, you want to **protect** yourself as an initiator of the round or you want to **protect** some players before kicking out from the server at this situation. The whole list can be specified in **Resistance** section.

> The same mechanism is at parameter of type **World**! Except initiator's protection.

Our second parameter is the **reason**, why we want to kick the player.\
Here is the best opportunnity to use type **PAYLOAD**. It allows us to read the whole sentence until the end of input line.

> Type **PAYLOAD** has to be the last parameter of the sequence!

If you want to make this parameter optional, no problem, set flag Optionality to true.

> Then, you need to define **default value**, which will be used instead of missing parameter.

> Missing variable **Optionality** in the configuration file means that parameter is **Required**!

At the end we need to specify command, which will be executed after successful round.

Also, we need to map our values from parameters to command. It's simple, each parameter has name as mentoined above.

We create replacement. It starts with prefix **p\_**. After that prefix we will write **name** of the parameter.

> If we had name of the parameter **player** our final replacement is **p\_player**.\
> The same for the second parameter.

**Our final command**

`kick {p_player} {p_reason}`

**Our created VU for kicking the player**

```yaml
KICK:
  Name: Kick
  Type: GLOBAL
  Category: CUSTOM
  ImmediateInitiatorVote:
    Active: true
  Price:
    Start: 0
    Vote: 0
  Restriction:
    World: [ ]
  Parameter:
    Target:
      Name: player
      Type: PLAYER
      Resistance:
        Initiator:
          Active: true
        Collection:
          - "player_name"
    Reson:
      Name: reason
      Type: PAYLOAD
      Optionality: true
      DefaultValue: "Unknown"
  Result:
    Command:
      Global:
        - "kick {p_player} {p_reason}"
```

Copy

> Do not forget to create new records into localization file!

**Sections in localization file**

* Success
* BossBar

***

I am full of expectation which VotingUnits you will create. We can create library of these units, and other owners can use it on their server
