Sleep Vote - Vote to skip the night by sleeping in a bed!

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


Sleep Vote

This plugin allows players to make a vote to skip the night. This is done simply by sleeping in a bed.

Features

  • World-independent votes. A vote to change the time in one world will not affect another
  • Choose between having a fixed number of players sleeping, or a percentage of players sleeping. Also supports dynamic requirements, in which the plugin will choose the lower of the two values. (Say there are 50 players. You choose a percentage of 0.5 and a fixed value of 10. The plugin will choose 10 since 10 is lower than 25)
  • Customizable wakeup, enter bed, and exit bed messages. Supports the use of Minecraft formatting codes. Also has sounds that play when these messages are displayed, which can be muted per-user via the command ā€˜/sleepvote muteā€™, or globally for all users by modifying the configuration property ā€œsoundsā€
  • Got administrators? They can be hidden from votes and sleep requirements by using the command ā€˜/sleepvote hideā€™ which persists until the server restarts or the plugin is reloaded. Got dedicated administrators? Perhaps giving them the permission ā€˜sleepvote.hiddenā€™ and enabling ā€œhide_adminsā€ in the config would be for you, since that will keep admins hidden after server restarts and plugin reloads as well.
  • Vanished players are excluded from sleep votes regardless of the value of ā€œhide_adminsā€
  • Players with certain gamemodes may not want to be counted in votes to skip the night. This can be set in the configuration file. By default, only spectator is ignored
  • Optional Nucleus integration for allowing AFK players to be ignored during votes

Commands

# Allows the user to reload the plugin
# Corresponding permission: sleepvote.command.reload
/sleepvote reload
/sv r

# Allows the user to hide themself from SleepVote
# Corresponding permission: sleepvote.command.hide
/sleepvote hide
/sv h

# Allows the user to mute the sounds played to them by SleepVote
# Corresponding permission: sleepvote.command.mute
/sleepvote mute
/sv m

# Tells the user about their current status regarding visiblity (visible/hidden) and sounds (on/off)
# Corresponding permission: sleepvote.command.status
/sleepvote status
/sv s

Permissions

# Gives permissions to everything in the plugin. Recommended for admins only
sleepvote

# Gives permission to execute all commands. Recommended for admins only
sleepvote.command

# Gives permission to execute the 'hide' command. Recommended for admins only
sleepvote.command.hide

# Gives permission to execute the 'mute' command. Recommended for all users
sleepvote.command.mute

# Gives permission to execute the 'status' command. Recommended for all users
sleepvote.command.status

# Users with this permission are ignored by the plugin when counting and calculating sleeping players. Recommended for admins only
# Must be enabled in the configuration file under the property "ignore_admins"
sleepvote.hidden

# A typical permission setup for default users:
# [+] sleepvote.command.mute
# [+] sleepvote.command.status

# A typical permission setup for admins:
# [+] sleepvote.command

# A typical permission setup for dedicated admins:
# [+] sleepvote

Screenshots



Configuration file

#### Counting Required Players ####
# You are given two options: percent and number
# If both are specified, the plugin will choose the lower of the two requirements

# Below are some presets. '%' is the value for "required_percent_sleeping" and '#' is the value for "required_number_sleeping"

# Preset: Percent Only (Default)
# '%' = <any percent>
# '#' = 0

# Preset: Number Only
# '%' = 1.0
# '#' = <any number>

# Preset: Dynamic
# The plugin will choose the smaller of the two requirements. (e.g. Say the population is 50 and '%' = 0.5 and '#' = 10. The plugin will choose 10 as a requirement rather than 25 (which is 50 * 0.5))
# '%' = <any percent>
# '#' = <any number>

# Now here's the fun part. You decide how you want it!

# Percentage of players (in a world) required to be sleeping in order to advance through the night
# Must be a value in the inclusive range of [0.0,1.0]. If set to zero, it will only require one player
"required_percent_sleeping" = 0.5

