[MISC] SleepAnnounce v1.2.2 - Sleep/Awake Announcer/Report [1.4.5-R0.2]

Discussion in 'Inactive/Unsupported Plugins' started by sgtbigman, Mar 25, 2011.

  1. Offline

    sgtbigman

    SleepAnnounce - Sleep/Awake Announcer/Report
    Version: v1.2.2
    PermissionsBukkit, MultiVerse, and DispNameChanger support!

    A simple plugin to check who is asleep or not in your server. Made/updated with the request and great suggestions of JTR1988, further requests of michael05242002, and other great suggestions/tips by others of the bukkit community:cool:. My first plugin.

    Features (open)

    • Configurable sleep/awake announcements.
    • Configurable listing of players asleep/awake.
    • config.yml for easy configurations.
    • Op-only setting if PermissionsBukkit is not detected.


    Commands (open)

    • /sleeping [all|worldname]:
      • Lists players sleeping (and awake if this is set in the config) on current world (all worlds if from command line).
      • <all> or <*> option displays all players in all worlds in the server.
      • <worldname> option. Replace with actual name of world. Displays players in the specified world.
        • Shorthand capability.
      • Aliases:
        • /sl, /slp, /sleep
    • /announce <sleep|awake>:
      • Change whether sleep/awake announcements are displayed.
        • If on, switches to off (and vice versa).
      • Alias:
        • /an


    Permissions (open)

    • sleepannounce.list.default - Allows a player to use /sleeping without [all|world].
    • sleepannounce.list.all - Allows a player to use /sleeping all.
    • sleepannounce.list.world - Allows a player to use /sleeping worldname, where worldname is replaced with the actual name of the world.
    • sleepannounce.announce.sleep - Allows a player to toggle the sleep announcement.
    • sleepannounce.announce.awake - Allows a player to toggle the awake announcement.
    Parent nodes:

    • sleepannounce.list.* - Allows player to use all /sleeping variants.
    • sleepannounce.announce.* - Allows player to use all /announce variants.
    • sleepannounce.* - Allows player to use all SleepAnnounce commands.


    Changelog (open)

    Version 1.2.2
    • Updated code to work with latest build.
    Version 1.2.1
    • Fixed announcement bugs (coloring conflict with DispNameChanger).
    • Added the ability to use shorthand on /slp [worldname] command.
    • Added
    • as an alternative to the [all] in /slp [all].
    Version 1.2.0
    • Added PermissionsBukkit support!
    • Removed Permissions 3.x support.
    • Added DispNameChanger support!
    • Cleaned up code.
    Version 1.1.0

    • Added MultiWorld support!
    • /sleep - now displays only those players in the sender's world (if the sender is a player).
      • If the sender is not a player, /sleep displays all players in all worlds.
    • /sleep all - displays all players in all worlds.
    • /sleep <worldname> - Displays players in specified world.
    Version 1.0.0

    • Added Permissions support!
    • If SleepAnnounce/config.yml does not exist, the .jar creates/fills it now.
    • Add /announce <sleep|awake> command which allows players/admin to change whether sleep/awake announcements are broadcast to the server.
    • Some code cleanup.
    • First "Major" release: Everything requested is in the plugin now.
    • Thank you for your continued help/support!
    Version 0.3.6

    • Changed version format to Major.Minor.Non-critical
    • Fixed spacing between playername1,playername2 to playername1, playername2
    • Also added a comma at end of awake players list before sleeping players list.
    • Tested against latest craftbukkit build (677) - Works.
    • Non-critical update - just fixed a little display error.
    Version 0.35

    • Cleaned/Tidied up the config file for ease of reading/use.
    • Used updated Craftbukkit code which deals directly with beds! (They must have known what I was working on and what you guys wanted). :p
      • This helped with announcements working as they should.
    • Added aliases to the /sleeping command: /sl, /slp, and /sleep.
    • Added an announcement for awaking players (toggable). ({Player} has awoken.)
    Version 0.3

    • Added config file (/SleepAnnounce/config.yml) to allow easy configuration by admins.
    • Updated code to work with config file and work with latest recommended build (617).
    Version 0.2

    • Added ability to turn announcements on/off and check status (on/off).
    • Added ability to display sleeping/awake players in a colored list (red: sleeping/green: awake). If /sleeping color off, default two lists display (sleeping: (names) & awake: (names)).
    Version 0.1

    • Release


    Download SleepAnnounce v1.2.2
    Source Code

    Latest build: Compatible with CB[1.4.5-R0.2].
     
  2. Offline

    Kahl

    Thanks for release :)

    Can't wait for that Permissions support
     
  3. Offline

    JTR1988

    Awesome!
     
  4. Offline

    Maxis010

    Can you add the option to switch /sleeping between op and everyone while we wait on permission support, it's the only thing stopping me from installing this plugin
     
  5. Offline

    sgtbigman

    added :D
    op-only: true (or false)....in config.yml file.
    - Just download the entire .zip since I had to update the .jar and config.yml
    Temporary fix until I implement permissions [creeper]
     
  6. Offline

    MineralMC

    Any chance to give the option to set the 'players asleep' text to appear on a new list? I'm wanting it to display this way:

    There are currently {NUMSLEEPING} of {NUMPLAYERS} players asleep:
    {SLEEPINGPLAYERLIST}'
     
  7. Offline

    Pontus Lantz

    Downloaded latest SleepAnnounce and it seems to work great but just wanted to post some error code i get on my server
    Code:
    2011-04-06 21:20:59 [INFO] SleepAnnounce version 0.25 is enabled.
    2011-04-06 21:20:59 [SEVERE] Name is null loading SleepAnnounce v0.25 (Is it up to date?)
    java.lang.NullPointerException: Name is null
        at java.lang.Enum.valueOf(Unknown Source)
        at org.bukkit.ChatColor.valueOf(ChatColor.java:9)
        at com.sgtbigman.SleepAnnounce.SleepAnnounce.loadSettings(SleepAnnounce.java:101)
        at com.sgtbigman.SleepAnnounce.SleepAnnounce.onEnable(SleepAnnounce.java:71)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:118)
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:514)
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:216)
        at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:94)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:72)
        at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:215)
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:202)
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:142)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:257)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
     
  8. Offline

    sgtbigman

    -MineralMC: You can change that message (special-message) to whatever, just make sure that the {NUMSLEEPING} {NUMPLAYERS} {SLEEPINGPLAYERLIST} are in it somewhere because the plugin fills those in whenever /sleeping is used with sleep-only: true in config

    -Pontus: that seems to be a color value error in the announce: color area of the config:

    announce:
    broadcast: true
    message: '{Player} went to sleep.'
    #
    #Specify one of the following: BLACK, DARK_BLUE,
    #DARK_GREEN, DARK_AQUA, DARK_RED, DARK_PURPLE, GOLD,
    #GRAY, DARK_GRAY, BLUE, GREEN, AQUA, RED, LIGHT_PURPLE
    #YELLOW,WHITE
    #
    color: 'BLUE'

    - just make sure it is one of those values (BLUE,BLACK, etc.) that I have listed in the config.
     
  9. Offline

    Maxis010

    Thank ye good sa, installing now
     
  10. Offline

    MineralMC

    I literally meant being displayed in that manner, with the sleeping player list on a new line - can we have a special character to introduce a linebreak? ; or somesuch?
     
  11. Offline

    sgtbigman

    updated, just use the ; (semicolon) character inside the message wherever you want a newline.
    Again, just download the entire .zip.
    Hope that helps :cool:
     
  12. Offline

    JTR1988

    Man, you got pretty much everything in here we talked about. Tested it out, it's simply amazing, great job man!
     
  13. Offline

    MineralMC

    Thanks for the quick update and the new line function, mate! :)
     
  14. Offline

    Kahl

    If i right click a bed, even if it is occupied it announces I went to sleep. And it i click it like 3 times before minecraft actually lays me down, it says I went to sleep 3 times.

    Is there a way to make it only announce this when you have successfully entered a bed?
     
  15. Offline

    MineralMC

    A cooldown timer per player would get around this nicely. It's impossible to sleep legit 3 times in succession over say... 5 minutes.
     
  16. Offline

    Kahl

    Thats a good point. There should also be an announcement "User has left their bed" when a user leaves their bed, which would reset the timer so a sleep announcement could be made again.
     
  17. Offline

    michael05242002

    It works perfectly! Thanks! I like the config file very much :)
    Suggestions:
    • add cooldown time(about 5 sec/configurable) for announcement - someone sleep and awake alternately to spam the chat column.
    • make a shorter command, or even a configurable command(or it is impossible?) - /sleeping is long for lazy people :D However, please don't make it like /s, because the "stackable" plugin has the same command. Maybe /sl or /ss is better.
     
  18. Offline

    sgtbigman

    Ahh yes I need to find a better way of implementing the announcement :eek:
    I'll look into fixing that and making an alias for the /sleeping command. The reason I hadn't set one yet is because I know that there are popular plugins that might use /s, etc, and I did not want my little plugin to mess with the more important ones. Would /sl or /ss or even /slp work for everyone?
     
  19. Offline

    sgtbigman

    updated to version 0.35
    - Added aliases: /sl, /slp, /sleep
    - Cleaned up config file for ease of use
    - Code works more directly with beds and players in sleeping/not states.
    - This directly helped with announcement issues some of you had earlier. (If you still want a timer though, this will be in the next update).
    - Added an announcement for players awaking from their slumber.

    As always, feedback is welcome and helps make this plugin better.
    Enjoy! :cool:
     
  20. Offline

    Maxis010

    I found a problem, it's name is Multi World

    To be specific SleepAnnounce can't handle it, if people sleep in the default world then SleepAnnounce will run just fine, if someone sleeps in an alternative world or anyone tries to use /sleeping or it's aliases then it fires an internal error

    Found this out about 5 minutes ago when someone was bitching about needing to sleep through the night (we have really long nights) and when I tried /sleeping it freaked out

    Not a key feature, heck in a few days it won't even be a problem for me but other Multi World users would appreciate it, plus you get to stick multiworld compatible in your title for a shameless advertisement :D
     
  21. Offline

    sgtbigman

    hey Maxis, what exactly do you have setup multi world-wise so that I can test this on my end? Also, if its not too much to ask, could you copy/paste the error(s) it throws?
    Much appreciated, good sir!
     
  22. Offline

    Maxis010

    MultiVerse v1.6.2 = Handles the MultiWorld
    world = default world, sleep announcement work here
    newworld = generated world, sleep announcements fail here

    Multiple errors thrown, here is the server logs

    Entering a bed
    Code:
    2011-04-08 18:22:06 [SEVERE] Could not pass event PLAYER_BED_ENTER to SleepAnnounce
    java.lang.NullPointerException
        at com.sgtbigman.SleepAnnounce.SleepPlayerListener.onPlayerBedEnter(SleepPlayerListener.java:29)
        at org.bukkit.plugin.java.JavaPluginLoader$20.execute(JavaPluginLoader.java:318)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:255)
        at net.minecraft.server.EntityHuman.a(EntityHuman.java:562)
        at net.minecraft.server.EntityPlayer.a(EntityPlayer.java:228)
        at net.minecraft.server.BlockBed.a(SourceFile:56)
        at net.minecraft.server.ItemInWorldManager.a(ItemInWorldManager.java:216)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:447)
        at net.minecraft.server.Packet15Place.a(SourceFile:57)
        at net.minecraft.server.NetworkManager.a(NetworkManager.java:198)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:72)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:368)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:283)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
    Leaving a Bed
    Code:
    2011-04-08 18:23:40 [SEVERE] Could not pass event PLAYER_BED_LEAVE to SleepAnnounce
    java.lang.NullPointerException
        at com.sgtbigman.SleepAnnounce.SleepPlayerListener.onPlayerBedLeave(SleepPlayerListener.java:39)
        at org.bukkit.plugin.java.JavaPluginLoader$21.execute(JavaPluginLoader.java:324)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:255)
        at net.minecraft.server.EntityHuman.a(EntityHuman.java:666)
        at net.minecraft.server.EntityPlayer.a(EntityPlayer.java:242)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:693)
        at net.minecraft.server.Packet19EntityAction.a(SourceFile:34)
        at net.minecraft.server.NetworkManager.a(NetworkManager.java:198)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:72)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:368)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:283)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
    
    /sleeping + Aliases
    Code:
    2011-04-08 17:39:51 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'sleeping' in plugin SleepAnnounce v0.35
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:80)
        at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:254)
        at net.minecraft.server.NetServerHandler.c(NetServerHandler.java:596)
        at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:559)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:553)
        at net.minecraft.server.Packet3Chat.a(SourceFile:24)
        at net.minecraft.server.NetworkManager.a(NetworkManager.java:198)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:72)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:368)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:283)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
    Caused by: java.lang.NullPointerException
        at com.sgtbigman.SleepAnnounce.SleepingPluginCommand.onCommand(SleepingPluginCommand.java:67)
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
        ... 12 more
    If you want I don't mind using this server as a bug tester if you can get it working on your end
     
  23. Offline

    sgtbigman

    all right I will look into that. Thanks for the quick response. Don't worry too much about waiting around for me right now cause I am actually playing minecraft with my brothers and thus am not going to be fixing this bug right this minute. I'll let you know when I get around to it...later tonight or tomorrow. Shouldn't be too hard to fix.
     
  24. Offline

    Maxis010

    I've unloaded SleepAnnounce for now so I'm not about to refresh the topic every 10 seconds waiting for a fix, take your time and enjoy minecraft, that is the idea
     
  25. Offline

    sgtbigman

    I tested with multi verse latest and it works fine for me...do you have latest version of SleepAnnounce? Let me know if it is still throwing these errors.
     
  26. Offline

    Maxis010

    SleepAnnounce v0.35
    Bukkit #670
    When attempting to work outside of the default world it freaked out, I'll give it another test tomorrow
     
  27. Offline

    Maxis010

    Just now got around to this after cleaning up the server owners mess (he deleted all worlds and broke permissions then told a dozen people to bitch about it to me)

    Seems SleepAnnounce doesn't like /reload, had to do a server restart, haven't been able to get in to multiworld after the above but so far as I can tell the errors from the /reload are the same as the errors I reported, mystery bug busted I suppose as any /reload after the server restart went off without a hitch
     
  28. Offline

    Strahan

    When I do /sleeping, the list of players is all crammed together. A comma delimited list would be much more visually appealing :)
     
  29. Offline

    Maxis010

    There are commas but no spaces, sgtbigman do you mind adding spaces after the comma, oh and stick a comma on the end of the awake list so there is a comma and space between the awake and the asleep (prefix-only & sleeping-only = false)
     
  30. Offline

    sgtbigman

    Thanks for pointing that little display problem out. I fixed it but my server is down at the moment. I will put the fixed version up ASAP and will let everyone know. Thanks for waiting :rolleyes:
     
  31. Offline

    ksevelyar

    Version 0.35 + cb670
     

Share This Page