Voting Unit
Looking into VotingUnits.yml
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
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 separatelySuccess
- Commands performed when round successAll
- 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 failsAll
- 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
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!
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
When round with weather category success, these values are applied:
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
Do not forget to create new records into localization 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
Do not forget to create new records into localization file!
Last updated