Inactive [MISC] AnyoneSleep v1.3 - Any player sleeping skips the night [935]

Discussion in 'Inactive/Unsupported Plugins' started by R3ality, Apr 13, 2011.

  1. Offline


    AnyoneSleep - Any player sleeping skips the night!
    Version: v1.3 (CraftBukkit build #935)

    This small plugin allows ANY player to skip the night time of the server by sleeping in a bed (without having to wait for ALL other players to get into beds aswell). If some of the players are AFK (or deep in their mines without a bed) other active players don't have to endure night time while waiting for everyone to use a bed.

    • Any player can skip the night by sleeping in a bed.
      • No need to wait for any other players to get into bed.
      • Multi-world support. Sleeping is world-based!
    • Support for the Permissions plugin (tested with 3.1.5b and 2.7.4, usage is optional)
      • Multi-world permissions support (including nether)!
    • In-game commands
      • To check current status of the plugin
      • To enable/disable sleeping altogether
    • Uses a configuration file to persistantly keep settings.
    Download: [​IMG] AnyoneSleep v1.3 (.jar only)

    • Download and place "AnyoneSleep.jar" file into the "plugin" directory of the server.
    • Start/restart the server to have the plugin loaded (or use a plugin manager)
    • (optional) Make changes in the configuration file
      Read the "Configuration File" section below for details..
    • (if using Permissions) Grant desired permission nodes to users or groups
      Read the "Permissions" section below for details..
    Permissions / Configuration file:
    Show permissions and configuration info (open)

    Permissions plugin usage is optional. If you are not using it the plugin will default to using the regular "ops.txt" (all commands will be enabled for all ops). If you are using permissions but you do not want it to apply to this plugin there is an option to make the plugin "static" via the configuration file (read below)

    The plugin utilizes the following permission nodes:

    anyonesleep.toggle - allow player to toggle sleeping for the server
    Commands enabled: /as toggle

    Special additional permission:

    anyonesleep.cansleep - allow player to sleep even if sleeping is disabled for the server


    Configuration file:

    In case the configuration file doesn't exist it is created automatically with default values when the plugin is loaded. This means you probably don't need to worry about it at all!

    Configuration file uses the .yml format (no tabs and be careful with spaces!) and will be at "plugins/InstaBreak/config.yml". The default (with added comments) is as follows:
        dynamic: #These dynamic configuration settings can be changed with in-game commands aswell (read more in the commands section above).
            enableforall: true #When set to "true" any player can pass the nigth using a bed. When set to "false" only ops (or players with special permission node) can sleep!
    Show changelog (open)
    AnyoneSleep v1.3, released on June 19th
    • Fixed multi-world sleeping!
      Plugin should now correctly handle a situation if two players in different worlds sleep at (roughly) the same time.
    • Word-based announcement
      "Player took a nap" message is now world-based (as opposed to being server-wide).
    AnyoneSleep v1.2, released on June 17th
    • Made sleeping non-instant!
      Player will sway in bed for roughly 5 seconds. Mobs can disrupt sleeping
    • Added in game commands!
      Command to disable sleeping for the whole server in case admin wants it to be night time. This can also be set in the configuration file.
    • Added Permissions plugin support!
      Check the "Permissions" section above for more details..
    • Added a configuration file!
      This plugin now utilizes a configuration file to persistantly keep settings. Check the "Configuration file" section above for more details..
    AnyoneSleep v1.1, released on May 11th
    • Fixed the two issues explained in detailed in this post here.
    • Added a server-wide announcement in case a player sleeps to pass the night.
      This will only occur if there are more than one players in the server..
    • Plugin no longer depends on the isSleepingIgnored() feature added since CraftBukkit #671
      Should work with any CraftBukkit version..
    AnyoneSleep v1.0
    • Initial version
    Known issues / Future ideas:
    Show issues and ideas (open)
    Known issues:
    • Non-sleeping players (who have never slept in a bed) get a number of mobs spawned around them. fixed in v1.1
    • Players (who have their spawn point set to their bed by sleeping) get teleported to their beds if time skips to the morning (in the result of any random player sleeping). fixed in v1.1
    Future ideas:
    • Make a server-wide announcement if the night is skipped by a player sleeping (and who) done in v1.1
    • Maybe implement functionality to disable sleeping for some players (in case someone abuses it)? not needed since v1.2
    • Make sleeping more like the un-modified sleeping (fade to black, stay in bed longer, allow mobs to disrupt sleeping) done in v1.2
    • Make sleeping toggleable by in-game command done in v1.2
    Like this plugin?
    Why not make a donation to show your support! Any amount will be appreciated! :)
    heblol and Pim1234 like this.
  2. Offline


    Interesting, though easily abused. And why is the .jar called InstaBreak.jar? In your instructions.

  3. Offline


    My bad, I had copied the installation instructions over from my other plugin. Fixed now
  4. Offline


    Doesnt work for me, it doesnt say anything, but it do anything, too!

    Have the latest Craftbukkit Build!
  5. Offline


    @ShockBuddy: How did you determine that it doesn't work? Did you have more than one player in the server? Then had one of the players sleep (used the bed) at night time?

    The point of the plugin in a nutshell:
  6. Offline


    how does it work? wouldnt it make the players on differnt times?
  7. Offline


    According to R3ality's post above "if just ONE of all the players in the server sleeps" it sets it to day time.
  8. Offline


    @slickytail: No, time is a server-based attribute. If time changes, it changes for all currently connected players!

    Also there is no impact to world simulation. This plugin DOES NOT speed up time during night to make it morning faster. (NPC's DO NOT run around real fast, trees DO NOT get full-grown instantly, crops DO NOT grow any faster and so on..). Basically the plugin only removes the restriction which requires ALL players to get into bed - apart from that beds and anything related works just like it normally would!
    EDIT: Since v1.1 the plugin simulates sleeping by skipping time to 0 (zero, the morning) and no longer relies on the built-in sleeping functionality

    Hope that helps. I tried to word the initial post a little better aswell to avoid misunderstandings..
  9. Offline


    Great plugin, thank you very much, in big servers, getting all the players in beds is quite difficult :)
  10. Offline



    great idea!
    I'm going to try it out!!

    Possible to create a static download link?
    (For craftbukkituptodate)

  11. Offline


    btw, another idea; a certain minimum percent of the players that needs to bee sleeping? (It's not exactly as idea #2)
  12. Offline


  13. Offline


    Would make this plugin much better!

    Another idea that you could try:
    I am thinking it would be cool if the plugin could "fast forward" the time when x percentage are sleeping.
    So as not to skip the night in a split second, but allow the night to pass by for example in 1 minute (Preferably configurable). If this is possible at all?
    I am guessing that once a player goes to sleep it holds the player until it reaches as certain time of day (Or clicks wake up), then basically just set the time in intervals faster than normal speed. Thus still allowing night to pass for players outside (Just quicker) instead of just skipping the night. If there are many players on a server there will always be someone just going to bed just for fun, or one that wants to skip the night, and all of those out killing zombies or whatever will miss out on the fun. So allowing the night to pass by faster allows players to still experience nighttime, while giving some functionality to the beds.
    If the "faster night" idea is implemented, the speed could also be based on the x percentage of players sleeping. So if 1 of 10 is sleeping, night passes by a bit faster. If 3 of 10 is sleeping, it will pass by 3 times faster, or something similar.

    I see this idea is moving away from the "AnyoneSleep" concept of the plugin, but maybe you could redo/better/more functional the plugin a bit, and rerelease it as "BetterSleep" or the likes?
  14. Offline


    Sht, i totally forgot that! This suggestion of mine really breaks the "AnyoneSleep" concept! sorry :s
  15. Offline


    It breaks the concept I guess, but it's still an awesome idea.
    That way you can require 2 people to sleep, so there can be some communication and people don't just skip the night to troll.
  16. Offline


    someone should be able to contest. just in case someone want s to hunt at night or something
  17. Offline


    Great Idea!

    However, I would prefer it if you can set the percentage of people needed to skip night rather than just one, or at least change the amount of people required.
  18. Offline


    @xGhOsTkiLLeRx: I will look into organizing a download link compatible with CraftBukkitUpToDate whenever I get a chance..

    @cyberdude: Sorry, there will not be any speeding up time (or controlling the interval of time passing in any way). Frankly I don't think its even possible to implement something like that as a fluent transition (rather just skipping the time forward X minutes at a time which essentially gives the same effect as just skipping it straight to the morning anyway). Also yes, it is moving miles away from the initial reasoning behind creating this plugin :p

    As for the highly requested feature of being able to define a certain percentage of players required to skip to the morning, I will look into it. I can't think of a good way to implement it right off the bat but I have a few ideas. All in all I do agree that it would be nice if there was a way to contest in case some players actually want it to be night time..
  19. Offline


    Love the plugin! Had a bit of a problem though - when one player sleeps, anyone who is outside is mobbed by a dozen burning mobs as it switches to daytime :D Anyone else get this or perhaps it's a plugin conflict?
  20. I got that too...
    Also got spammed chat messages while using this with "Sleep Announce", it showed all players sleeping and awaking serval times...

    @plugin developer: Why don't you just do what "time" command does instead of fake-sleeping players ?
  21. Same problem for me = (
  22. Offline


    Yet another report of this, except for me occasionally when any player sleeps other players will be teleported back to their beds sometimes then mugged by various mobs upon arrival. I've disabled this for now; it's a great plugin it just needs some extra work.
  23. Offline


    If you can add a option in a config for ratio like if 2 out of the 3 players are in bed (afk people are consited sleeping) it will change. Eg. 30 people online: 18 in bed, 2 on afk, and 10 not in bed, the time will change.
  24. Offline


    @Zarius and Geotraildark: Burning mobs is normal gameplay and happens with sleeping anyway whether using this plugin or not (of course normally all players would be safely in their homes in bed not strolling around in the wilderness). Are you saying there is an abnormal amount of npc's that "magically appear" right next to the player when time skips? I will check this myself aswell..
    EDIT: Issue confirmed! (see here for details)

    @Digi: What benefit would using the time command have? Also, nothing is faked. As I keep telling, sleeping works EXCACLY like it normally does - all this plugin does is remove the constraint which requires all players of the server to be in bed at the same time..
    EDIT: Using the time command might prove useful in developing a workaround to the issues caused by the normal built-in sleeping mechanics (see here for details)

    @NachoDuck: Sounds like functionality provided by some other plugin perhaps? This plugin does not do any teleportation or any other operations with player(s) locations!
    EDIT: I was able to reproduce this now, thanks for reporting. (see here for details)
  25. Offline


    R3ality: Yes... no mobs close by before the person goes to bed then suddenly a dozen skeletons show up and wipe you out - other players on the server also died at the same time reporting sudden appearance of mobs. They appear at exactly when the time is set to day.
  26. Offline


    @Zarius: You are correct!

    ..I was able to reproduce both of the bugs reported here now. My test results are as follows:

    A server with spawn-monsters flag set to true. Built a primitive house with 2 beds in it, lit with torches to make sure no mobs spawn inside it. Two players (Player A and Player B) on stand-by to do the testing. State of the map saved to reload it from scratch for each test..

    Test 1:
    Player A strolls into the wilderness (without EVER sleeping in either of the beds). Player B goes into the house. Time is set to night. Player B sleeps in a bed. Time skips to the morning and Player A is instantly surrounded by a dozen NPC's resulting in his death..
    Result: CONFIRMED that non-sleeping players (who have never slept in a bed) get a number of mobs spawned around them.

    Test 2:
    Player A and Player B both go into the house. Time is set to night. Both players sleep and time skips to the morning (also, both players get their spawn point set to the beds they slept in). Now Player A strolls into the wilderness and Player B stays in the house. Time is once again set to night. Player B goes to sleep in the same bed as before. Time skips to the morning and Player A is teleported to the bed he had slept in earlier.
    Result: CONFIRMED that players (who have their spawn point set to their bed by sleeping) get teleported to their beds if time skips to the morning (in the result of any random player sleeping).

    I'd advise not to use the plugin until (and if at all) these issues get resolved! Thanks for everyone for the feedback :)
  27. Offline


    Thanks for making the effort to research into this R3ality, after I posted the bug I felt it might have been caused by another plugin also but I never got around to testing it myself with just AnyoneSleep installed. I really hope you manage to iron these bugs out, this is a great plugin for my server and my players love it.
  28. Offline


    Glad you found the bug. I run a survival server so kinda like the idea of one person sleeping and everyone else being warned "<player> is sleeping... better find shelter soon!" with say 30 seconds (or configurable) time warning before day time. Anyone not in shelter (they neccessarily have to sleep) gets surrounded and fights their way out or dies :) The trick is how to balance it so you're not constantly running for shelter, and also allowing other players to oppose the change in time.

    Perhaps the player sleeping triggers a message "<player> is asleep.. better find shelter soon! (Type /sleep no to oppose or /sleep yes to agree)" - no opposition is assumed to be a succesful vote. Slightly longer days would probably also help too.
  29. Offline


    Any progress of an update?

  30. Offline


    @Zarius: Not a bad idea aswell! I was kind of hoping to get away without making manual adjustments to the time of the server (just building upon the in-place sleep mechanics) but due to the highly annoying issues mentioned above it seems I can't. So far both the percentage based sleeping and command based objection to sleeping seem valid options..

    @xGhOsTkiLLeRx: Sadly not much progress for the moment. I will try to find time during next weekend!
    Also, I already have dropbox set up so there will be a static .jar download link starting with the next release..

Share This Page