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


#1

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

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


#3

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.


#4

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'


#5

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.


#6

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:


#7

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.


#8

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

Maybe... Could you add a sound when people want to sleep ?


#9

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


#10

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


#11

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


#12

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


#13

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


#14

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?


#15

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:


#16

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.


#17

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


#18

Excellent!! =)

Thnx again for your hard work developing this plugin =)


#19

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


#20

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.