Inactive [MECH] ControllerBlock v1.18 - Toggle blocks on/off with redstone [740]

Discussion in 'Inactive/Unsupported Plugins' started by Hell_Fire, Jan 24, 2011.

  1. Offline

    Hell_Fire

    ControllerBlock - Toggle blocks on and off with redstone

    I've stopped work on this plugin due to other work, please see Zero9195s continuation of this plugin here: http://forums.bukkit.org/threads/34394/

    Pretty simple, there was a version of this for hmod, so the inspiration comes from that.

    Iron blocks can be turned into controller blocks. Drop the block down, drop a redstone wire or torch on top, switch to the type of block you want to toggle and smack the iron block with it. (Can remove redstone on top after it's been set as a ControllerBlock).

    Place those blocks down where you want them to be, you can work from multiple piles of it, where it is in the inventory doesn't matter, as long as you place the block of that type.

    Once you're done placing blocks, wack the iron block again and it'll save the block locations and ready to go. Power the block they'll appear, remove the power and they'll disappear again. Invert the control with a redstone torch on top of the block. To remove the binding, just remove the block.

    Source is included in the .jar file in case I disappear. Tested on my local server but other than that, not much else. Sure you guys will find me bugs :)

    A smallish howto of how to make blocks, and change between types.


    Features:
    • Redstone toggleable blocks
    Download ControllerBlock (recommend using the recommended build of craftbukkit here, previous version available below in the changelog, tested up to 733).

    NOTE: IN 1.07 CREATING CONTROLLERBLOCKS CHANGED, YOU NEED TO PUT A REDSTONE TORCH OR WIRE ON TOP OF THE BLOCK BEFORE YOU LEFT CLICK ON THE BLOCK TO CREATE. (Yes, enough people have missed this change to warrant the large bold text :p)

    Source now also available up on GitHub! https://github.com/Hell-Fire/ControllerBlock

    Some builds done with ControllerBlock:
    Treasure Quest 3 (dungeon game inside MineCraft) (by neoguy21)
    Xtreme HowTo controller blocks (by mrgreaper)
    :getout: frog animation (by Gorbachev, sup goons :V)
    gravity mob trap (by Arolathe)
    hidden staircase/entrance (by narrowtux)

    And a couple by me:
    Real simple on/off example/howto
    Item elevator
    Portcullis/castle gate build/howto (long >.<)

    Known Issues:
    - Placing a block in snow/flowing water/lava doesn't register.
    - Occasionally block hits/places/destroys don't register.
    - Liquids being directly controlled don't work properly.

    Changelog:
    Version 1.18
    - Updated for craftbukkit #733
    Version 1.17
    - Fixed config loading of BlockFlowProtectMode and BlockPhysicsProtectMode
    Version 1.16
    - Fixed for changes to bukkit/craftbukkit #602
    - Changed some messages, added some config options, haven't slept much, so forgotten a bit of what's changed, find bugs! :)
    Version 1.15
    - Fixed up multiworld, also loads the data file after all the other plugins have loaded.
    Version 1.14
    - Changed world to use name instead of the ID in data file, should fix multiworld stuff when ControllerBlock loads before other multiworld initializing plugins.
    - Not much else that I recall, will be another version soon
    Version 1.13
    - New config patcher, new options get added into the ControllerBlock.ini automatically.
    - Added a whole lot of currently disabled debug lines (They're spammy... really spammy).
    - Added option to disable the edit dupe check all together.
    - Added protection against water/lava flows (and dupe checks, that are disable-able with the above new option).
    - Added ability to disable the checks against Permissions (and clones) completely, if you want to just use my inbuilt controls only (not mandatory to set if you don't have Permissions, this is in addition to, if Permissions isn't installed, it won't use it anyway).
    - Fixed Grass/Dirt and Redstone Torch On/Off in the edit dupe checks. No other blocks are coming to mind that change automatically.
    - Added a bunch of error checking on the loading of the ControllerBlock.dat, hopefully will give me some clues as to what's going on there.
    Version 1.12
    - Removed plugin constructor for craftbukkit-419+ (wasn't needed anyway)
    - Fixed Permissions mod checking stuff (haven't tested it actually works with permissions, but doesn't seem to throw any errors on loading anymore)
    Version 1.11
    - Fixed a bug that mostly affected Windows users with .dat handling (wasn't closing the file on reading, so it couldn't overwrite it when saving).
    - Added some sanity checking to reading the .dat file (empty lines ignored rather than creating null controllerblocks that make the mod unable to save).
    - Destroying a block in edit mode that has more than one controllerblock controlling it will replace the block with the type from the enabled controllerblock.
    - Destroying a controllerblock now destroys all the controlled blocks and refunds them all at the controller block itself.
    Version 1.10
    - New antidupe code, a lot more reliable!
    - Fixed permissions check (uninitialized objects are a pain :p)
    Version 1.09
    - Fixed a rather critical bug that was saving the new data format with the old identifier.
    -- (YOU ONLY NEED TO DO THIS IF YOU USED THE BUGGED 1.08) --
    If affected by this (getting NumberFormatException on loading), edit ControllerBlock.dat with a text editor and change the first line from "# v2" to "# v3" (That's <hash><space>v3).
    -- (YOU ONLY NEED TO DO THIS IF YOU USED THE BUGGED 1.08) --
    Version 1.08 - critically bugged, don't use, use 1.09 instead
    - Added a builtin permissions support, also supports Nijikokuns Permissions on top of it
    - Removing the controller block with WorldEdits superpick, and possibly any of the "stick" plugins that cancel/set to air on hit will now remove the controller block.
    - Added configurable limits on number of blocks and block distance from controllerblock (is a "sphere" around the controllerblock, rather than a cube, might add another option to change it later).
    - Probably some more random little bugfixes/refactoring, but I can't remember >.<
    Version 1.07
    - Updated for API changes (bukkit-144/145 and craftbukkit-323, tested with 326)
    - Config file format change, old config files will convert automatically
    - ControllerBlocks need a redstone "thing" (wire/torch) on top to create a ControllerBlock
    - Added per-tick, per-controllerblock .isBlockPowered() check for more natural redstone integration (power feeds into the block rather than needing wire on top), more CPU hungry, toggleable with old quick REDSTONE_CHANGE event method in config (quickRedstoneCheck=true for fast version that needs wire on top of block)
    Version 1.06
    - Updated for API change (bukkit-128/craftbukkit-281, only tested with 289)
    - Added counts on block add/remove messages
    - Added notice if a block gets removed by the anti-dupe code while editing
    Version 1.05
    - Updated for API change (bukkit 122/craftbukkit-265)
    - If you're running a version prior to this, you can still find 1.04 at here. I won't be supporting it anymore though, so any bug fixes, etc, won't find there way backported there.
    Version 1.04
    - Moved config/data to plugins/ControllerBlock (or whatever getDataFolder() is). Should make it multi-server usable as long as each server has a different plugins dir.
    - Sorted out minecart track metadata storing, this should make dynamic minecart tracks actually stay how you put them out now.
    - Stacked fences should work again now.
    - Probably some other small bugfixes that I've lost track of.
    Version 1.03
    - More refactoring
    - Inverted blocks again, blocks on when redstone wire off, reads from torches now, blocks on when redstone torch on.
    - Added some error handling in the config file loading
    - Fixed a metadata handling bug when a block has more than one controller.
    - Listen to event cancellations, no longer processes canceled events.
    - Changed a bunch of the edit mode handling, still similar to how it was, just with some nice changes (no longer need to exit editing one block to edit another, will save/finish the previous block for you).
    - Can now edit/modify ControllerBlocks that were made with a different Material before a configuration change took place, Material only matters for creation of new blocks.
    Version 1.02
    - Whole lot of code refactoring
    - Blocks on when redstone on (can still use torches)
    - Block protection for controlled blocks (Physics events can't modify controlled blocks anymore, fixes duping issues, but allows some odd builds, might implement a "break" feature like the original had, where block changes cause the controllerblock to disable)
    - Added configuration file (creates on first load, in main folder, ControllerBlock.ini). First line is ControllerBlock material type, other lines are disallowed materials.
    - Saves block metadata, allows toggling of minecart tracks.
    - Probably some other stuff I'm forgetting.
    Version 1.01
    - Added controlled block checks, need to edit block before removing controlled blocks
    Version 1.0
    - Release
     
  2. Offline

    Skyve

    Code:
    19.02.2011 15:48:22 org.bukkit.plugin.SimplePluginManager callEvent
    SEVERE: Could not pass event BLOCK_DAMAGED to ControllerBlock
    java.lang.NullPointerException
            at com.hell_fire.bukkit.ControllerBlock.CBlock.loc2str(CBlock.java:280)
            at com.hell_fire.bukkit.ControllerBlock.CBlock.serialize(CBlock.java:231)
            at com.hell_fire.bukkit.ControllerBlock.ControllerBlock.saveData(ControllerBlock.java:185)
            at com.hell_fire.bukkit.ControllerBlock.CBlock.editBlock(CBlock.java:128)
            at com.hell_fire.bukkit.ControllerBlock.BlockListener.onBlockDamage(BlockListener.java:128)
            at org.bukkit.plugin.java.JavaPluginLoader$22.execute(JavaPluginLoader.java:231)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:60)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:214)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:347)
            at net.minecraft.server.Packet14BlockDig.a(SourceFile:42)
            at net.minecraft.server.NetworkManager.a(SourceFile:232)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:74)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:317)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:232)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    Craftbukkit #325
    ControllerBlock 1.10

    It happens when you try to stop editing (hit the iron block second time).
     
  3. Offline

    Hell_Fire

    That's part of the save code... I don't even know how that Location object is null, that one that it's trying to save is the location of the controllerblock itself... Unless you edited the .dat file and left an empty line, Hmmm, wonder if that doesn't throw a parse error when it loads and just creates a invalid object...
    --- merged: Feb 19, 2011 1:30 PM ---
    I'm going to upload a test version that does some basic checks on the .dat file for empty lines, see if that helps :)
    --- merged: Feb 19, 2011 1:32 PM ---
    And uploaded, those people getting exceptions on saving the controllerblocks (second hit), give this one a shot: ControllerBlock-1.11-rc1.jar
     
  4. Is cb compatible with 344+ ?
     
  5. Offline

    Hell_Fire

    I've been doing my testing on 345 and works okay :)
     
  6. Offline

    PAPABEAR1010

    after some more trials i found that after making 2 seperate controllers with different blocks , and shutting down the server and restarting to find that the first block is fine but the second still not functioning so i shut down again and had a look here

    ControllerBlock.dat
    # v3
    2251932648393220098,120,67,178,DIAMOND_BLOCK,papabear1010,2251932648393220098,117,69,178,0,2251932648393220098,117,68,178,0,2251932648393220098,117,67,178,0

    and here

    ControllerBlock.dat.tmp
    # v3
    2251932648393220098,120,67,178,DIAMOND_BLOCK,papabear1010,2251932648393220098,117,69,178,0,2251932648393220098,117,68,178,0,2251932648393220098,117,67,178,0
    2251932648393220098,128,67,180,COBBLESTONE,papabear1010,2251932648393220098,128,67,183,0,2251932648393220098,128,67,184,0,2251932648393220098,127,67,184,0,2251932648393220098,127,67,183,0

    thankyou
     
  7. Offline

    Hell_Fire

    What platform? (Windows, Linux, Mac?) Could you also check the permissions on the folder and files? That should only happen if it can't write to the .dat.

    I've counted not logging an error as a bug though, and will be fixed in the next version, thanks :)
     
  8. Offline

    PAPABEAR1010

     
  9. Offline

    Kevin Forte

    Thanks, that worked. :D
     
  10. Offline

    Hell_Fire

    It'll probably be a security thing, check the user account the server runs under has permissions. Sounds like an ACL problem, but not putting it off as not a bug since I haven't tested the renameTo function that moves the .tmp to the .dat file under windows platforms yet.
     
  11. Offline

    abuxton

    My server has the .dat file but it doesnt seem to save the blocks after i re-launch as well :(
     
  12. Offline

    Hell_Fire

    Those having issues with saving, this test version has some more logging on those (and checks about the renameTo function actually succeeds). If you could test it out for me? :) ControllerBlock-1.11-rc2.jar
     
  13. Offline

    abuxton

    sure i'll give it a shot
    --- merged: Feb 19, 2011 6:12 PM ---
    heyyy it worked!! :D
     
  14. Offline

    Hell_Fire

    Ahh, I just tested it, yeah, oddly enough, works for linux, probably for mac, but not windows, fail >.< Okay, I'll see if I can fix it up :)
     
  15. Offline

    abuxton

    It worked for me, and i have windows. hmm haha
     
  16. Offline

    Hell_Fire

    ACK! That's a horrible bug, woops, lol, note to self, close input files after reading them >.<
    --- merged: Feb 19, 2011 6:39 PM ---
    Okay, so I don't lose track of fixes :p
    - Fixed .dat file not getting updated on Windows (bug doesn't affect linux/mac unless you've got some specific lock settings on the filesystem).
    - Fixed .dat handling of empty lines

    Two more things I want to get done, quick one is destruction of a block that has two or more controllerblocks with blocks on them. Another is destroying a controllerblock, want to make it set all controlled blocks to air so you don't have to go around destroying them yourself, and have it refund the blocks straight at the controllerblock.
    --- merged: Feb 19, 2011 7:10 PM ---
    And uploaded :) Updating first post now
    --- merged: Feb 19, 2011 7:16 PM ---
    Thanks all for helping with the bug hunting with good error reports and information :)
     
  17. Offline

    PAPABEAR1010

    thankyou , all saving as they should on windows vista
    most kind
     
  18. Offline

    MatCat

    You never mention what to add to permissions :p
     
  19. Offline

    Hell_Fire

    Oh, it shows in the .ini if you let it make a new one with all the options, anyways, the permission nodes are:
    controllerblock.admin - not restricted by block counts, distance, can modify/destroy other users blocks
    controllerblock.create - able to create blocks
    controllerblock.modifyOther - able to modify others blocks
    controllerblock.destroyOther - able to destroy others blocks

    For these to work, you'll need to set the options in the .ini to false, since they default to true (except admin). If you need to, you can get a new .ini by renaming your old one, starting up the mod so that it writes a new default, stopping it again, and configure :)
     
  20. Offline

    Kevin Forte

    Okay, so I just broke a controller block, and noted that it never told me I destroyed the block. I now can't break the cobble that was linked to it, what do I do?
     
  21. Offline

    turtlelink2

    Hmmmm....I cannot finish editing this block.... I left click it and nothing happens
     
  22. Offline

    Deadlystrike

    i am using you latest version with 345 still every time a reload server all data is like gone.... no big errors like last time but it acts like it was never modifyed
     
  23. Offline

    Taxen0

    Is it possible to add so that you have to connect the blocks you want to remove to the trigger using redstone? like an optional setting? would feel less like cheating.
    otherwise awesome mod!
     
  24. Offline

    Demon Boy

    so no one else is getting th <0blocks> part after the material theyre editing are they? any idea why im getting it?
     
  25. Offline

    Hell_Fire

    Place a block back in the controllerblock spot and break it again. Don't know why sometimes events aren't firing properly :/
    --- merged: Feb 22, 2011 7:21 AM ---
    Any errors in the server console?
    --- merged: Feb 22, 2011 7:22 AM ---
    Any small errors? :)
     
  26. Offline

    Demon Boy

    interferes with permissions plz make compatible
     
  27. Offline

    Deadlystrike

    actualy things have gotten much worse!
    We can start the edit proccess but not end it at all i have been using this plug for a while and realy like it!
    i will test it right now for error

    Feb 22, 2011 1:26:26 AM org.bukkit.plugin.SimplePluginManager callEvent
    SEVERE: Could not pass event BLOCK_DAMAGED to ControllerBlock
    java.lang.NullPointerException
    at com.hell_fire.bukkit.ControllerBlock.CBlock.loc2str(CBlock.java:306)
    at com.hell_fire.bukkit.ControllerBlock.CBlock.serialize(CBlock.java:257
    )
    at com.hell_fire.bukkit.ControllerBlock.ControllerBlock.saveData(Control
    lerBlock.java:190)
    at com.hell_fire.bukkit.ControllerBlock.CBlock.editBlock(CBlock.java:138
    )
    at com.hell_fire.bukkit.ControllerBlock.BlockListener.onBlockDamage(Bloc
    kListener.java:128)
    at org.bukkit.plugin.java.JavaPluginLoader$22.execute(JavaPluginLoader.j
    ava:231)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:60)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:214)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:350)
    at net.minecraft.server.Packet14BlockDig.a(SourceFile:42)
    at net.minecraft.server.NetworkManager.a(SourceFile:232)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:77)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:317)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:232)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
     
  28. Offline

    Hell_Fire

    Possibly, though recently I added a couple of limiting options (range and number of blocks) though disabled by default, the idea being that the cost of the controllerblock type itself is the cost to have such a powerful block, like, say, turning the controllerblock type to a solid diamond block and only letting it toggle a single block.

    Adding a redstone check out from the controller block to each individual toggle block can be a really expensive check (pathfinding/etc). Though, not saying no, I'll keep it in mind :)
    --- merged: Feb 22, 2011 7:27 AM ---
    Is a feature, any message that adds/removes/modifies a controllerblock count just tells you the number of controlled blocks :)
     
  29. Offline

    Deadlystrike

    there u go
     
  30. Offline

    Hell_Fire

    How so? It was compatible as of 2.0 of Permissions. It shouldn't be exporting any Permissions code at all, heck, I don't even import any permissions code, I reference the Permissions types directly.
     
  31. Offline

    Deadlystrike

    i dont have any permisions for this mod?
    I dont see permisions at all in the error?
    are you talking to yourself kinda or im i missing somthing?
     

Share This Page