# Number of players (in a world) required to be sleeping in order to advance through the night
# If there are less players than what is specified, then it will use the percentage instead
# Set to a value less than or equal to (<=) 0 to disable. It is disabled by default
"required_number_sleeping" = 0

#### Messages ####

# <player> is the name of the player who just went in/out of bed
# <sleeping> is the number of sleeping players in the world
# <required> is the number of players in the world required to be sleeping in order to advance through the night
# <percent> is simply the percentage of players sleeping out of the number of players required to sleep. Calculated internally as '(sleeping / required) * 100'

# Formatting codes may be used in messages using '\u00A7' (e.g. "\u00A7cHello!" is will print "Hello!" in red text)
# A full reference for formatting codes can be found at http://minecraft.gamepedia.com/Formatting_codes/

"messages" {
    "wakeup" = "\u00A7eWakey wakey, rise and shine!"
    "enter_bed" = "\u00A7e<player> wants to sleep! \u00A76<sleeping>/<required> (<percent>%)"
    "exit_bed" = "\u00A7e<player> has left their bed. \u00A76<sleeping>/<required> (<percent>%)"
}

# Enable or disable the "[SleepVote]" chat prefix on the wakeup, enter_bed, and exit_bed messages (e.g. "[SleepVote] Wakey wakey, rise and shine!" when true, and "Wakey wakey, rise and shine!" when false)
"sleepvote_prefix" = true

# Toggle on/off the logging of the wakeup, enter_bed, and exit_bed messages messages in the server console, prefixed by the world name
"enable_logging" = true

# Toggle on/off the sounds that play on the wakeup, enter_bed, and exit_bed messages
# Note that there is a command that allows players to mute the sounds for themselves: '/sleepvote mute' with the corresponding permission of 'sleepvote.command.mute'
"sound" = true

#### Counted Game Modes ####
# Determine which game modes are ignored when counting up players
# A value of 'true' means that players with that game mode will be ignored
"ignored_gamemodes" {
    "survival" = false
    "creative" = false
    "adventure" = false
    "spectator" = true
}

#### Administration ####
# If set to true, players with the permission 'sleepvote.hidden' will be ignored, regardless of their status when using the '/sleepvote hide' command. This includes ops
# Set to false by default since some people have been confused, claiming that the plugin "didn't work" when they slept simply because they were trying it out while in op
# The advantage of this is that it persists across server restarts whereas '/sleepvote hide' does not.
"ignore_admins" = false

#### Nucleus Integration ####
# The following options require Nucleus in order to work

# Recommended: remove the permission 'nucleus.afk.base' (access to the '/afk' command) from players so that this feature is not abused
"ignore_afk_players" = false
2 Likes

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

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


Should be refined enough for regular use, but just to make sure, this will be marked as ā€œBetaā€
Report bugs in the issue tracker.

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


Changelog

  • Fixed a bug where a player could trigger a sleep vote despite not being in range of a bed
  • Fixed a bug where the vanilla sleeping mechanic overrides the pluginā€™s, preventing the displaying of the wakeup message and instead kicks everyone out of bed
  • Moved configuration file to /config/sleepvote/sleepvote.conf
  • Added more configurable messages
  • Optional chat prefix ā€œ[SleepVote]ā€ for SleepVote messages
  • Option to log all voting status messages to the console (e.g. ā€œ[world] Player has went to bed! 1/100 (1%)ā€)
  • Added 4 second delay to the initiation of the playerā€™s vote after they right-click a bed (to give the animation a bit of time)
  • Added a reload command (ā€™/sleepvote reloadā€™)to reload the pluginā€™s configuration without needing to restart the server. Also works with ā€˜/sponge reloadā€™

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


Hotfix update:

  • Fixed an issue where the worldā€™s rain/thunder was not cleared when a sleep vote was successful.

Nice update !

Could you make the commands obsolet ? Like when a player goes to bed, a message is sent ā€œWould you like you SleepVote ? [Yes] [No]ā€. In fact same as before but with clickable text as well as commands :slight_smile:

Thatā€™s a neat idea, but it may also be annoying for some players.
Usually players expect to just sleep and have the vote counted, rather than having to press an additional button along with it.

