[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

    Tiramon

    Sorry for the long break but i was busy with having a baby and so on ;)
    And a little desinterest in minecraft for a while

    But now it is working again
     
  3. Offline

    Arcwolf

    Congratulations on the baby, and thanks for updating. I held the fort down for ya ;)

    Now, I can move along. TTFN...
     
  4. Offline

    40540057

    these are not saved when the server restarts?
     
  5. Offline

    Tiramon

    they should be i haven't changed anything at the persistence part

    just tested definitly saved, even on server restart
     
  6. Offline

    40540057

    23:03:11 [SEVERE] Exception in thread "LightSensor check"
    23:03:11 [SEVERE] java.lang.ClassCastException: net.minecraft.server.Block cannot be cast to net.minecraft.server.BlockLever
    23:03:11 [SEVERE] at de.tiramon.bukkit.lightsensor.Sensor.interact(Sensor.java:165)
    23:03:11 [SEVERE] at de.tiramon.bukkit.lightsensor.Sensor.check(Sensor.java:144)
    23:03:11 [SEVERE] at de.tiramon.bukkit.lightsensor.LightSensorList.check(LightSensorList.java:89)
    23:03:11 [SEVERE] at de.tiramon.bukkit.lightsensor.LightSensor.check(LightSensor.java:227)
    23:03:11 [SEVERE] at de.tiramon.bukkit.lightsensor.LightSensorThread.run(LightSensorThread.java:26)
     
  7. Offline

    Tiramon

    This should normally only happen if the block at the sensor location is not a lever ...
     
  8. Offline

    Belbertn95

    Nice plugin! But could you add a motion sensor? That's what I was looking for when I found this.
     
  9. Offline

    ggpanta

    Any change you could update this for 1060? It would be greatly appreciated.
     
  10. Offline

    Tiramon

    i will update it this evening
    What du you mean with motion sensor?
    presure plates activate when you are moving over them ... should be almost the same with the correct redstone circuit

    Seams to work for me on 1060 ...

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

    Chrisknyfe

    I have the exact same problem after restarting. I deleted the db and started over, and things are working fine now. However, this problem has me curious - is this plugin storing the world as well as the coordinates of the light sensor? Does this plugin support multiple worlds?
     
  12. Offline

    Thrain

    Hi I just started getting this error:

    Code:
    13:44:12 [SEVERE] Exception in thread "LightSensor check"
    13:44:12 [SEVERE] java.lang.ClassCastException: org.getspout.spout.block.mcblock.CustomBlock cannot be cast to net.minecraft.server.BlockLever
    13:44:12 [SEVERE]       at de.tiramon.bukkit.lightsensor.Sensor.interact(Sensor.java:165)
    13:44:12 [SEVERE]       at de.tiramon.bukkit.lightsensor.Sensor.check(Sensor.java:148)
    13:44:12 [SEVERE]       at de.tiramon.bukkit.lightsensor.LightSensorList.check(LightSensorList.java:89)
    13:44:12 [SEVERE]       at de.tiramon.bukkit.lightsensor.LightSensor.check(LightSensor.java:227)
    13:44:12 [SEVERE]       at de.tiramon.bukkit.lightsensor.LightSensorThread.run(LightSensorThread.java:26)
    >
    i'm using spout and spout essentials. I have tried deleting my db.. This error came on creating a new lightsensor
     
  13. Offline

    Tiramon

    Yes it does

    In my version i added a more comprehensable output ... but i still have no idea why this happens
     
  14. Offline

    Conraad

    On the latest build 1060 my lightsensors seem to turn around and you basicly see the back of the lever with the lever stuck in the wall it them completely stops working out of 3 sensors used 2 turned around and the 3rd stayed corrected but all 3 just stopped working all of them could still be adjusted for light sensitivity. Then you have to break them down and rebuild them again not sure whats causing this have loads of plugin

    -admittance
    -anticreeper
    -Autotool
    -Bedrock
    -Bigcatch
    -Blockcrusher
    -bookdrop
    -Chaircraft
    -Charcoalconverter
    -Citizens
    -Claygen
    -DeathandRebirth
    -Directbank
    -Dispenserbutton
    -DoorsOpenDoors
    -DoubleDiamonds
    -DwarfForge
    -Dynmap
    -Electriccraft
    -Essentials
    -EssentialsGroupBridge
    -EssentialsGroupManager
    -Fstbreaker
    -FlamingArrows
    -Fridges
    -Fruitfull
    -Glassreturn
    -Glasdrop
    -IConomy
    -IconomyDeath
    -InentorySave
    -InventorySort
    -ItemID
    -Jail
    -LavaForge
    -LeaveCraft
    -Lightsensor
    -LWC
    -LWC Economy
    -MeasuringTape
    -MineBackup
    -Movecraft
    -MoveInventory
    -Multiverse Core
    -Multiverse NetherPortals
    -Multiverse Portals
    -Nanobot
    -NarrowTuxlib
    -NaturalGiants
    -NoMoreRollBacks
    -ObisdianFlow
    -PayDay
    -PlantWithHoe
    -PorteCoulissante
    -RegionalWeather
    -Residence
    -ResidenceSigns
    -RetractableBridge
    -Seasons
    -Showcase
    -Signlift
    -SleepAnnounce
    -SpongeRestore
    -Squidlimiter
    -Streetlamps
    -Traincarts
    -VirtualChest
    -WolfPound
    -Worldborder

    The bukkit Plugins then also running Mo-Creatures, ICK Slopes, FancyPack and Industrial Craft 8.55 as mods

    If it's incompatibility it will take me forever to find the culprit is there anyone else experiencing same problem
     
  15. Offline

    Chromana

    @Conraad I have various bugs with this plugin, from it stopping working altogether to it only working when placed on certain blocks or in certain areas. I'm keeping it on my server because some of my users like it even if it is buggy, but I don't personally use it.
     
  16. Offline

    Conraad

    Yeah I just switch to falsebook did the same thing without bugs
     
  17. Offline

    Tiramon

    I have no idea why they turn around and disconnect from the wall ...

    Got a Version on my server which i'm currently testing
    Only interacting with the lever when the chunk is loaded
    deleting lever when the block where the lever should be is not a lever on init
    Hopefully fixed the classcast Thrain reported in post #77
    I will upload the version tomorrow
     
  18. Offline

    Tiramon

    Version 0.9 uploaded hope it fixes some of the problems
     
  19. Any chance you could make a side option for Time sensor? Sorta based on light but turns levers on and off depending on time of day?
     
  20. Offline

    Tiramon

    why not will have a look for the next version
     
  21. Offline

    Mrono

    I love this plugin but randomly I will get the error:
    Show Spoiler
    2011-10-26 07:15:14 [SEVERE] Exception in thread "LightSensor check"
    2011-10-26 07:15:14 [SEVERE] java.lang.NullPointerException
    2011-10-26 07:15:14 [SEVERE] at java.util.TreeMap.fixAfterInsertion(TreeMap.java:2134)
    2011-10-26 07:15:14 [SEVERE] at java.util.TreeMap.put(TreeMap.java:577)
    2011-10-26 07:15:14 [SEVERE] at java.util.TreeSet.add(TreeSet.java:255)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.c(World.java:1035)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.BlockDiode.doPhysics(SourceFile:159)
    2011-10-26 07:15:14 [SEVERE] at org.getspout.spout.block.mcblock.CustomBlock.doPhysics(CustomBlock.java:207)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.k(World.java:488)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.applyPhysics(World.java:463)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:49)
    2011-10-26 07:15:14 [SEVERE] at org.getspout.spout.block.mcblock.CustomBlock.doPhysics(CustomBlock.java:207)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.k(World.java:488)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.applyPhysics(World.java:465)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:49)
    2011-10-26 07:15:14 [SEVERE] at org.getspout.spout.block.mcblock.CustomBlock.doPhysics(CustomBlock.java:207)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.k(World.java:488)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.applyPhysics(World.java:468)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
    2011-10-26 07:15:14 [SEVERE] at org.getspout.spout.block.mcblock.CustomBlock.doPhysics(CustomBlock.java:207)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:49)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.k(World.java:488)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.applyPhysics(World.java:463)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:49)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
    2011-10-26 07:15:14 [SEVERE] at org.getspout.spout.block.mcblock.CustomBlock.doPhysics(CustomBlock.java:207)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.k(World.java:488)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.applyPhysics(World.java:468)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:49)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
    2011-10-26 07:15:14 [SEVERE] at org.getspout.spout.block.mcblock.CustomBlock.doPhysics(CustomBlock.java:207)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.k(World.java:488)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.applyPhysics(World.java:468)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:49)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
    2011-10-26 07:15:14 [SEVERE] at org.getspout.spout.block.mcblock.CustomBlock.doPhysics(CustomBlock.java:207)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.applyPhysics(World.java:464)
    2011-10-26 07:15:14 [SEVERE] at de.tiramon.bukkit.lightsensor.Sensor.interact(Unknown Source)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.k(World.java:488)
    2011-10-26 07:15:14 [SEVERE] at de.tiramon.bukkit.lightsensor.Sensor.check(Unknown Source)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.BlockLever.interact(BlockLever.java:161)
    2011-10-26 07:15:14 [SEVERE] at de.tiramon.bukkit.lightsensor.LightSensorList.check(Unknown Source)
    2011-10-26 07:15:14 [SEVERE] at de.tiramon.bukkit.lightsensor.LightSensor.check(Unknown Source)
    2011-10-26 07:15:14 [SEVERE] at de.tiramon.bukkit.lightsensor.LightSensorThread.run(Unknown Source)
    2011-10-26 07:15:14 [SEVERE] java.lang.IllegalStateException: TickNextTick list out of synch
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.a(World.java:2122)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.World.doTick(World.java:1637)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:461)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
    2011-10-26 07:15:14 [SEVERE] at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    2011-10-26 07:15:14 [SEVERE] Unexpected exception

    As far as I can tell it's a conflict between Spout and this plugin. I am also getting the error where the levers will randomly turn around. I think that they turn around and then this happens.
     
  22. Offline

    Freakling

    Any chance you can make permission nodes and a option to disable this on some worlds? I've got a main world and a Vanilla world where i want to disable plugins on.
     
  23. Offline

    Firehunter23

    I also would like to see atleast 1 permission node :)
    Just one for allow a group of users to create them :)
     
  24. Offline

    EHAndrew

    So the new R5 is coming out soon... Are we going to see an update? or is this already running the new code?
     
  25. Offline

    Firehunter23

    No it's not working with R5 :/
    And also it seems that the jar also doesn't contain the source :/
    and the author wasn't online here since the 30th sep :(
     
  26. Offline

    Zaros

    Firehunter23
    It took me a literal 20 seconds to get my hand on the source.
    Try a decompiler next time...
     
  27. Offline

    Firehunter23

    Hey I'm new to java ^^ so I just tried to open the file in eclipse :p
    Thanks though ;)
     
  28. Offline

    Zaros

    No problem. Remember, if source isn't available a decompiler is your next best bet.
     
  29. Offline

    Firehunter23

    Hm... I think i got it working :D
     
  30. Offline

    Pr4w

    Any plan on updating? :)
    With the new lamps, this could be epic... :)
     
  31. Offline

    MPD2

    Update to 1.2.4?
     

Share This Page