Consensus - Allows players to vote for things to happen

This is a discussion topic for the Ore project, Consensus. View the full project on Ore for downloads and more information.


Consensus

Consensus is a plugin that allows players to vote on various things. Players can start a vote with /poll <mode> <args>. A message will pop up in chat saying that this player has started the poll. If a player clicks the vote button, they will vote ‘Yes’ on the poll. Once the poll has passed, its effects will occur. You can also set a poll to automatically start to change the time to day if it becomes nighttime, or to clear the weather if it starts to rain.

Note on the arguments

Wherever a duration is requested, the format is [nD][nH][nM][nS]. So two days, one hour, and four seconds would be represented 2D1H4S.
This is applicable both in commands and in the config.

Poll types

mute <player> [duration] <reason>: Votes to mute the player for the specified amount of time for the specified reason.
If no duration is specified, the configured maximum duration is used.

kick <player> <reason>: Votes to kick the player for the specified reason.

ban <player> [duration] <reason>: Votes to kick and ban the player for the amount of time for the specified reason.
If no duration is specified, the configured maximum duration is used.

time <time> [world]: Votes to set the time of day in the specified world.
If no world is specified, the poll creator’s world is used.

weather <weather> [world: Votes to set the weather in the specified world.
If no world is specified, the poll creator’s world is used.

command <command>: Votes to run the specified command from the console’s perspective.
Note that any command must be whitelisted before it can be run.

dummy <text> [majority] [duration]: Makes an empty vote; i.e. one that occurs and executes but doesn’t actually do anything.
Useful for personal polls, admin surveys, etc.

As the only command absent from configuration, its majority and duration are specified in the command;
if either is not present, they default to 0.5 and 1M respectively. See the configuration section for details.

To include spaces in text, surround it in double quotes (e.g. /poll dummy "add a new map").

Configuration

Every single configuration option is optional. If you leave them out, a sane default will be used.

All mode settings blocks have four common fields: enabled, whether or not this mode is enabled; majority, the fraction of players needed to pass the vote; min-players, the number of players required to be online for a vote of this type to start; and duration, how long a vote of this type lasts before resolving.

ban{}: The ban mode has an extra setting, max-duration, which is the maximum duration that someone can be banned for.

kick{}: No extra settings.

mute{}: The mute mode has an extra setting, max-duration. See ban{} for details.

time{}: No extra settings.

weather{}: No extra settings.

command{}: The command mode has one extra setting, allowed-commands[]. This is a list of commands that are allowed to be used. It supports subcommands, such as warp set.

triggers{}: This section contains sections for automatic triggers, time{} and weather{}. Within each, there are three fields: enabled, whether or not this automatic trigger is enabled; worlds[], a list of world names; and type, whether worlds[] is a whitelist or blacklist.

Permissions

consensus.exempt.ban: A player with this permission cannot be votebanned.
consensus.exempt.kick: A player with this permission cannot be votekicked.
consensus.exempt.mute: A player with this permission cannot be votemuted.
consensus.override.ban: A player with this permission can vote to ban players with consensus.exempt.ban or for longer than max-duration.
consensus.override.kick: A player with this permission can vote to kick players with consensus.exempt.kick.
consensus.override.mute: A player with this permission can vote to mute players with consensus.exempt.mute or for longer than max-duration.
consensus.override.command: A player with this permission can vote to run a command that is not whitelisted in allowed-commands[].

Suggestions

The modules I’ve included are from a few forum threads asking for a way to have players vote on things - I’d love to add as many more as possible. If you have an idea for a useful module, suggest it!

Changelog

1.0.0: By majority vote, these details won’t be released.

1.1.0: Added the command mode.

1.1.1: Fixed the bug where everything broke.

1.1.2: Fixed minimum player settings.

1.2.0: Added weather and automatic triggers.

Note

This plugin uses bStats, which collects data about your server. This data is in no way intrusive, is completely anonymized, and has a negligible impact on server performance, so there is no reason whatsoever to disable it. However, if you wish to anyway, simply set enabled to false in config/bStats/config.conf.

2 Likes

One addition that I think would be great for this is to be able to create your own poll types with a user specified command.

@pie_flavor Would it be possible to pre-define some of the polls inside a config? For one instance, I’d like temporary bans with a preset 15 minutes as the tempban, and I could easily put that into a command option.

I’m not fully sure I understand what you’re asking. If it’s for pre-set times for tempbans, that’s already in - just set the max-duration attribute.

A new version has been released for Consensus, it is available for download here.


Added the command mode.

1 Like

You cooked this up fast, thanks for this :slight_smile:

2 Likes

A new version has been released for Consensus, it is available for download here.


Due to a build file mistake, the project did not have the argument parser for durations. It does now.

@pie_flavor Sorry I’m 9 days late, been busy. Thanks for this!

Anyone using this plugin: There is an error in the code which screws up the minimum online players checking. I have released a fixed version, but it is only available on GitHub right now because I do not have access to a computer which can PGP sign.

A new version has been released for Consensus, it is available for download here.


Fix minimum player settings.

Hi, @pie_flavor. I like what your plugin tries to do, but could you document your it a bit more thoroughly, like mentioning that you need 10 players minimum to have a vote, including a list of permission nodes and their usage?

etc.

Perhaps read the documentation.

Am I able to setup custom polls for this? I would love it if a poll is automatically asked when something is triggered. An example would be when it starts to rain, a poll will pop up asking if the majority wants to toggle downfall.

1 Like

No, not yet. I’ll add some stuff for that in the next release.

3 Likes

Could you add an option to start pre-defined poll on some event?
Example: Rain has started on world “world” and it has started a poll “Vote for clear weather on world world

In fact I answered that in the post directly above yours.

1 Like

A new version has been released for Consensus, it is available for download here.


  • Updated to API 7.
  • Added weather as a /poll subcommand.
  • Changed the config structure to behave more sanely.
    • Removed enabled-modes; each module now has its own enabled section
    • Removed permission configuration; permissions are now static
    • The duration parser is now more lenient
  • Added automatic triggers. Now you can configure the plugin to automatically start a poll to switch to day when it becomes night, or to clear the weather when it starts to rain.

the weather command still seems really broken. typing /poll weather clear returns an error, same with /poll weather rain, etc.

also time can’t be set using shortcuts like /poll time day you have to put in 1000. kinda goofy that you can’t use those common terms.

A new version has been released for Consensus, it is available for download here.


Updated bStats to be compatible with Ore metrics guidelines.