[MISC] Sleep v7.0.0 - Multi-Player Sleep Management (Idle, Notifications, Force) [1.5.1]

Discussion in 'Archived: Plugin Releases' started by EdGruberman, Apr 26, 2011.

  1. Offline

    EdGruberman

    harakiwi, Glaze, Frogging101 and 2 others like this.
  2. Offline

    EdGruberman

    @Brocodo - Sorry, I just copy/pasted my notes for the future edit of the original post with instructions in case you needed it.

    But basically, if you have not edited the configuration file to add any messages, you don't need to worry about anything other than updating Sleep.jar with the beta link I provided.

    Please let me know if you have any problems!
     
  3. Offline

    Brocodo

    Oke i now do onderstand but the problem now is this...
    It happens when i start the server.
    Code:
    05:41:48 [SEVERE] Could not load 'plugins\Sleep.jar' in folder 'plugins':
    while parsing a block mapping
     in "<reader>", line 1, column 1:
        inactivityLimit: 300
        ^
    expected <block end>, but found BlockMappingStart
     in "<reader>", line 10, column 5:
            LEAVE_BED:
            ^
    
            at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(Par
    serImpl.java:576)
            at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:163)
            at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:148)
            at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java
    :228)
            at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
            at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:12
    2)
            at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105)
    
            at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseCons
    tructor.java:124)
            at org.yaml.snakeyaml.Yaml.load(Yaml.java:264)
            at org.bukkit.util.config.Configuration.load(Configuration.java:82)
            at org.bukkit.plugin.java.JavaPlugin.initialize(JavaPlugin.java:157)
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:175)
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
    java:207)
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    .java:130)
            at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:128)
            at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:97)
            at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigur
    ationManager.java:51)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:132)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:335)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    
     
  4. Offline

    EdGruberman

    @Brocodo - that looks like your /plugins/Sleep/config.yml file is broken somehow. Just delete that config.yml file and restart your server and it should be automatically recreated and no errors.
     
  5. Offline

    Brocodo

    It works i think i made a mistake with deleting the sleep folder...Now im going to test if the firs error is still there... (with the PLAYER_BED_LEAVE thing..)
    P.S. Do you play minecraft on a server? Mine is dutchcrafters.sytes.net. So if you whant to test something your welcome!

    OKEY! Everything works fine! No errors, messages are up. Thank you for helping!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 14, 2016
  6. Offline

    EdGruberman

    YAY! Good to hear. Just let me know if anything else crops up.

    I plan on testing more with the beta today/tomorrow and probably releasing before the weekend is over if all goes well.
     
  7. Offline

    EdGruberman

    I just released 2.3.1

    Biggest change is more optional notifications (LEAVE_BED, NIGHTMARE, FORCE_SLEEP, and FORCE_SAFE). You'll have to edit your config.yml if you've previously added a message for ENTER_BED (message.enterBed). Details in first post.

    A new feature has been added to allow designated players to force sleep for a world when entering bed. Just grant a player the sleep.force permission.

    I've also got a new pull request in to address the known issue of ignored players that have already used a bed in their current gaming session still returning to their beds at the end of a sleep cycle: https://github.com/Bukkit/CraftBukkit/pull/428
     
  8. Offline

    Jigsaw

    Dropped the .jar in my plugins folder, started the server and got this:
    Code:
    2011-08-14 15:20:23 [SEVERE] Could not load 'plugins/Sleep.jar' in folder 'plugins': MessageManager
    org.bukkit.plugin.UnknownDependencyException: MessageManager
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133)
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:207)
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:130)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:128)
        at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:97)
        at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:51)
        at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:132)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:335)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
     
  9. Offline

    EdGruberman

    @Jigsaw - You'll need to drop the MessageManager.jar file in your plugins folder also. But you won't have to configure MessageManager at all, and it won't change anything with how your server functions, so you can ignore it after you copy it there.
     
  10. Offline

    Jigsaw

    Wow! I can't believe I completely missed that. Thanks for letting me know! I am excited for this plugin :)
     
  11. Offline

    Frogging101

    Love this plugin. My players love it too.
     
  12. Offline

    EdGruberman

  13. Offline

    saberstormer

    hey i want to edit this but i can't find the simpleawaysleep/config.yml
    And it's also not in the sleep/ config.ym
     
  14. Offline

    EdGruberman

    @saberstormer - The first post on this thread has updated instructions for the forced sleep settings.

     
  15. Offline

    saberstormer

    :Dyay! thanks for the fast awnser
     
  16. Offline

    Frogging101

    I have it set so that when 50% of the players are in bed, the sleep cycle occurs. But for some reason if half the people on the server get in bed and trigger the sleep cycle, all the other ACTIVE players will get teleported back to their bed.

    For example, I was mining, and it was night. Some other players went to bed to make it daytime, and when they did so, I was teleported back to my bed. Also, I got moving violation errors for other players (non-ops), suggesting that it also attempted to teleport them back to bed.

    Is there a way to stop this from happening?
     
  17. Offline

    EdGruberman

    @Frogging101 - That is a bug I uncovered recently myself. It's a tricky one too as not all inactive players will be teleported back to their beds... only those inactive players that have used a bed in their latest session will be teleported back.

    I've got a pull request in for the Bukkit team to look at to fix this issue: https://github.com/Bukkit/CraftBukkit/pull/428 If you've got any friends on the Bukkit team, maybe you can rattle their chains to look at that further?

    For now, I've been compiling CraftBukkit myself with this fix included and it's worked fine for me. Unfortunately due to the nature of how CraftBukkit is coded currently it's impossible to cancel the teleport.
     
  18. Offline

    asbomine

    This is a great plugin! Thanks! :)
     
  19. Offline

    EdGruberman

    I just officially released 3.0.0. While this is a major version change, the code itself hasn't changed too dramatically actually. The version change is more to draw attention to the fact that CraftBukkit has actually changed and the end result is this plugin can implement much better performance and a few important fixes.

    It is critical to note that this version of the plugin only supports a build that is currently NOT recommended. You can choose to wait for the official recommendation from the Bukkit team to update, or take a chance and update ahead of the curve. I've been using build 1219 myself on my production server since it came out now and it's been great for me. When in doubt... wait it out!

    The two biggest related changes here are that nightmares no longer occur for players ignoring sleep in CraftBukkit and that players ignoring sleep will not be even attempted to be returned to bed by CraftBukkit. This plugin had attempted to work around those issues but was still encountering problems as a result. With the recent changes to CraftBukkit this plugin was able to change how it monitored and reacted to these types of events to be both reliable and minimal impact on performance now.

    The official changelog updates for the plugin are:
    •FIX: Players in bed not initialized properly if plugin enable after players are already in bed
    •CHG: Adjust nightmare tracking for CraftBukkit changes to fix performance issues
    •CHG: Added current players in bed to /sleep status command
    •CHG: Added number of players in bed to ENTER_BED, LEAVE_BED, and NIGHTMARE notifications
    •FIX: Player connection loss while in bed causes count to be incorrect
    •FIX: Minor reword on command usage when action not recognized
    •FIX: Current percent would incorrectly match sometimes and be off by 1 player.

    Last note: MessageManager has been updated to 4.0.3 also. I recommend everyone update to that version as it contains a comple of good fixes and won't cause you to have to change any configurations to compensate, just copy the new jar file over the old.


    A HUGE Thank You goes out to @Silentspy for all his help with the latest testing and CraftBukkit updates. I simply could not have accomplished any of this latest success without his direct and dedicted assistance.
     
  20. Offline

    ssechaud

    Can this be made to not depend on MessageManager? We use iChat and this messes it all up :(
     
  21. Offline

    EdGruberman

    @ssechaud - what exactly happens that you do not like?

    I had someone else mention a problem with prefixes not displaying as expected with iChat I believe. I can definitely make the effort to make it integrate better with such.

    But I'm assuming by "messes it all up" you mean the messages that appear from this plugin don't display the same way as iChat does?
     
  22. Offline

    ssechaud

    I've changed my iChat settings and it looks ok now. Am still using the last recommended build, what issues will there be if am not using the latest build of craftbukkit with this? And I've noticed player names aren't being displayed, just "[world] Server has forced sleep." And is there a way to disable nightmares?
     
  23. Offline

    EdGruberman

    Good to know you got iChat working with this.

    If you are not using 1240, some inactive players could be returned to their bedside after a sleep cycle finishes (only those players that have used a bed during their current gaming session). Also, without 1240 you might experience some performance problems during sleep deepending on how many players you have and how powerful your hardware is for your server.

    Edit: Oh actually I just realized if you are using Sleep 3.0.0 with CraftBukkit 1240 it might not even protect sleepers properly from nightmares and will not prevent inactive players being returned to bed at all.

    The "Server has forced sleep." message occurs when the minimum number of players or percentage threshold has been met. Since it's not a specific player that is causing it through a command or special privilege, but rather that threshold has simply been met, the message indicates it's a server configuration that is causing the sleep to occur.

    There is currently no way to disable nightmares completely. I've realized I need to be more open to suggestions though, so I will look at adding that for the next release! :)

    Another thought: You can manually force safe sleep with the "/sleep force safe" in-game command if you possess the sleep.sleep.force.safe permission. But I think you were asking more for just disabling nightmares in general/for any sleep cycle?
     
    ssechaud likes this.
  24. Offline

    Glaze

    Would it be possible for this mod to allow sleep/setting of the spawn point, but disable the resetting of time to morning? For example, there are redstone devices (like a large clock/calendar) or other plugins (ex. Ambient Seasons) that are dependent on the day being constant, at least for aesthetic purposes. If there is only one person on the server they can sleep and break the cycle.

    If that's not possible, are there any plugins that can? All I've been able to find the past few days were mods that skip the night and disable the spawn point reset, which is the opposite of what I want.
     
  25. Offline

    EdGruberman

    @Glaze - The Bukkit interface doesn't allow you to cancel sleep, but there may be a way still. I'll look closer this week to see if what you are asking is possible.

    If anyone is willing to help test the beta for 3.1.0 out, it would help tremendously. I've been short on time lately, so I've only minimally tested myself.

    You can download 3.1.0b1 from: https://github.com/EdGruberman/Sleep/raw/master/dist/Sleep.jar

    @ssechaud - If you add the following to your config.yml it should disable nightmares for you:
    Code:
    safe: true
    @Glaze - If you add the following to your config.yml it should disable players changing time but still set their new spawn point to the bed they are using. It will only set their new bed spawn location if they stay in long enough and let it eject them automatically though. The concept being to emulate how a bed works still but only disable the actual sleep cycle/time change:
    Code:
    sleep: false


    The changelog so far is:
    • CHG: Added feature to disable sleep but still allow bed usage to set new spawn location
    • CHG: Added ability to specify always safe sleep or not
    • CHG: Split force sleep notifications to clarify configuration or player caused
    • CHG: Added /sleep force safe now immediate command
    • CHG: Default inactivity threshold set to 60 seconds
    • CHG: Added %4$d parameter for total players possible to notifications
    • FIX: FORCE_SAFE notification not displaying with default configuration
    • FIX: Forcing safe sleep without at least 1 player in bed
    • FIX: Code clean-up and organization

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 14, 2016
  26. Offline

    Glaze

    That was very timely, thank you. I was actually expecting it to be too hard to bother with.
     
  27. Offline

    EdGruberman

    Heh, I suppose that is why it interested me. ;) I've done more and more work analyzing the deobfuscated Minecraft code lately and I'm feeling more comfortable with it now. So it was an interesting challenge to figure out. :) But don't get too excited until you confirm it really works like you expect it to! :)
     
  28. Offline

    ssechaud

    Is there a way to make it so that the plugin will only allow sleep to force day time if two people are in bed? But if there is less than 2 people online, to make it use 50% so that if only two people are online then it will only require one person to be in bed. Something like: if player_count <= force_sleep_count then use force_sleep_percentage, know what I mean?
     
  29. Offline

    EdGruberman

    @ssechaud - At this point, no. I'll see if I can figure out how to allow one to configure such simply. It's almost as if we'd need "force profiles" for different circumstances.

    Code:
    force:
        lessPlayers:
            minimum: -1
            maximum: 2
            count: -1
            percent: 50
        morePlayers:
            minimum: 3
            maximum: -1
            count: 2
            percent: -1
    That seems overly complex though. I wonder if there is a simpler solution I'm overlooking...
     
    ssechaud likes this.
  30. Offline

    ssechaud

    Would this not work?

    if player_count <= force_sleep_count
    then use force_sleep_percentage
    else use force_sleep_count
     
  31. Offline

    EdGruberman

    Actually that makes perfect sense, I'm not sure why I glossed over it originally. I'll see if I can get it updated here soon.

    What about logically ORing the two requirements together instead of logically ANDing them? Basically just taking the lower of the two requirements and forcing sleep if that is met. I just threw the feature in initially without a lot of thought honestly. I think I assumed most people would use one or the other, not both together. But now that I think more on it, it almost seems like more use cases would benefit from ORing.

    This will satisfy the use case presented by @ssechaud but does anyone else use it differently?

    Here is a sample of how this logic would work:
    count: 4 percent: 50
    (inbed/possible = needed)
    0/1 = 1
    0/2 = 1
    0/3 = 2
    0/4 = 2
    0/5 = 3
    0/6 = 3
    0/7 = 4
    0/8 = 4
    0/9 = 4
    0/10 = 4

    Well here is 3.1.0b2 - https://github.com/EdGruberman/Sleep/raw/master/dist/Sleep.jar

    Give it a try!

    Only change for this version is:
    CHG: Force count and force percent used together will force if either requirement is met.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 14, 2016

Share This Page