Configuration
[ Features | Commands | > Configuration | Permissions ]
Server Operators can customize any messages as desired for language, color, or formatting. Messages use indexed format elements as described in Java's MessageFormat usage. All messages recognize color or format codes prefixed with a section sign (§). Most all messages (except those who explicitly declare a 0 parameter in their comments) will convert {0} into the current time. All messages can be configured in the plugins/sleep/language.yml file.
Once any changes are made to either the configuration or the language files, the Sleep plugin needs to be reloaded with the /sleep:reload
command.
Messages
Messages will be sent to all players in the world for sleep related events such as entering a bed (enter), leaving a bed (leave), joining the world while players are in bed (add), and leaving the world while players are in bed (remove).
plugins/Sleep/language.yml
enter: '§8{0,time,HH:mm:ss} {1}§8 entered bed ({2,choice,0#§5no more sleepers needed§8|1#§dneed +{2} to sleep§8})' # 1 = Player, 2 = Player Count Needed, 3 = Player Count In Bed, 4 = Player Count Possible leave: '§8{0,time,HH:mm:ss} {1}§8 left bed ({3,choice,0#§5no one in bed§8|1#§dneed +{2} to sleep§8})' # 1 = Player, 2 = Player Count Needed, 3 = Player Count In Bed, 4 = Player Count Possible add: '§8{0,time,HH:mm:ss} {1}§8 joined the world (§dneed +{2} to sleep§8)' # 1 = Player, 2 = Player Count Needed, 3 = Player Count In Bed, 4 = Player Count Possible remove: '§8{0,time,HH:mm:ss} {1}§8 left the world ({2,choice,0#§5no more sleepers needed§8|1#§dneed +{2} to sleep§8})' # 1 = Player, 2 = Player Count Needed, 3 = Player Count In Bed, 4 = Player Count Possible
Spam Filter
To prevent players from abusing the sleep messages appearing in chat, by default the enter and leave messages will be prevented if they appear from the same player more than once within five seconds.
/plugins/Sleep/config.yml
spam-filter: enable: true cooldown: 5 # seconds reasons: [ENTER, LEAVE]
Idle Players
This plugin will automatically ignore for sleep any player that does not perform any of the configured events within the configured duration. By default the events listed below are monitored and if none of them have been recorded in the last 60 seconds for a player, that player will not prevent other active players from sleeping.
Any Bukkit event associated with a player should be able to be used in the configuration including a custom one (PlayerMoveBlockEvent
) which only triggers if a player moves more than one block along any axis. The full list of supported events can be found in the PlayerActivity source code.
/plugins/Sleep/config.yml
idle: enable: true duration: 60 # seconds activity: - PlayerMoveBlockEvent - AsyncPlayerChatEvent - PlayerInteractEvent - PlayerDropItemEvent - PlayerToggleSneakEvent - PlayerItemHeldEvent - PlayerJoinEvent - PlayerChangedWorldEvent - EnchantItemEvent - PrepareItemEnchantEvent - InventoryClickEvent
plugins/Sleep/language.yml
idle: idle: '§8{0,time,HH:mm:ss} {1}§8 is now idle ({2,choice,0#§5no more sleepers needed§8|1#§dneed +{2} to sleep§8})' # 1 = Player, 2 = Player Count Needed, 3 = Player Count In Bed, 4 = Player Count Possible active: '§8{0,time,HH:mm:ss} {1}§8 is no longer idle (§dneed +{2} to sleep§8)' # 1 = Player, 2 = Player Count Needed, 3 = Player Count In Bed, 4 = Player Count Possible
Force Sleep (Count/Percent)
To force sleep when only some portion of the server players are in bed, you can define either a percent or a specific number of players (or both). force.percent
should be supplied as an integer between 1 and 100 in order to apply.
e.g. If you only want to set a minimum number of players that forces sleep (even just 1) you can set "percent: -1" and it will not check the percent.
Keep in mind, idle and always ignored players will be excluded in calculations for this feature, unless they have entered a bed themselves and are thereby actively soliciting sleep to occur.
/plugins/Sleep/config.yml
force: enable: false count: -1 percent: -1
plugins/Sleep/language.yml
force: notify: '§8{0,time,HH:mm:ss} {1}§8 is §5forcing§8 the sun to rise' # 1 = Player / Plugin Name
Rewards
To encourage players to use beds for sleep you can enable the reward system. Rewards are issued upon completion of a night passed due to at least one player using a bed. Rewards are only issued to players who actively used a bed and can be scaled according to however many players did use a bed.
When enabled, the default configuration will reward players for using a bed to pass the night by increasing their food saturation and regenerating two hearts of health, similar to the effect of eating a Golden Apple without any actual hunger being restored. Their exhaustion level is also reset to zero. (They are still hungry as they haven't eaten during the night, but they do feel refreshed from a good sleep.) Additionally, players will be rewarded with Experience Orbs. Three orbs that have five experience each and additional orbs at a factor of 0.5 for each additional player in bed. (e.g. If four players use beds to pass the night, in the morning each will receive seven orbs.) Much like mining and smelting now grant players experience, sleeping can also!
You can customize the reward system greatly. I'll flush out the documentation here eventually, but you can look through the source code for now to determine what class of rewards you can use and their attributes.
/plugins/Sleep/config.yml
rewards: enable: false Golden Apple Satiation: type: Food saturation: 9.6 level: 0 factor: 0.0 Golden Apple Regeneration: type: PotionEffect effect: REGENERATION duration: 4 amplifier: 1 factor: 0.0 Exhaustion Reset: type: Health health: 0 exhaustion: -100.0 factor: 0.0 Experience Orbs: type: ExperienceOrb quantity: 3 experience: 5 factor: 0.5
Temporary Bed
Players can be reluctant to use a bed to pass the night while out adventuring/mining away from home since their respawn will be reset to the newly used bed. However, if you enable the temporary bed function you can remove their concerns.
When this feature is enabled, if the bed block just used is broken down within the duration allowed the player's respawn will be reset to their previously used bed. This allows players to keep a bed on them, throw it down temporarily and sleep in it, then pick it back up and not affect their original respawn location.
plugins/Sleep/config.yml
temporary: enable: false duration: 500 # seconds (<1 day cycle)
plugins/Sleep/language.yml
temporary: instruction: '§f-> §8To §5revert§8 to previous spawn, §5destroy§8 this bed soon' # 1 = Duration reverted: '§f-> §2Reverted§8 spawn to previous bed'
Ignore Underground
To automatically ignore any players below a specific depth when other players enter bed, enable the underground feature. The delay
entry allows underground players some time to get to their bed to participate if desired.
plugins/Sleep/config.yml
underground: enable: false depth: 50 # y-axis value ignored when below delay: 5 # seconds to wait before ignored
plugins/Sleep/language.yml
underground: initial: '§8{0,time,HH:mm:ss} {1} player{1,choice,1#|2#s} deep underground ({2,choice,0#§5no more sleepers needed§8|1#§dneed +{2} to sleep§8})' # 1 = Player Count Below, 2 = Player Count Needed, 3 = Player Count In Bed, 4 = Player Count Possible above: '§8{0,time,HH:mm:ss} {1} is no longer underground ({3,choice,0#§5no one in bed§8|1#§dneed +{2} to sleep§8})' # 1 = Player, 2 = Player Count Needed, 3 = Player Count In Bed, 4 = Player Count Possible below: '§8{0,time,HH:mm:ss} {1} is underground ({2,choice,0#§5no more sleepers needed§8|1#§dneed +{2} to sleep§8})' # 1 = Player, 2 = Player Count Needed, 3 = Player Count In Bed, 4 = Player Count Possible
Fast Forward Night
Enabling the fast-forward feature allows night time to be incrementally advanced proportional to the number of players in bed. This feature was modelled after the BetterSleep plugin which is no longer supported.
plugins/Sleep/config.yml
fast-forward: enable: false min: 30 # percent required to start advancing time max: 70 # percent at which to force sleep scale: true # adjust rate of time advance relative to min/max instead of total players possible speed: 20 # ticks to wait between each time change
plugins/Sleep/language.yml
fast-forward: notify: '§8{0,time,HH:mm:ss} Fast-forwarding {1,choice,0#of night has stopped (§7{5} in bed will start again§8)|0.0<night by §7{1,number,percent}}' # 1 = Fast-Forwarding Percent, 2 = Player Count Needed, 3 = Player Count In Bed, 4 = Player Count Possible, 5 = Minimum Start status: '§f-> §7Fast-forwarding {1,choice,0#of night is stopped §8({5} in bed will start§8)|0.0<night by §7{1,number,percent}}' # 1 = Fast-Forwarding Percent, 2 = Player Count Needed, 3 = Player Count In Bed, 4 = Player Count Possible, 5 = Minimum Start
Insomnia
By default, sleep is allowed. You can prevent players from passing the night (but still change their respawn location) by setting insomnia.enable: true
in the configuration file.
If insomnia, players will be automatically ejected from bed before night can pass, but their respawn location will still be changed if they are automatically ejected.
plugins/Sleep/config.yml
insomnia: enable: false
plugins/Sleep/language.yml
insomnia: eject: '§f-> §7Sleep is §edisabled§7' status: '§f-> §7Sleep is §edisabled§7 for {1}' # 1 = World
Manual Away
To allow players to manually exclude themselves from affecting sleep enable away.enable: true
in the configuration file. This feature requires the PlayerActivity plugin to be manually installed.
plugins/Sleep/config.yml
away: enable: false # requires PlayerActivity plugin
plugins/Sleep/language.yml
away: away: '§8{0,time,HH:mm:ss} {1}§8 is now away ({2,choice,0#§5no more sleepers needed§8|1#§dneed +{2} to sleep§8})' # 1 = Player, 2 = Player Count Needed, 3 = Player Count In Bed, 4 = Player Count Possible back: '§8{0,time,HH:mm:ss} {1}§8 is no longer away (§dneed +{2} to sleep§8)' # 1 = Player, 2 = Player Count Needed, 3 = Player Count In Bed, 4 = Player Count Possible
World Specific Overrides
To override any of the configuration file settings for a specific world create plugins/Sleep/Worlds/<WORLD>/config.yml and plugins/Sleep/Worlds/<WORLD>/language.yml files under the folder named the same as the world's name with only the settings that should be overridden for that specific world.
For instance, to override a setting for a world named "world", a "plugins/Sleep/Worlds/world/config.yml" file needs to be created with just the settings to be overridden in the same format as the plugin's configuration file.
World Exclusions
To exclude a world from this plugin's sleep management features, Server Operators can add the following setting:
plugins/Sleep/config.yml
exclude: - WorldName - AnotherWorld
Defaults
Default plugins/Sleep/config.yml
Default plugins/Sleep/language.yml
Comments