[MECH] LightSensor v0.9 - Light dependant levers [1185]

Discussion in 'Inactive/Unsupported Plugins' started by Tiramon, Feb 25, 2011.

  1. Offline

    Tiramon

    I know this sounds exactly like iLDR, but because iLDR never worked for me i wrote my own.

    The basic idea is to turn redstone circuits on and off dependant on the surrounding light.
    For example to close doors at night or something like that. Or what i want to do in combination with ControllerBlock fade out my torches at day and fade them in aga in at night.

    How to:
    Just hit a lever with a redstone torch to turn it into a LightSensor. From now on it will automatically turn on if the lightlevel of the lever is equal or less to the configured value (default: 7) and turn off again as soon as the light level increases above the configured value.
    Each LightSensor can be configured with a separate value.
    If you right click a LightSensor it shows you the configured value and the current lightlevel. If you right click the lever again within 2 seconds the configured value is increased by one (if 16 would be reached it steps down to 1)

    Currently i check all 2 seconds the lightlevel of all registered LightSensors

    LightSensor v0.9 Download

    Features:
    - automatically downloads sqlite.jar if needed
    - each lever can get his own configuration
    - lever turns on when light level is equal or less the configured value
    - lever turns off when light level is above the configured value
    - configurable check interval (default 2seconds)
    - configurable default light sensitivity (default 7)

    TODO:

    Known Issues:
    - Sensor attached to sand or gravel are not deleted when the block falls down and so unattaches the lever

    Changelog:
    Version 0.9
    -Only interact with a LightSensor when the chunk is loaded
    -deleting the lightsensor from db when the block where the sensor should be is not a lever
    -Hopefully fixed the classcast of post #77

    older Changelog (open)

    Version 0.8
    - making it working again with b1000

    Version 0.7
    - catching ConcurrentModificationException in LightSensorThread
    - closing database connection in onDisable

    Version 0.6
    - removed spaming debug output
    - fallback method for byId return value is null
    - NullPointer Check in LightSensorPlayerListener:19

    Version 0.5
    - sensor check is disabled while no player is online, this fixes the reported bug on disconnect of last player
    - adapted to event changes in b561

    Version 0.4
    - configurable check interval (default 2sec)
    - configurable default value (default 7)
    - fix for the not working redstone

    Version 0.3
    -fixed Bug with new implemented Physics
    -fixed lever switching and this way attaching the lever to another wall
    -sensors attached to a broken block are now deleted correctly

    Version 0.2
    -removed unsed command and so removed PLAYER_COMMAND
    -bugfix: if a block where a lightsensor is put on was destroyed the sensor wasn't deleted (because i can't get the user involved in destroying the sensor, i make an log output 'LighSensor deleted by Physics' )

    Version 0.1
    First Release


    Forgot to add bukkit build in the title, if someone who can change the title could please add the [440]

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

    darknesschaos

    look for the link called thread tools above your post, you should be able to change the title from there.
     
  3. Offline

    unrivaledneo

    I was waiting for this, since the old one didnt work for me either. Nice!
     
  4. Offline

    RecoJohnson

    I suggested this on Mojang! :D
    Thanks for making it! :)
     
  5. Offline

    Phanku

    Bump for CB higher than 440
     
  6. Offline

    Tiramon

    I was waiting for a new recommended build before upgrading.
    And in the end i missed it ;)

    Will have a look at it this evening
    --- merged: Mar 5, 2011 10:08 PM ---
    0.2 was buggy
    Here is a fixed version now
     
  7. Offline

    ErMurazor69

    Is this plugin dead? I've been waiting for a fix to show up for a while.... the plugin kinda works at least in the way the switch moves up and down with the light levels. But it never actually turns the redstone on or off so it doesn't really do anything since doors don't close, or in my case my portcullis doesn't go up or down.
     
  8. Offline

    Teodin

    Since we switched to Bukkit #531 the plugin does not work anymore. According to server log it is enabled, but a click with a redstone torch does nothing. Are there known Issues with MultiVerse or MinecartMania? Maybe it just need to be updated.
     
  9. Offline

    Matazat

    Would it be possible to make the interval that it checks the light levels configurable?
     
  10. Offline

    Tiramon

    I know this problem for a while and i'm testing what has changed in the last versions that could affect this.

    By now i have not idea what is happening and why the plugin does not work anymore
    I will test some more ideas now. Got some new ideas ;)
     
  11. Offline

    Tiramon

    Ok got some progress in debuging

    The Sensor works fine when the redstone wire is directly attached to the lever

    If you place
    [stick][grass][torch]

    Lever|some block|redstone wire

    it works if you use it as a lever, but if you place a lightsensor like this it switch like planed, but does not energize the redstone wire.

    I will try to have a close look at this now

    even isBlockPowered and isBlockPoweredIndirectly show the right data ...
     
  12. Offline

    but2002

    The plugin works for me, but after a while the sensors "die" and they don't break. They're stuck in whatever state they 'died' at. If I break them and replace them, the levers get stuck back in that same position that it got locked into. Deleting won't erase the light sensor, and doing anything with a redstone torch does absolutely nothing.
     
  13. Offline

    Tiramon

    I will have a look at it, but by now i can't reproduce the bug ... what bukkit build are you running?
    Or maybe what other plugins are you using?

    Have you done anything special before the sensors 'die'?
    What means 'after a while'? few minutes/hours/days?
     
  14. Offline

    but2002

    It happens after a few minutes, like 20 minutes.
    I'm running a decent amount of other plugins, but I can't list them all at this exact moment.

    When the light sensor stops working appropriately, the lever morphs into a hardly recognizable shape.
     
  15. Offline

    Tiramon

    was standing 2h near a sensor and watched it turn on and off again
    no problems found ...
     
  16. Offline

    Teodin

    It's the same bug I tried to explain in the past.

    Now I get this Message in Server.log:
    Code:
    2011-03-27 16:40:43 [SEVERE] Exception in thread "LightSensor check"
    2011-03-27 16:40:43 [SEVERE] java.lang.NullPointerException
    2011-03-27 16:40:43 [SEVERE]     at de.tiramon.bukkit.lightsensor.Sensor.interact(Sensor.java:154)
    2011-03-27 16:40:43 [SEVERE]     at de.tiramon.bukkit.lightsensor.Sensor.check(Sensor.java:143)
    2011-03-27 16:40:43 [SEVERE]     at de.tiramon.bukkit.lightsensor.LightSensorList.check(LightSensorList.java:82)
    2011-03-27 16:40:43 [SEVERE]     at de.tiramon.bukkit.lightsensor.LightSensor.check(LightSensor.java:215)
    2011-03-27 16:40:43 [SEVERE]     at de.tiramon.bukkit.lightsensor.LightSensorThread.run(LightSensorThread.java:22)
    We use Craftbukkit #556.
     
  17. Offline

    but2002

    It doesn't matter now. I use PailStone, and it suits my needs. <3
     
  18. Offline

    Swoosh Bear

    I get the same thing, but only when the only person on logs off. So for example, I'm the only one on the server, and I log off. That error will then pop up and kill the plugin.

    Using: CB 556, LightSensor v0.4
     
  19. Offline

    eagledude4

    How do I setup a light sensor to only turn on a lever at 8, but turn off at 1? I want a door that only opens during the night. (from 8-16 I believe is night time)

    I think you should add a configureable option that would allow a light sensor like this.
    Or atleast release the source code so I could do it myself.
     
  20. Offline

    Tiramon

    The sensor reacts on light not on the time.

    during the night
    so if you do not have any torches near the sensor it should have a lightlevel of 4 at night. if you have placed some torches near the sensor i will be higher.
    At daytime it should have lightlevel 15 if no blocks are placed above the senor.

    So basicly everything below 15 means that the night is coming.

    if you rightclick the sensor it also tells you his current amount of light received so you can adapt it to the correct level.
     
  21. Offline

    nala3

    epic, now all i need are floodgates!
     
  22. Offline

    Chris Lewis

    Love this plugin... update to 602?! PLZ!!!
     
  23. Offline

    Tiramon

    Almost updated for 1.4
    I just reconstructed the mentioned bug and even if i don't have an idea how to fix it i will try it after work today

    I don't know why
    Code:
    net.minecraft.server.Block.byId[block.getTypeId()]
    returns null after the last player disconnected

    but i just skip sensor checks when no player is online, it's senseless anyway

    should be working with last recommended build (617) or b561 up to current recommended build

    Ok now i can also reproduce those strange floating levers ...
    I know why i looks so strange but i have no idea how it reachs this state ...

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

    Chris Lewis

    I am using CB 617 and the latest version of this plugin and i get the error:
     
  25. Offline

    Hiramas

    Hey, could you PLEASE remove this console spam:
    Code:
    11:12:13 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:15 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:17 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:19 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:21 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:23 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:25 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:28 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:30 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:32 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:34 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:36 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:38 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:40 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:42 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:44 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:46 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:48 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:50 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:52 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:54 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:56 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:12:58 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:00 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:02 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:04 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:06 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:08 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:10 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:12 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:14 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:16 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:18 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:20 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:22 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:24 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:26 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:28 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:30 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:32 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:34 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:36 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:38 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:40 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:42 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:44 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:46 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:48 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:50 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    11:13:52 [INFO] [LIGHTSENSOR] No Player online. Skipping LightSensor check
    >
    
    
    Otherwise good work.
     
  26. Offline

    Tiramon

    that was debug output will be removed asap
    but first i want to have a look at the Nullpointer mentioned above
     
  27. Offline

    Chris Lewis

    More information on my error, this seems to be happening when i use the feather from the Tele++ plugin to teleport around my world. Right click somewhere teleports me to that location and results in this error from LightSensor
    This also causes huge lag spikes on the server.
     
  28. Offline

    Tiramon

    All above errors should be fixed
     
  29. Offline

    Chris Lewis

    Thank you for the update. Fixed my problem :)

    well.... sorta.... if i reload the server using the reload command I get this error:

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

    Tiramon

    k ... didn't even know there is a reload command ...

    i'll have a look at this

    onDisable is not correct ... maybe i should close the database connection there ;)
     

Share This Page