Sleep Percentage

What is Sleep Percentage

This Plugin allows a percentage of players sleeping in a world to turn it day. Has Multi world Support!


When the percentage is reached on the world, it will change to day. Every time a user enters a bed it will post the current percentage, the needed percentage and the player which just entered the bed.

You can configure the percentage needed in the config.yml or by the command.

All commands are by default are OP only, but if you use permissions the user will either have to be a OP or have the permission.


  • /sptoggle - Toggles the plugin on and off
  • /spset [WorldName] <Percentage> - Sets the needed percentage of sleepers to sleep
  • /spdaytick [WorldName] <Tick> - Sets the offset of the ticks when time is changed to day
  • /spdisable [WorldName] <true/false> - Disables a particular world from having percentage based sleep.


  • sp.toggle - For the /sptoggle command
  • sp.set - For the /spset command
  • sp.daytick  - For the /spdaytick command
  • sp.disable - For the /spdisable command
  • sp.sleepWhileMobNear - Ability to sleep when Monsters are nearby

How to install

Copy the Jar into the plugins folder of the Bukkit / Spigot Server. On first run of the plugin the config file will be automatically generated.

Using Java 7 you will need to use build 1.1.1 or below, as build 1.1.2 and above now uses Java 8 as a default.

Config File

  • sleepingEnabled: (true/false) If sleep percentage will work or not
  • percentageperworld:
    • world_name:
      • disabled: (true/false) If the world allows sleep percentage to be used
      • percentage: (0 - 100) What percentage of players need to be sleeping in the world for it to change to day
      • timeset: (0 - 23999) What time to set the day to when it changes to day
      • maxtickweatherstay: (0 - 1000000) How long the weather will stay clear for in ticks. (20 ticks per second)
      • allowPlayersToSleepWhileMobsAreNearby: (Requires Permission sp.sleepWhileMobNear for this to work)
        • enabled: (true/false) Allow players to sleep when monsters are nearby
        • nameTagOnly: (true/false) Monster needs to be name tagged for the player to sleep near them
        • ignorePermission: (true/false) If players can sleep near monsters without the permission
  • messages: (Follow Customize Message Output for how to configure messages)
    • set: [0] = The percentage that you have set it to, [1] = World Name
    • not_sleeping: [0] = Player Name, [1] = World Name
    • sleeping: [0] = Player Name, [1] = World Name
    • total: [0] = Current amount of players sleeping, [1] = Total amount of players sleeping, [2] = World Name
    • daytick: [0] = Day Tick that you have set, [1] = World Name
    • worldDisable: [0] = If you disabled the world or not, [1] = World Name
    • worldDisableFailed: [0] = World Name

Customize Message Output

I would only recommend for server admins which understand how tokenizing and indexes work in general software. The reasoning for going for this approach rather than others means I still control the actual message in the plugin.

You can change two items about the message. Colors and wording.

In the generated config file, you will see a list of messages. To change the wording for a particular type you will look for the key 'message'. Editing the value will change the value ingame. Some of the messages come with variables that can be used. They can be accessed by variable indexes using square brackets e.g. [0]. Indexes starting at zero. Most messages only have one  variable, but there are some with two.

message: '{1}Currently, {0}[0]%{1} of players are sleeping out of the {0}[1]{1}% needed'

A message can support an Integer Max of colors (More colors than you are going to use). The only colors available are those provided by Bukkit. For a full list go check out the Bukkit API for ChatColor. Colors are provided in a list within the message type. Colors are case sensitive (Must be Upper Case). In index order starting at zero, the list follows. To put that color in your message you need to add an enclosing curly brackets with the index of the color inside. E.g. {0}. This would get the first color on the list.

- 'GOLD'
- 'GRAY'
message: '{1}Currently, {0}[0]%{1} of players are sleeping out of the {0}[1]{1}% needed'

This feature is brand new. I have done a bit of testing with it to make sure that it can handle the errors that were showing up. If you do get a error with custom messages please post it on the bug tracker. I will need your config file and a screenshot of the error / log file / post the error to look further into the bug.

Known Issues

Please report new issues on the Bug Tracker. I will try to watch the comments, but you will be noticed by the bug tracker.

  • In the command backbone, the usage command will say that WorldName is a required field. It is not. It is optional. Commands will still work with the WorldName not being present.

Change Log

  • 1.2.1 - Fixed bug with disconnecting when a user was in transfer world state. Fixed bug which sleeping next to monsters would work even when the world was disabled.
  • 1.2.0 - Added Multi World Support (Finally). More messages for commands. Rebuilt the configuration loader. (No longer wipes config on version update, but doesn't import comments). Added comments to better explain the the Message Output config. Added new command spdisable so you can disable individual worlds. By a user requested feature, I have added in sleeping near mobs. I have changed the package name, so anyone who does code injection into the plugin, this update will break it.
  • 1.1.2 - Updated for 1.12. Cleaned up Code base. Upgraded to Java 8 as now a server requirement.
  • 1.1.1 - Added in tokenizing interpreter for changing messages. Added in a new command to handle day offset. Attempted to fix moon cycles.
  • 1.1.0 - Rewrote a large amount of the plugin. Fixed outstanding bugs. Integrated with my own backend frameworks to streamline development. Developed on Minecraft 1.11.2
  • 1.0.3 - Fixes weather clearing (Hopefully, Bukkit is a bit funny with weather). Fix some other problems
  • 1.0.2 - Add a message for when a player leaves a bed, this only happens at night. Permissions work correctly, clears weather on sleep
  • 1.0.0 - First Release of Plugin


Posts Quoted:
Clear All Quotes

About This Project

  • Project ID
  • Created
    Feb 14, 2015
  • Last Released File
    Dec 19, 2017
  • Total Downloads
  • License



Recent Files