CustomSleeping allows to set a minimum of players who must sleep to start a new day, instead of the default Minecraft's minimum (all the players at the same time).
NOTE: download the version 6.1 to use in servers which version is 1.17.X and below. It'll be fixed for the next update.
Installation guide: · Download CustomSleeping.jar
· Drop it in your server's plugin file.
· Run the server and enjoy!
· Set how many players are needed sleeping to start a new day.
· (Configurable) 1 player needed or a percentage of currently online players.
· If a player or the minimum players set in the config is sleeping, it will stop raining and thundering.
· Custom messages when entering or leaving the bed.
· Disable sleeping in any world (Configurable).
· Disable or enable the explosion of the bed in nether and the end.
Variables available:
%player% (The player who slept).
%totalplayers% (the number of players that are sleeping).
%neededplayers% (the number of players that must sleep).
Code (Text):
##############################################
# #
# CustomSleeping 6.0 #
# #
##############################################
#Variables used:
# %player% displays the name of the player who went to sleep.
# %totalPlayers% displays the number of players that are currently sleeping.
# %neededPlayers% displays the number of players that are required to change the day-time.
#If the value of any message is set to null, the message won't be shown.
# e.g: toAllPlayers = "null"
Messages:
# Message sent to all the players in the current world.
toAllPlayers: "&c%player% &e went to sleep."
# Message sent to the player that is sleeping
toPlayer: "&eHave a sweet dream!"
# Message sent to all the players in the current world when a player left the bed.
playerLeftBed: "&c%player% &eleft the bed. Currently sleeping: &c%totalPlayers%&e/&c%neededPlayers%."
# Message sent to the player when the game rule doDaylightCycle is true. (Only if enableOnDaylightCycleIsFalse = false)
notAllowedGameRule: "&4You cannot sleep in this world."
# Message sent to the player when the world doesn't allow sleeping or it's in the list of Banned_Worlds
notAllowedWorld: "&4You cannot sleep in this world."
# Message sent to the player who tried to sleep when there are monsters nearby.
monstersNearby: "&4You may not rest now, there are monsters nearby."
# Message sent to the player when entering the bed is prevented due to it not being night nor thundering currently.
notPossibleNow: "&4You cannot sleep now, is not being night nor thundering currently."
# Message sent to the player when is too far away.
tooFarAway: "&4You are too far away from bed."
Settings:
# playersNeeded: set a minimum number of players that are required to change the day-time.
# If the value of playersNeeded is set to 0, only one player is needed to change the day-time.
# If it's set to any number between 0-100, it will be the % of players that must be sleeping at the same time.
# If it's set to any number higher than 100 or below 0 then, it behaves like minecraft default (100%).
playersNeeded: 0
# Allows to enable or disable the possibility to sleep in any world with the game rule doDaylightCycle on false.
# If it's set to false, players won't be able to sleep in any world with this game rule set to true.
enableOnDoDaylightCycleIsFalse: false
#When sleeping in worlds where beds explode (world_the_end and world_nether) and it's enabled, the will explode when
#trying to sleep (as default minecraft). If is set to false, the bed will not explode.
enableExplosion: false
# Disable worlds from sleeping (world_nether and world_the_end can be removed from the list and nothing will happen in-game, it's just an example).
Banned_Worlds:
- 'world_nether'
- 'world_the_end'
· Players with permissions can sleep alone and change the day time.
·
DONE Ability to disable worlds where the minimum number of players will not affect, it will work as the default game.
·
DONE If the gamerule DoDaylightCycle is false, the players won't be able to sleep to change the dayTime. Includes a custom message too.
·
DONE New Config file structure.
·
DONE New variables for messages that display the total number of players sleeping and the total number of players needed to change the day-time.
·
DONE Be able to skip thunderstorms.
·
FIXED BUG: Percentage of minimum players sleeping to start a new day.
·
FIXED BUG: Players sleeps and it automatically starts a new day.
·
FIXED BUG: players can sleep when monsters are nearby.
·
FIXED BUG: players can sleep in the NETHER & END.
·
FIXED BUG: players can sleep even if they are far away from the bed.
·
FIXED BUG: phantoms kept spawning even if player has slept in the last 3 days.
Tell me new features that you would want to have in the plugin!
I'm still learning Java, this is my second plugin
. I know maybe it's useless but I'm working to improve to bring you better plugins in the future.
Please, tell me ideas or make me know about bugs. I'll be pending.
Thank you!
By the way, I'm sorry for my bad English :,)