Description

1.6 has dramatically increased the difficulty of Minecraft's mobs, especially at night. Swarms of zombies can appear without warning, overwhelming even skilled players who haven't dug themselves in before the sun sets. On larger servers, night is almost unavoidable because it is so difficult to get everyone either in a bed or in a different realm.
This mod allows players to propose a vote to set the server time to 'day' and thus skip the night. This is much easier than wrangling a dozen players into beds, and you don't have to worry about that one AFK guy keeping everyone up. It is quite simple, easy to use and install, highly configurable, and will not bog down your server.
There has to be a majority voting for day (/sleepvote yes) in order for the time to be changed. If people are AFK the fact that they don't vote won't affect the result, because only active 'no' (/sleepvote no) votes affect the tally.
To everyone updating to a new version, be sure to delete your old config.yml files!
Change Log
| Version | Changes |
|---|---|
| 1.0 | Original version, basic vote proposal and not much else. |
| 1.1 | Added configurable settings. |
| 1.2 | Improved error messaging, added the dowry feature. |
| 1.2.5 | Added the ability to display the 'score' and VIP permissions. |
| 1.2.8 | Modified the display slightly. |
| 1.3 | Updated to work with new versions of MC/Bukkit/Spigot. |
| 1.3.1 | Added the "night is coming" and "times per night" features. |
Commands
| Command | Function |
|---|---|
| /sleepvote | Gives a list of commands. |
| /sleepvote new | Starts a new vote to set the time to day. |
| /sleepvote yes | Votes for setting the time to day. |
| /sleepvote no | Votes against setting the time to day. |
Permissions
| Permission | Affect |
|---|---|
| sleepvote.vote | Allows the user to vote when a vote is in progress. |
| sleepvote.propose | Allows the user to propose a new vote. |
| sleepvote.* | Allows proposing and voting. Does not include the sleepvote.vip permission! |
| sleepvote.vip | Increases the relative weight of the player's vote by a configurable amount, so for example one VIP vote might equal two regular votes. |
Configuration
This plugin, when first ran, will create a config file in your plugins folder within a folder called SleepVote. This config file allows a great deal of customization/optimization for server operators. Please reload the plugin after you make a change to this config file.
| Variable | Affect | Syntax | Default |
|---|---|---|---|
| restrict (vote, propose) | Turns on/off restriction of voting/proposing votes. When 'true' users require permissions to perform either. Restrictions on voting and proposing can be done separately to restrict one but not the other. | true/false | true |
| cooldowninseconds | The amount of time after a failed vote during which votes cannot be proposed. | seconds | 60 |
| timespernight | The number of times each night a vote can be proposed. Independent of cooldown. | integer | 10 |
| votedurationinseconds | The amount of time users have to vote before the result is calculated. | seconds | 60 |
| autovoteonpropose | When set to 'true' whoever proposes the vote automatically votes in favor of the time change. | true/false | true |
| marginofvictory | The vote must pass by this margin in order to be successful and change the time. | integer | 1 |
| requiredowry | When set to true, players will have to pay a 'dowry' to 'propose' a vote. The item earmarked for payment must be in their inventory and will be taken from them once the vote is proposed. | true/false | false |
| dowrymaterial | This is the item the player proposing the vote must have. Coal, iron ingots, gold ingots, and diamond are all possible currencies. | coal/iron/gold/diamond | gold |
| dowryquantity | This is the quantity of the item the player proposing the vote must have. | integer | 1 |
| display | When set to '1', whenever someone votes the entire server will be updated on the score of the vote. When '2', whenever someone votes their name and vote is broadcast. When '3', both occur. When '0', none of these events occur and the vote is private. | 0/1/2/3 | 0 |
| vipvotebonus | This is the value of a VIP vote. 0 means it is worth nothing, 1 is a normal vote, 2 is worth two normal votes, etc. | integer | 2 |
| nightiscoming | When set to 'true' the server will propose its own vote automatically as soon as the sun starts setting. | boolean | false |
Installation
Start by dragging SleepVote.jar into your plugins folder and reloading/restarting your server. A config file will be generated in the plugins/SleepVote folder. Next, open said config file and make any changes you wish to. Reload the plugin after changing said file. See the above Configuration table for details, syntax etc. Lastly, set up your permissions. I recommend giving everyone the sleepvote.* permission, but you can restrict the permissions if you wish. Again, see the above tables for details on this.
FAQ and Troubleshooting
Q. How does a vote work? First, a player proposes a vote. Second, the other players (and the guy who proposed the vote, unless autovoteonpropose is set to true) vote yes/no. After votedurationinseconds seconds, if 'yes' has a majority greater than or equal to marginofvictory the time is set to day - otherwise, the night continues.
Q. How does this affect normal beds? Players can still sleep normally - beds are not affected. Any players asleep when the time changes will stay in bed until they click the "leave bed" button.
Q. What about AFK players? Won't they mess it up? Anyone who does not vote will not affect the vote outcome. If only 1 guy votes yes, but nobody votes no, it will pass.
Q. What about all the mobs roaming around? Will they despawn? Mobs will not despawn and as such it is recommended you begin the vote as early in the evening as possible. Votes can be proposed as soon as it is night. Skeletons and zombies will burn and spiders will become docile, but creepers (and hat-wearing mobs) still present a hazard.
Q. This won't work on my server! I get a nullpointer exception! Your world name includes _the_end or _nether, in which case _nether or _the_end will be removed and the world will be incorrectly identified, and you should rename your world. You might also get this issue with a multiworld plugin due to the different world names. Please report your map name in the comments to help me debug for the next version.
To Do
WeatherVote, to set the weather to sunny; NightVote, to set the time to night for creeper hunting, torch placement etc; upload a new demo video of the plugin; any other suggestions you guys make in the comments!
Credits
Special thanks to Darq for helping me with my first plugin and schedulers, Motherurck for giving me the idea, Otter for suggesting players pay to propose a vote, thebighud and PK for helping test and debug the script, and the GTAF server (especially the 4Rs - Rown, Rdny, Rhyn and Ryan) for being awesome and helping me out. Credit for the header goes to ElMafias from GTAF, thanks again man! Thanks to Mariskaaa for suggesting the score be visible, PsychoNavigator for suggesting I update it, and DrkMatr1984 for suggesting the automatic vote by the server.
Other Plugins You Might Find Useful
MC Eunuch - disables a variety of grief-y functions for user groups, including damage of livestock and players, interaction with chests and horse inventories, block breaking, item pickup, and farmland trampling.


