Inactive [MECH] Lampstone/Timeblock v1.0 - Automatic night-time ANYTHING [1060]

Discussion in 'Inactive/Unsupported Plugins' started by Izze, Mar 4, 2011.

  1. Offline

    Izze

    Lampstone - Automatic night-time lamps ANYTHING
    Version: v1.0

    This plugin lets you place any block which turn into another block type in the morning, and then turns back into the first block type in the evening. This lets you build nice looking lamp posts which turn themselves off in the morning and stuff like that.

    Feutures:
    • Adds the /lampstone command, which enables and disables lampstone mode
    • Use any block type for both day and night.
    Screenshots:
    [​IMG]
    [​IMG]

    Screenshots taken with a modified version of Painterly pack, to match glowstone and glass texture.

    Download Lampstone v1.0 here!
    (Mirror)

    Instructions:
    1. Download Lampstone.zip above
    2. Open Lampstone.zip
    3. Place everything inside Lampstone.zip in your plugins folder. This should include: Lampstone.jar and a folder called Lampstone, with the files called lampstoneLocations.yml and lampstoneProperties.yml inside.
    4. If you want to change the default properties, open up lampstoneProperties.yml.
    5. In lampstoneProperties.yml, change numbers behind blockDay and blockNight to your liking. (It should be block IDs, default is 20 (glass) in the day and 89 (lightstone) in the night.)
    6. Save lampstoneProperties.yml (if you changed it) and run the server
    7. To enter lampstone mode, enter "/lampstone" in the chat
    8. When in lampstone mode, place a block of the type you specified as blockNight in lampstoneProperties.yml anywhere. If you didn't change any properties, this is a glowstone block. A message in the chat should tell you that a lampstone block has been created.
    9. If you want to use another block combiantion than the defaults (the ones in the configuration file), you use the command like this:
      /lampstone [blockDay] [blockNight]
    10. To exit lampstone mode, simply enter "/lampstone" in the chat again
    Permissions:
    • Lampstone.create (self-explanatory)
    • Lampstone.break (self-explanatory)
    Changelog:
    Version 1.0
    • You can now select any block type for both day and night.
    Version 0.8
    • Fixed a lot of bugs reported by xGhOsTkiLLeRx.
    Version 0.6
    • Checks if the chunk is loaded before it tries to change the block type of a lampstone.
    • Tells you how many lampstones that were loaded at server startup.
    Version 0.5
    • Console outputs a message if it fails to load a block from the lampstoneLocations.yml file. This is for bug catching purposes.
    Version 0.4
    • Fixed bug where properties didn't work. Thanks to SuperThaTom for telling me.
    • Checks so that your properties are valid on initialization.
    Version 0.3
    • Fixed bugs
    • Files creates themselves
    • Warning: BREAKS YOUR V0.2 LAMPSTONES!!
    Version 0.2
    • Added lampstoneProperties.yml
    • You can now choose which blocks should be lampstones
    Version 0.1
    • Initial release
    Known bugs:
    • If you forget to create or remove the contents of lampstoneLocations.yml, the plugin will fail to initialize. Help needed and appreciated! Fixed with help from Nohup! Many thanks!
    • Breaks after a while for some people.
     
    Emiya Shirou, nova779 and MuttsNuts like this.
  2. Offline

    xGhOsTkiLLeRx

    Read EDIT 2!!

    Uff,

    you really want a list of all my plugins?

    CB Build: 793 (but also tested on 766)

    Code:
    AnyoneSleep
    Backup
    Bandages
    BedrockControl
    BloksOnGlass
    ChocolateFever
    ColorMe
    CraftBukkitUpToDate
    DeathTpPlus
    EggPlugin
    Essentials
    EssentialsSpawn
    FakeMessage
    FenceStack
    FishPeople
    -private plugin to get locations of somebody-
    GetWolfOwner
    GlassPlugin
    GlowstoneDrop
    Growbie
    HeroSneak
    IceDop
    iChat
    MobRider
    MultiHome_m
    NetherPortal
    NSCommand
    PasswordProtect
    Permissions
    PorteCoulissante
    RetractableBridge
    SendGift
    SimpleSignEdit
    SpawnMob
    UC (Unknown Command)
    Greetings

    Edit: My lampstones are at the day glass and in the night glowstone
    I'll test it without BlocksOnGlass and GlowstoneDrop!
    -> same result!

    Edit2:

    I removed all my plugins and tested to destroy a lampstone block.
    Here is my error :D (Yay, I think errors are good atm!)

    Code:
    2011-05-18 15:02:15 [SEVERE] Could not pass event BLOCK_BREAK to Lampstone
    java.lang.NoClassDefFoundError: com/nijiko/permissions/PermissionHandler
        at se.Izze.Lampstone.LSBlockListener.onBlockBreak(LSBlockListener.java:20)
        at org.bukkit.plugin.java.JavaPluginLoader$34.execute(JavaPluginLoader.java:475)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:302)
        at net.minecraft.server.ItemInWorldManager.d(ItemInWorldManager.java:156)
        at net.minecraft.server.ItemInWorldManager.b(ItemInWorldManager.java:118)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:446)
        at net.minecraft.server.Packet14BlockDig.a(SourceFile:42)
        at net.minecraft.server.NetworkManager.a(NetworkManager.java:196)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:377)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:292)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:394)
    Caused by: java.lang.ClassNotFoundException: com.nijiko.permissions.PermissionHandler
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:36)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:24)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 14 more
     
  3. Offline

    woodzy

    oh this needs a mini update me thinks
     
  4. Offline

    ShadoRoboto

    How come this isn't in the inactive plugin thread? According to the title it is incredibly outdated, and it is giving me problems on 766.
    Just a thought.
    ~SR
     
  5. Offline

    belfedia

    We're waiting some fix, but programing isn't easy ;) patience !
     
  6. Offline

    Izze

    Oh, I hate it when the forum software decides to stop giving me alerts. Why is that?

    I'm sorry, I haven't had any time at all for a while, because of school and stuff. I don't know when I'll have time to go through the plugin and fix it, but I hope it'll be soon.
     
  7. Offline

    dak393

    Can't wait :)
     
  8. Offline

    Plague

    cb 677 - inactive
     
  9. Offline

    dak393

    Plague strikes again XD jk
     
  10. Offline

    Kevin C.

    Doh!
     
  11. Offline

    MuttsNuts

    Yeah not cool! Still dont understand why its working on my fully up to date server. lol. Lets hope it gets fixed up soon eh!
     
  12. Offline

    Kevin C.

    It seems to work in general for most folks, the only part I have trouble with is breaking them. Multiverse compatibility seems fine with the dev version, shared a few days back, which was a huge step forward...

    My only fear on this plugin is how it will scale. I have a feeling that if you get a few hundred lampstone out there, without mysql on the backend keeping track of em, turning the lights on and off will become pretty slow. Reading a large text file serially can hurt.
     
  13. Offline

    Izze

    No file reading is done when the server is running, only on startup. At startup, the plugin reads through the file and puts the locations in memory. Although, it's still pretty slow, because it's quite heavy to change the type of a block.
    I think that error occurs because it can't find permissions. I should add a check for that. Thanks!
     
  14. Offline

    xGhOsTkiLLeRx

    Yes, you could add a check!
    But why is your plugin looking for permissions?
    I thought, it's working without permissions!
    But btw. you could add a permissions for /lampstone
    (Or to place /destroy a lampstone!)

    Any progress with the "reappearing" of the lampstones?

    Greetings
     
  15. Offline

    Izze

    It should be working without permissions, but it seems like it doesn't.

    Oh shit, I just remembered something. You need permissions to break and place lampstone.

    Lampstone.break is needed to destroy lampstones and
    Lampstone.create is needed to place lampstones.

    I've fixed some stuff now. It should be working without permissions now.
    http://dl.dropbox.com/u/6118136/Minecraft/Lampstone/Test.Lampstone.jar

    I hope it works better now. I don't have time to try it.
     
  16. Offline

    xGhOsTkiLLeRx

    Hey,

    I'll post my test results:
    (CB: #798)
    (Lampsone 0.7, MD5: 2fe0ae9414553ad2b97dddc5000cccf9)

    Lampstone only (no other plugins):

    If I place a glass block (no /lampstone before!) and destroy it, my console gets this error:

    Code:
    2011-05-21 18:00:23 [SEVERE] Could not pass event BLOCK_BREAK to Lampstone
    java.lang.NoClassDefFoundError: com/nijiko/permissions/PermissionHandler
        at se.Izze.Lampstone.LSBlockListener.onBlockBreak(LSBlockListener.java:20)
        at org.bukkit.plugin.java.JavaPluginLoader$34.execute(JavaPluginLoader.java:475)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:302)
        at net.minecraft.server.ItemInWorldManager.d(ItemInWorldManager.java:156)
        at net.minecraft.server.ItemInWorldManager.b(ItemInWorldManager.java:118)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:446)
        at net.minecraft.server.Packet14BlockDig.a(SourceFile:42)
        at net.minecraft.server.NetworkManager.a(NetworkManager.java:196)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:377)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:292)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:394)
    Caused by: java.lang.ClassNotFoundException: com.nijiko.permissions.PermissionHandler
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:36)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:24)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 14 more
    Same for a glowstone block (first I place it, and then I destoy it!)

    Code:
    2011-05-21 18:02:40 [SEVERE] Could not pass event BLOCK_BREAK to Lampstone
    java.lang.NoClassDefFoundError: com/nijiko/permissions/PermissionHandler
        at se.Izze.Lampstone.LSBlockListener.onBlockBreak(LSBlockListener.java:20)
        at org.bukkit.plugin.java.JavaPluginLoader$34.execute(JavaPluginLoader.java:475)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:302)
        at net.minecraft.server.ItemInWorldManager.d(ItemInWorldManager.java:156)
        at net.minecraft.server.ItemInWorldManager.b(ItemInWorldManager.java:118)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:446)
        at net.minecraft.server.Packet14BlockDig.a(SourceFile:42)
        at net.minecraft.server.NetworkManager.a(NetworkManager.java:196)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:377)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:292)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:394)
    Seems like the plugin is still searching for Permissions!
    But the blocks don't reappear!

    If I try to break a lampstone block I get this error:

    Code:
    2011-05-21 18:23:46 [SEVERE] Could not pass event BLOCK_BREAK to Lampstone
    java.lang.NoClassDefFoundError: com/nijiko/permissions/PermissionHandler
        at se.Izze.Lampstone.LSBlockListener.onBlockBreak(LSBlockListener.java:20)
        at org.bukkit.plugin.java.JavaPluginLoader$34.execute(JavaPluginLoader.java:475)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:302)
        at net.minecraft.server.ItemInWorldManager.d(ItemInWorldManager.java:156)
        at net.minecraft.server.ItemInWorldManager.b(ItemInWorldManager.java:118)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:446)
        at net.minecraft.server.Packet14BlockDig.a(SourceFile:42)
        at net.minecraft.server.NetworkManager.a(NetworkManager.java:196)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:377)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:292)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:394)
    And the block reappears!
    BUT: I get a drop :(

    If I try to use /lampstone, when ONLY lampstone is active I get this error:

    Code:
    2011-05-21 18:04:57 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'lampstone' in plugin Lampstone v0.7
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:97)
        at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:278)
        at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:701)
        at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:666)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:660)
        at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:32)
        at net.minecraft.server.NetworkManager.a(NetworkManager.java:196)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:377)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:292)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:394)
    Caused by: java.lang.NoClassDefFoundError: com/nijiko/permissions/PermissionHandler
        at se.Izze.Lampstone.LSCommandListener.onCommand(LSCommandListener.java:23)
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
        ... 12 more
    Caused by: java.lang.ClassNotFoundException: com.nijiko.permissions.PermissionHandler
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:36)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:24)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 14 more
    Haha, lampstone can't handle that? ;)

    Also, the console says, that 0 lampstones are loaded, but if I switch the time, the lampstones are working!

    Next test:

    Lampstone and Permissions (2.7.4) (Just to tell it, I'm an admin with ALL permissions!)

    No errors, if I destoryed a glass/glowstone block without /lampstone

    If I enter /lampstone I can place lampstones & they are loaded correctly.
    But I can't destroy them! (The reappear after 1 second)
    And I'm still getting a glowstone dust back in the night!
    Also: The console says, there a 0 loaded lampstones (like before with only Lampstone.jar)

    Next test:

    Lampstone and Permissions (2.7.4) with only the following nodes: lampstone.create & lampstone.break

    Same results!

    Next test:

    Lampstone and Permissions (2.7.4) with the following nodes: NO NODES

    I can't access /lampstone (this is correct)
    But I can't place a glass or glowstone block!!!
    And of course, if I destroy a lampstone block, he reappears (this should correct also ;))
    And: I don't get a glowstone dust drop :)


    Sooooo, I think I tested some situations, if you have another one, just tell me!
    I guess you have some errors to fix now :)
    I wish you good luck & just tell me (or us) to test another build!
    (And sorry, if my English isn't the best, I'm German :))

    Greetings
     
  17. Offline

    Kevin C.

    Now granted, I'm not a plugin developer and I don't pretend to know java (I'm a C guy)..but how can it only read at server startup? If I go in and add more lampstone, that gets appended to the config file, and the next time a day/night cycle comes around, those are turned on/off too. So, something has to be reading that file as your play progresses.


    Regardless though, still same issue. Lampstone doesn't destroy, it just pops back up immediately, and it isn't removed from the locations.yml file.


    Thanks for continuing to hammer away at it.



     
  18. Offline

    NightKev

    In terms of reading the file into memory to use the lampstone data, it only needs to happen once, and then it stays in memory (RAM) until the server shuts down. You don't need to read in the whole file again when you already have it, and you can alter it in-memory when lampstones are placed/destroyed to keep the copy in memory up-to-date.
    Writing to the file on disk is a different story. If you're placing a new block, he can just append to the end of the file (which doesn't require reading in the disk copy into memory again, so only disk output cost is incurred) and that's that (iirc). Modifying contents in the middle does require reading the file again, but it doesn't have to occur each time a lampstone is destroyed and can instead be scheduled after a certain number are destroyed or perhaps when the server quits (though this carries the risk of changes not being saved if the server crashes or somesuch before the scheduled write time).
    Also, none of this is language-dependent, so your claim of only knowing C instead of Java is irrelevant. ;)
     
  19. Offline

    Kevin C.

    False. It is true if java tends to read files differently...which is what I claimed I didn't know. So...eff off.

    Not to mention, that is more dependant on how bukkit (OR the plugin) handles things anyways...I don't know how he wrote the flippin thing, and I don't have time or the inclination to dig through the code (if it was provided). The reason I said I know C and not Java was, I can't read object-oriented code, because it makes no sense to me. I can't read things at that high level...I'm more at the system call layer. If you want me to write plugins, I couldn't. Want me to write complex Xwindows GUIs using Motif primatives, I can. Want me to write a filesystem from scratch? I can. Need me to write shell scripts that would make most java programmers puke trying to figure what it does? I can. So...as per my first line...eff off.
     
  20. Offline

    NightKev

    In C you can't keep a file in memory...?
     
  21. Offline

    Kevin C.

    You can, but it depends on how you write the damn code. I can write it to either keep it in memory, or re-read it every time I need to do something, bad programming, but again, its back to how it was WRITTEN.
     
  22. Offline

    NightKev

    Okay, so then my original post still stands; he said he only needs to read it into memory once, therefore he must have written it such that he doesn't discard it for no reason via bad programming.
     
  23. Offline

    Kevin C.

    ok, but then i say its the inneficiency of java itself. It sure *feels* like it is a file being read all the time, when it take 10 seconds to cycle through my lampstone to turn it on/off. Which goes back to my original statement about a database.

    anyways, I'm done arguing semantics...

    @Izze, if you can get it working where you can break 'em and have them removed from the map, I'll be interested. Best of luck!

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

    NightKev

    Arguably, it would be better with a light database (perhaps... SQLite?), but apparently in MC (bukkit) servers, changing a ton of blocks at once is a heavy cost (see: his post).
     
  25. Offline

    Izze

    Yeah, like everyone says, I just read the file at startup and put all locations in an ArrayList. Then, if a new lampstone block is placed I append the location to the file. If a block is destroyed I read through the file to find a node containing that location and then remove it. It isn't very optimised, but I don't think it's neccessary to optimise that part right now. :)
    Also, I'm not at all good at Java. I think it's a bit weird at times. I'm more of a C++ programmer.

    @xGhOsTkiLLeRx That's a BIG help! Thank you very much! I'll try to continue working on this tomorrow.
    Thanks to everyone for the help! I'm so sorry that I have so little time to work on this! You guys are very motivating! :)
     
  26. Offline

    xGhOsTkiLLeRx

    You're welcome ;)
    Tell me, if I should test a new build :)

    Greetings
     
  27. Offline

    Tealk

  28. Offline

    xGhOsTkiLLeRx

    Hey,
    I will test it out, once my server is running to 100% again ;)

    (Because of some big issues, it's running very, very slow and laggy/buggy ://)
     
  29. Offline

    TruffleDucks

    Please make this active again. Nighttime in my streets looks ugly now in day
     
  30. Offline

    Juze

    Works fine on #803.
     
  31. Offline

    Tarnacki

    i was just about to write that :D
     

Share This Page