SmoothSleep icon

SmoothSleep -----

Smoother, multiplayer friendly sleeping.



[​IMG]

Have a problem with night skipping instantly?
This isn't a bug with SmoothSleep; it's an Essentials feature. To fix, negate the essentials.sleepingignored permission and have players who previously had this permission log out and back in to allow Essentials to cache the permission.

As of v2.6.0, optional support for PlaceholderAPI has been implemented.

As of v2.9.3, the plugin can ignore vanish and AFK users using CMI

As of v2.10.0, you may use hex color codes in configurable messages in the format: &# AABBCC or &# ABC

[​IMG]

SmoothSleep is designed to gradually progress the night at a speed depending on how many players are sleeping. The time it takes for night to pass is configurable per world. If a player is set to ignore sleep, they can still progress time by sleeping, but won't be considered if they're awake.

Configurable titles, action bar text, and title text can be shown to players to let everyone know that players are sleeping and keep track of time as well as supporting some placeholders.

Players can optionally be healed, fed (or hurt/starved), and have potion effects removed overnight, depending on how long the player sleeps.

Here is a very short demo of what it does!



Players are greeted in the morning, kicking the lazy bums out of bed bright and early. Come morning (if reached via sleeping), the weather will also clear up (configurable as well), like vanilla sleeping will do.

SmoothSleep transmits stats to bStats.org if you don't opt out. Here's the stats page: https://bstats.org/plugin/bukkit/SmoothSleep

[​IMG]

smoothsleep.reload
Allows you to reload the config with /ssreload

smoothsleep.toggle
Allows you to temporarily disable and re-enable SmoothSleep with /sstoggle

smoothsleep.configure
Allows you to manage the config via the /ssconf command

smoothsleep.addworld
Allows you to add world configuration sections to the config via the /ssaddworld command

smoothsleep.ignore
Allows you to bypass needing to sleep. Players with this permission can sleep to pass time, but won't be counted as awake otherwise. This works just like being set to sleep ignored with the Bukkit API, but doesn't actually set the player as sleep ignored.

smoothsleep.metrics
Allows you to toggle SmoothSleep metrics with /ssmetrics

smoothsleep.notify
Receive a notice when you login if there's an update available for the plugin

smoothsleep.ignoreheal
Users with this permission will not be healed over night

smoothsleep.ignorefeed
Users with this permission will not be fed over night

smoothsleep.sleepreward
Users with this permission will receive the configured sleep rewards if they've slept until morning and for at least the number of hours required. This permission is granted by default.

[​IMG]

/ssreload
Reloads the config

/sstoggle
Temporarily disables or re-enables the plugin. If the server is restarted or reloaded, then the plugin will re-enable. This can be useful if you want to remove the plugin, but not immediately restart, or if you need to disable it for an event or minigame, etc.

/ssconf
Sets config options via command. Use the command with no arguments to list which options can be modified and how to use the command.

/ssaddworld
Allows you to add a new world to the config with default settings so that it can be more easily modified.

/ssmetrics
Allows you to toggle metrics. Using this will disable metrics and also toggles the config value for you.

[​IMG]

Code (Text):
# More info: https://www.spigotmc.org/resources/smoothsleep.32043
enable-stats: true
enable-update-check: true
update-notify-login: false
logging-settings:
  log-debug: false
  log-warning: true
  log-info: true