Well, forget about this, it was a silly suggestion for this case.

Maybeā€¦ Could you add a sound when people want to sleep ?

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


Minor bugfix update:

  • Fixed an issue in which the number of players required to sleep was not always consistent

Sure, but Iā€™ll make sure itā€™s togglable in the settings (both server and client) since it may get annoying.

1 Like

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


(Note, this is a re-upload since some people have reported being unable to download this version from Ore)

Edit2: nevermind, still broken. Will fix soon. For now, download from the GitHub releases page

A new version has been released! v0.5.0

  • Added sounds that play on the wakeup, enter and exit bed messages
  • Added two new commands: ā€˜sleepvote hideā€™ and ā€˜sleepvote muteā€™
  • The ā€˜sleepvote hideā€™ command toggles whether a player is hidden from the plugin. The same effect can be accomplished by giving/taking away the permission ā€˜sleepvote.hiddenā€™
  • The ā€˜sleepvote muteā€™ command toggles whether a player will hear sounds played by the plugin. The same effect can be accomplished by giving/taking away the permission ā€˜sleepvote.muteā€™
  • Added a configuration option to completely disable/enable sounds
  • Added configuration options to ignore players with certain game modes
  • Added Nucleus integration for the ability to ignore AFK players

Built for Sponge API 5.1.0 and Minecraft 1.10.2. It is forward compatible with Sponge 6.0.0 and Minecraft 1.11.2.

Still working to get the Ore downloads fixed. For now, download from the GitHub releases page

1 Like

Me and my players really like your plugin, so convenient :smiley:

Is there a way to turn off the percentage of people required to sleep? We want it so if 1 player sleeps in the bed no matter how many players are online it will go to day time. I tried changing the percentage from 0.5 to 0 but that didnā€™t seem to helpā€¦ Is this a feature that can be added?

What about 5-10 ? Unless you have a lot of people connected of course.

Thus, in ā€œSleepVoteā€ there is ā€œVoteā€ which involves that people can chose. Having just one player in bed and switching to daytime would be ā€œSleepDictatorā€ :joy:

Yes I understand the humor behind what your saying and the logical implication.

It seems like it would not be hard to implement a no requirement to sleep, as the value can ben changed from 50% to other percentages ā€œor so it says, I have not messed with it muchā€. Cannot find another mod that does this on the ore, and all other forge mods seem to be similar to this one where you need % of players to sleep. For now Im using a command block system similar to Hermitcraft to do what I want but id rather use a mod if possible.

Percentage of players (in a world) required to be sleeping in order to advance through the night.

ā€œrequired_percent_sleepingā€ = 0.5

can the dev make it so If that is changed from 0.5 to 0 then 0 players are required and one person can sleep to set the night? We typically are out exploring, mining, building etcā€¦and far away from beds. We all are on Discord and ask if anyone is near a bed and usualy 1 person is at base and can hop in the bed to skip the night. If not we tough it out. Its very rare to have 50% of the server near a bed.

2 Likes

Thatā€™s a great idea! Iā€™ll add this in the next update, and refine the idea to make it more customizable.

Excellent!! =)

Thnx again for your hard work developing this plugin =)

A new version has been released! v0.5.1

  • Allows the use of 0.0 percent for the variable ā€œrequired_percent_sleepingā€, in which case it will use a minimum requirement of 1 player sleeping

Built for Sponge API 5.1.0 and Minecraft 1.10.2
Forward compatible with Sponge API 6.0.0 and Minecraft 1.11.2

Still working to get the Ore downloads fixed. For now, download from the GitHub releases page

1 Like

Your suggestion for allowing a percentage of 0.0 to have 1 player sleep to skip the night has been implemented in the latest version (0.5.1).

The next update (0.6.0) will build on this and incorporate @Keuterioā€™s idea for allowing other specified amounts (e.g. 5, 10, or any integer value). It will be available as a new configuration option, and the plugin will pick the smaller of the two requirements.

1 Like