Compatibility
Minecraft: Java Edition
Platforms
Tags
Creators
Details
SinglePlayerSleep
⚠️ This project is still under development and may contain bugs. Use it carefully and report any issues. I do not intend to make any money from this project. Contact: mrsuffix@olnk.tr
This plugin has no connection to the SinglePlayerSleep plugin on SpigotMC. The similar name is a coincidence.
This plugin was created with AI to demonstrate that AI can write advanced code and build a working system. You are welcome to fork it and use it as you see fit.
A modern, lightweight Minecraft plugin that skips the night instantly in single-player worlds, or with percentage-based voting on multiplayer servers. It comes with visual effects, many configurable options, and PlaceholderAPI support.
About
SinglePlayerSleep keeps the immersive single-player feel on multiplayer servers. The night is skipped when a single player sleeps, or when a set percentage of players vote to sleep.
It includes configurable messages, particle and sound effects, automatic saving, AFK detection, PlaceholderAPI integration, sleep statistics, and automatic update checking.
Whether you run a small private SMP or a public server, SinglePlayerSleep handles night skipping without requiring everyone online to sleep.
Features
- Skip the night when just one player sleeps (classic mode)
- Percentage-based sleep voting
- AFK detection, with AFK players excluded from the sleep count
- Automatic GitHub update checker
- Configurable delay before the night skip
- Cooldown between sleep events to prevent spam
- Automatic weather clearing on the new day
- PlaceholderAPI integration (
%sps_*%placeholders) - Sleep statistics, global and per player, saved to
stats.yml - Countdown before the night skip (action bar and chat)
- Per-world enable/disable (whitelist or blacklist)
- Phantom timer reset on night skip (Paper-aware)
- Particle and sound effects, with particle optimization based on player count
- Config cache for fast performance
- Real-time sleep progress messages
- Automatic world saving after the night skip
- Custom messages with color codes and placeholders
- Debug mode and detailed logging
What's New in 2.2.0
Critical Fixes
getSleepingPlayers()now returns the actual sleeping players instead of an empty set./sleepcan no longer bypass the cooldown in percentage mode.- Particles now spawn only in the session's world, even if a player changes worlds during the countdown.
SleepCommandnow receives itsCooldownManager, fixing aNullPointerExceptionon every/sleeprun.
High-Priority Fixes
- Phantom spawns are now actually cancelled by
PhantomListener. - Stats auto-save every 5 minutes, so a crash no longer loses data.
- Thread safety improved for sleeping players, cooldowns, and the vote module.
- Action bar moved from the deprecated Bungee Chat API to the Adventure API.
- Player quit and kick handling now clears sleeping players correctly.
- Sleep sessions are no longer created by simply querying a world.
- Votes now verify the voter is still in the same world.
- The default update-check repository name is corrected.
Performance and Code Quality
- Time constants moved into a shared
TimeUtilclass. - Lower allocation and GC pressure in the sleeping-count and vote logic.
- Sleep sessions clean themselves up when their world becomes empty.
stats.ymlis pruned automatically based onstats.cleanup-days.- Redundant null checks and unnecessary copies removed.
Installation
- Download the latest release from Modrinth or GitHub Releases.
- Place the
.jarfile in your server's/pluginsfolder. - Restart or reload your server.
- Edit
plugins/SinglePlayerSleep/config.ymlas needed. - Run
/sps reloadto apply configuration changes.
Requirements
- Minecraft 1.21.1+
- Java 21+
- Paper (recommended) or Spigot
Optional: Install PlaceholderAPI to enable %sps_*% placeholders.
Commands
| Command | Description | Permission |
|---|---|---|
/sleep |
Vote to skip the night (percentage mode) | singleplayersleep.sleep |
/sps reload |
Reload the config and reset sessions | singleplayersleep.admin |
/sps stats [player] |
View global or per-player sleep stats | singleplayersleep.admin |
/sps afk |
Toggle your AFK status manually | singleplayersleep.admin |
/sps version |
Show plugin info and update status | singleplayersleep.admin |
/sps debug |
Toggle debug logging | singleplayersleep.admin |
Permissions
| Permission | Default | Description |
|---|---|---|
singleplayersleep.sleep |
true |
Use /sleep |
singleplayersleep.admin |
op |
Use /sps and admin features |
singleplayersleep.bypasscooldown |
op |
Bypass the sleep cooldown |
singleplayersleep.bypassafk |
op |
Never marked as AFK |
singleplayersleep.stats |
true |
View statistics (reserved) |
PlaceholderAPI
Requires PlaceholderAPI. Expansion identifier: sps
| Placeholder | Description |
|---|---|
%sps_sleeping% |
Sleeping players in the viewer's world |
%sps_required% |
Required sleepers in the viewer's world |
%sps_is_night% |
true or false: is it currently night |
%sps_is_processing% |
true or false: is a night skip in progress |
%sps_cooldown% |
Remaining cooldown in seconds |
%sps_is_afk% |
true or false: is the player AFK |
%sps_nights_skipped% |
Total nights skipped (global) |
%sps_player_times_slept% |
Times this player has slept |
%sps_mode% |
single or percentage |
%sps_percentage% |
Required percentage |
Configuration
Config file: plugins/SinglePlayerSleep/config.yml
Sleep Behavior
| Key | Default | Description |
|---|---|---|
sleep.mode |
single |
single or percentage |
sleep.percentage |
50 |
Required % of non-AFK players |
sleep.delay-ticks |
100 |
Delay before the night skip (20 ticks = 1 second) |
sleep.cooldown-seconds |
60 |
Cooldown between sleep sessions |
sleep.clear-weather |
true |
Clear rain and thunder after the skip |
sleep.auto-save |
true |
Save the world after the skip |
AFK System
| Key | Default | Description |
|---|---|---|
afk.enabled |
true |
Enable AFK tracking |
afk.timeout-seconds |
300 |
Inactivity time before a player is AFK |
afk.exclude-from-count |
true |
Exclude AFK players from the required count |
afk.check-interval-ticks |
200 |
How often AFK checks run |
Countdown
| Key | Default | Description |
|---|---|---|
countdown.enabled |
true |
Enable countdown before the skip |
countdown.duration-seconds |
5 |
Countdown length |
countdown.show-actionbar |
true |
Show the countdown in the action bar |
countdown.show-chat |
false |
Also post the countdown to chat |
countdown.sound-on-each-tick |
true |
Play a tick sound each second |
Statistics
| Key | Default | Description |
|---|---|---|
stats.enabled |
true |
Enable stats tracking |
stats.persist |
true |
Save stats to stats.yml |
stats.track-per-player |
true |
Track per-player stats |
stats.cleanup-days |
90 |
Purge stats for players unseen for this many days |
World Filtering
| Key | Default | Description |
|---|---|---|
worlds.enabled |
["world"] |
List of worlds |
worlds.mode |
whitelist |
whitelist or blacklist |
Contributing
Contributions are welcome!
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -m "Add my feature" - Push the branch:
git push origin feature/my-feature - Open a Pull Request
git clone https://github.com/MRsuffixx/SinglePlayerSleep.git
mvn clean package
Support
When reporting a bug, please include your Minecraft version, plugin version, server software, config.yml, and any error logs.
Roadmap
- [ ] Bossbar progress indicator
- [ ] MySQL/SQLite support for statistics
- [ ] Multi-language support
- [ ] Discord webhook integration
- [ ] Per-world configuration overrides
License
Distributed under the MIT License. See LICENSE for details.
Credits
Author: MRsuffix Minecraft: 1.21.1+
Built with love for the Minecraft community.