worlds:
  world:
    min-night-speed-mult: 10
    max-night-speed-mult: 20
    all-sleeping-speed-mult: 20
    night-speed-curve: 0.5
    accelerate-random-tick: true
    max-random-tick: 1000
    accelerate-weather: true
    clear-weather-when-morning: true
    heal-slept-villagers: true
    morning-sound: 'ENTITY_PLAYER_LEVELUP'
    morning-particle-options:
      particle: 'VILLAGER_HAPPY'
      amount: 20
      radius: 0.5
      enabled: true
      delay-ticks: 5
      pattern: 'RANDOM'
    instant-day-if-all-sleeping: false
    essentials-settings:
      ignore-afk: true
      ignore-vanish: true
    replenish-settings:
      heal-negative-statuses: true
      hours-to-heal-negative: 3
      heal-positive-statuses: false
      hours-to-heal-positive: 3
      ticks-per-heal: 1000
      heal-amount: 0
      heal-awake: false
      ticks-per-feed: 1000
      feed-amount: 0
      feed-awake: false
    sleep-rewards:
      potion-effects:
        enabled: true
        required-hours-sleep: 3
        show-effect-particles: false
        effects:
          LUCK:
            duration: 3600
            amplifier: 0
    titles:
      enabled: true
      sleep-title: '&b{12H}:{MIN} {MER_UPPER}'
      sleep-subtitle: '&a{SLEEPERS}/{TOTAL} Sleeping &3({TIMESCALE}x speed)'
      morning-title: '&e{12H}:{MIN} {MER_UPPER}'
      morning-subtitle: '&aRise and shine, {USERNAME}!'
      stay-ticks: 20
      fade-ticks: 40
    action-bar:
      enabled: true
      show-if-awake: false
      title: '&4Health: &c{HEALTH_BAR} &3Food: &b{FOOD_BAR}'
    boss-bar:
      enabled: true
      show-if-awake: true
      color: 'BLUE'
      style: 'SOLID'
      title: '&a{SLEEPERS}/{TOTAL} Sleeping &3- &b{12H}:{MIN} {MER_UPPER}'

To change the world where SmoothSleep is used, just change 'world' to the name of the world you want to use, or make a copy of the 'world' section with a new name. If you'd like to add a new world to the config, use /ssaddworld <word>


Global Settings


enable-stats
You can disable metrics by setting this to false or by using /ssmetrics in game to toggle it. If enabled, some data is sent to bStats.org.

enable-update-check
This will allow the plugin to request the latest plugin version from Spigot's website. Set this to false to completely bypass the update check.

update-notify-login
If this is enabled, staff can be notified when an update is available for the plugin when they login.

Logging options
These are self-explanatory, choose which logging levels to show in the console. I’d recommend against having debug enabled unless you’re trying to find an issue as it can be somewhat overkill.


Per-World Settings


min-night-speed-mult
The lowest possible night speed multiplier (if the tiniest fraction of players are sleeping). Keep in mind that SmoothSleep won't affect the speed if no one is sleeping, this only applies if at least one person is asleep. Must be a whole number greater than 0.


max-night-speed-mult
The highest possible night speed multiplier (if everyone is sleeping). Must be a whole number greater than 0.


all-sleeping-speed-mult
This speed multiplier will only kick in when all players that aren't sleep-ignored are sleeping. If set to the same value as max-night-speed-mult will effectively disable this feature. If instant-day-if-all-sleeping is enabled, this setting will be ignored.


night-speed-curve
This value allows you to tweak how the ratio of players sleeping affects the speed of night. With values less than 0.5, fewer sleepers will affect the speed less, then as more players sleep, it ramps up more quickly. With values more than 0.5, it's the opposite. At exactly 0.5, it's a linear increase. If you set the value to 0, then night speed will be the min speed until everyone is asleep, then it'll be max speed. If it's 1, then it'll be max speed if anyone sleeps. Only values between 0-1 are accepted. To get a better visualization of how this value works, check out this graph on Desmos: https://www.desmos.com/calculator/nwmstzhjgv

In this graph, the X-axis represents the percent of players sleeping, and the Y-axis represents how fast night should pass (between the min and max night speeds)

accelerate-random-tick
This option allows SmoothSleep to modify the randomTickSpeed gamerule during the night. This will speed up anything that's effected by random ticks, which includes: crop growth, leaf decay, grass/vine spread, etc.

max-random-tick
This allows you to cap how fast the randomTickSpeed is able to be set. Having a value that's ridiculously high can cause lag, so if you already have a high randomTickSpeed set and don't want to go too high, you can use this.

accelerate-weather
This should make weather go by quicker similar to how night works. Since it's difficult to properly test this, I can't even say it works, but the option is here.

morning-sound
If this is a valid sound, then it will play for a player when they wake up. To disable, leave this blank.

For a list of valid sounds, refer to the Sound enum - Bukkit API

clear-weather-when-morning
If true, then rain and storms are stopped when it reaches morning if any players are still in bed at that time.

heal-slept-villagers
This will allow SmoothSleep to fully heal villagers that are sleeping when it reaches morning time. This is just in case the plugin somehow prevents the vanilla healing mechanic.

instant-day-if-all-sleeping
Self-explanatory. If all non-sleep-ignored players are sleeping, then this will set the time instantly to day while still showing the morning title/subtitle. This is far more instant than vanilla. As soon as the last (or only) person clicks the bed, it will set time to day, unlike how vanilla will wait for you to sit in bed for a few seconds.


titles


enabled
If true, then a title will display the in-game time, the number of players sleeping / total non-sleep-ignored players, and the current night speed multiplier.


morning-title
The title shown upon waking up if 'use-titles' is enabled.


morning-subtitle
The message shown under the title upon waking up if 'use-titles' is enabled.


sleep-title
The title shown while sleeping if 'use-titles' is enabled.


sleep-subtitle
The message shown under the title while sleeping if 'use-titles' is enabled.


Action-bar

[​IMG]


enabled
If true, then a message will appear above the hot bar with the specified title when players are sleeping. By default, this is used to show sleepers their health/food level while sleeping since the ‘leave bed’ button blocks the normal UI elements in some cases.


show-if-awake
Whether or not to show the action bar to players if they’re not sleeping.


title
What text to show in the action bar while players are sleeping (supports placeholders)


Boss-bar

[​IMG]


enabled
If true, then a boss bar with a title will be displayed at the top of the screen when players are sleeping.


show-if-awake
Whether or not to show the boss bar to players if they’re not sleeping.


title
What text to show in the boss bar while players are sleeping (supports placeholders)


color
What color to make the boss bar. Valid colors are PINK, BLUE, RED, GREEN, YELLOW, PURPLE


style
Determines the bar style. Valid styles are SOLID, SEGMENTED_6, SEGMENTED_10, SEGMENTED_12, SEGMENTED_20


morning-particle-options


enabled
Whether or not to spawn particles in the morning


particle
This is the name of the particle you wish to use. Note that particles which require extra data cannot currently be used. If the particle you have chosen requires extra data, you will get some warnings in the console.

REDSTONE, BLOCK_CRACK, BLOCK_DUST, FALLING_DUST, ITEM_CRACK, LEGACY_BLOCK_CRACK, LEGACY_BLOCK_DUST, LEGACY_FALLING_DUST, SPELL_MOB, SPELL_MOB_AMBIENT

For a complete list of valid particles, refer to the Particle enum - Bukkit API


amount
This will both change how many particles are shown, and how long the particles are shown. This and the ‘delay-ticks’ setting control how long a particle effect lasts for.


radius
This controls how far away from the player you'd like the particles to spawn. The maximum radius is currently 20, simply because larger values don't seem to make much sense.


pattern
What shape to spawn the particles in. This can be ‘random’, ‘circle’ or ‘spiral’.


delay-ticks
How long in ticks to wait after spawning a set of particles before spawning another. Increase this value if you want to space out how often particles are spawned. This increases how long the effect lasts for.


replenish-settings


heal-negative-statuses
If true, heals negative status effects if the player has slept the required hours.


hours-to-heal-negative
The hours of sleep required to heal negative statuses.


heal-positive-statuses
If true, heals positive status effects if the player has slept the required hours.


hours-to-heal-positive
The hours of sleep required to heal positive statuses.


ticks-per-health
Ticks to sleep (including timescaled ticks) to heal the amount specified. 1000 = 1 in-game hour. A full night lasts just under 10 hours. If you set this to 1000, it'll heal the player 9 times by morning regardless of night speed.


heal-amount
The amount healed per interval specified. Can be negative. 1 = half a heart.


heal-awake
Whether the heal effect should be applied to players who aren’t sleeping, but in a world where time is being accelerated.


ticks-per-feed
Ticks to sleep (including timescaled ticks) to feed the amount specified. Similar to ticks-per-health.


feed-amount
Ticks to sleep (including timescaled ticks) to feed the amount specified.


feed-awake
Whether the feed effect should be applied to players who aren’t sleeping, but in a world where time is being accelerated.


sleep-rewards.potion-effects
enabled
Whether to enable potion effect sleep rewards

required-sleep-hours
How many in-game hours a player needs to sleep to be rewarded

show-effect-particles
Whether to show potion effect particles. If shown, particles will be 'ambient'.

effects
The list of effects to applied. Each entry under this should be a valid effect name, and have a duration and amplifier value under it. Amplifier starts at 0 for a base level effect. If an effect name is invalid, a message will print to console while initializing.


essentials-settings
These settings only apply if Essentials is installed​


ignore-afk
If true, AFK players will be considered sleep-ignored.


ignore-vanish
If true, vanished players will be considered sleep-ignored.


---



As is the case with YAML files in general, spacing is important! Don't use tabs or it'll break! Additionally, with text values, if various special characters start the text, it may need to be wrapped with quotes! It's generally safe to always wrap text values with 'single quotes' as the YAML engine will remove them if not necessary when it's re-saved.


[​IMG]

As of v2.6.0, textual values in the config should now also support PlaceholderAPI. You can mix and match both the built-in placeholders and PAPI placeholders. Built-in placeholders are parsed first, so you can even use them inside PAPI placeholders (for example, progress bars).

{12H}

The 12-hour portion of the server time

{24H}
The 24-hour portion of the server time. A standard 24-hour clock can be setup by putting '{24H}:{MIN}' in the title configuration, color to taste. Even bothered to research and make sure that the clock cycled to 0:00 instead of 24:00, your welcome.

{MIN}
The minutes portion of the server time (padded with a 0 if <10)

{MER_UPPER}
The uppercase meridiem counterpart of 12-hour time, AM or PM

{MER_LOWER}
The lowercase meridiem counterpart of 12-hour time, am or pm

{SLEEPERS}
The number of players currently sleeping

{WAKERS}
The number of non-ignored non-sleeping players

{TOTAL}
The number of players sleeping + non-sleeping, non-ignored players

{TIMESCALE}
The player's username (not always the one that is displayed in game)

{USERNAME}
The player's username (not always the one that is displayed in game)

{DISPLAYNAME}
The player's name as it is shown in game. May contain prefixes, color codes, etc.

{DISPLAYNAME_STRIP}
DISPLAYNAME without colors or formats.

{LEVEL}
The player's current level

{DAYS_LIVED}
The number of days that the player has lived

{REM_HOURS_LIVED}
The number of hours the player has lived after subtracting days

{REM_MINS_LIVED}
The number of minutes the player has lived after subtracting days and hours

{TOTAL_HOURS_LIVED}
The number of hours that the player has lived (total hours, doesn't subtract days)

{TOTAL_MINS_LIVED}
The number of minutes that the player has lived (total minutes, doesn't subtract hours or days)

{TIME_LIVED}
The time the player has lived in days, minutes, and seconds; formatted as '0d, 0h, 0m'

{WORLD}
The name of the world that the player is sleeping in

{SERVER_IP}
'server-ip' specified in server.properties

{SERVER_MOTD}
'motd' specified in server.properties (including colors)

{SERVER_NAME}
'server-name' specified in server.properties (including colors)

{SERVER_MOTD_STRIP}
'motd' specified in server.properties (stripped of colors)

{SERVER_NAME_STRIP}
'server-name' specified in server.properties (stripped of colors)

{NICKNAME}
Essentials nickname without the group prefix. Same as DISPLAYNAME if essentials isn't installed.

{NICKNAME_STRIP}
NICKNAME without colors or formats.

{HEALTH}
Shows the player’s health (0-20)

{HEALTH_PER}
Shows the player’s health as a percentage (0-100%)

{HEALTH_BAR}
Generates a 20-segment bar indicating the player’s health, setting the empty portion of the bar to black (avoid using the black color code for this or the bar will appear empty all the time)

{FOOD}
Shows the player’s food level (0-20)

{FOOD_PER}
Shows the player’s food level as a percentage (0-100%)

{FOOD_BAR}
Generates a 20-segment bar indicating the player’s food level, setting the empty portion of the bar to black (avoid using the black color code for this or the bar will appear empty all the time)

---

When using placeholders that can be colored (display name, server name, and server MOTD) you may want to include a color character after the placeholder to prevent it from coloring the rest of your message.

---

Have a suggestion? Use the discussion or github issues to submit your ideas!

Thanks to:

  • IAlIstannen for the idea to use NMS sleep ticks
  • _theminerdude_ aka Drathares @ NarniaMC for helping discover and simplify the equation to implement a 'curve' to the night speed.
  • i0HeX for explaining how I can implement a floating point number as a night-speed multiplier
  • @Alter-Ego for simply being a recurring user in the discussions and pointing out several bugs and suggestions.

Source on GitHub
Resource Information
Author:
----------
Total Downloads: 44,826
First Release: Nov 19, 2016
Last Update: Jul 5, 2021
Category: ---------------
All-Time Rating:
55 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings