Inactive [MECH] CivilizedSpawn v1.0 - Keep monsters out of civilized areas! [1185]

Discussion in 'Inactive/Unsupported Plugins' started by sluvine, Mar 12, 2011.

  1. Offline

    sluvine

    CivilizedSpawn - An elegant spawn plugin, for a more civilized age...
    Version: 1.0
    The original plugin for controlling where evil mobs spawn. Now with more configuration!!!
    Downloads

    First and foremost, I'd like to thank ShadowOfLegends, a good friend of mine, without whom this plugin wouldn't exist. I had forgotten just about everything about java and knew nothing about bukkit api until he helped me through it :)

    My players and I didn't like the thought of having to put down giant torch grids to keep monsters away. It looks bad and it isn't even foolproof - mobs still spawn on top of trees since the light doesn't reach the top of the leaves. This plugin forces monsters (and only monsters, animals aren't affected) to check their surroundings before spawning. If any "man-made" blocks are found within a given radius, the spawn is cancelled and they move along to the next potential spawn.

    This allows monsters to spawn outside of "civilized" areas such as cities or well-developed mines, but natural caves, mob spawner dungeons, and the general "wilderness" should be unaffected.

    How It Works:
    1. As long as ignore_animals is set to true, this plugin will not affect the spawning of friendly mobs.
    2. Checks if there is a mob spawner within a 5-block cube of the attempted spawn. If there is, assume spawn is in a dungeon and allow it regardless of surroundings. This feature is now optional (allow_dungeon_spawn) and defaults to true.
    3. Checks the level at the spawn and the level directly beneath it(so mobs can spawn under trees but not on them) in a 5-block radius for LEAVES blocks. If there are at least 4 of them, assume spawn is on top of a tree and cancel it. This feature is now configurable (allow_treetop_spawn) and defaults to false. The number of leaves to check for is also configurable now (minimum_leaves) and defaults to 4.
    4. In order to allow mobs to spawn in abandoned mine shafts, I included an optional feature (ignore_near_cobwebs) that checks for a number of cobwebs (cobweb_limit). If enough are found, then the plugin is ignored in this area.
    5. The best solution I could come up with for allowing mobs to spawn in strongholds was placing check for the height (Y-level) of the spawn point that causes the plugin to ignore spawns below a certain level. This defaults to 55 and is configurable (ignore_below). 55 seemed like a good starting value since sea-level in-game is 63, but there are occasionally above-ground surfaces that are below sea-level but not covered by water.
    6. Once all these checks are passed, the plugin functions by checking a cubic area (block_check_radius, block_check_height). The radius defaults to 15 and the height defaults to 5, so the full area checked is a 31x31x11 cube (including the block at the spawn point being checked). The plugin looks for man-made blocks in this area. The man made blocks are now configurable in a list (detect_block_types).
    7. If Structure Detection is enabled (use_structure_detection), then if the plugin finds a man-made block in the first check, it performs a second check on a smaller area. (struct_detect_radius, struct_detect_height). This configurable value defaults to a radius of 5 and a height of 2, for a total area of 11x11x5 (including the block at the spawn point being checked). If enough blocks are found in this smaller area (struct_detect_threshold, defaults to 3), then the first block is counted in the total. If enough of these "structures" are detected (block_check_threshold, defaults to 10), then the spawn is cancelled.
    8. If Structure Detection is not enable, then the original 31x31x11 check is the only one that occurs. If enough blocks are found (uses block_check_threshold) then the spawn is cancelled.
    9. As of v0.8, the plugin also tracks the total man-made blocks found by the first search (the 31x31x11) area. In order to increase accuracy and decrease the load that having a larger search radius caused, if at least 500 blocks in that area are man-made, the spawn is cancelled. It seems like a lot, but it's only 5% of the total blocks, and I found this to be the optimal number. The value is configurable (hard_cancel_threshold).
    Known Issues:
    • This tends to interfere with above-ground mob grinders since it cancels spawning near man-made blocks. If you make your grinder out of natural blocks, you shouldn't have an issue.
    • Buildings made from smooth stone (the type that occurs naturally) and or sandstone will not be detected by the plugin. This doesn't necessarily mean monsters will spawn there, however. If there are other blocks that the plugin does detect in the area, or a high enough light level, then monsters will not spawn. I am working on a way for the plugin to determine the difference between natural stone and player-placed stone without having to resort to the use of a database.
    Installation:
    Go to the Downloads link above, then pick the version you want to download. The newest stable version is the latest one that I've tested and deemed usable. The older versions are usable too, but might not have some of the newer features. Once you've downloaded the file, simply throw the .jar in your plugins folder! After you run your server for the first time, the CivilizedSpawn folder will generate with the default config.yml inside.

    Configuration:
    Show Spoiler

    Below is the default config.yml with explanations of each variable:
    Code:
    #
    block_check_threshold: 10
    #If use_structure_detection is true, this is the number of man-made block clusters that must be found
    #If use_structure_detection is false, this is the total number of blocks that must be found
    
    ignore_animals: true
    #This determines whether or not the plugin affects animal spawns
    
    struct_detect_radius: 5
    #This is the search radius used by Structure Detection, if enabled
    
    struct_detect_height: 2
     #This is the search height used by Structure Detection, if enabled
    
    hard_cancel_threshold: 500
    #If at least this many blocks are found in the search, the spawn is cancelled
    
    ignore_below: 55
    #The plugin doesn't cancel any spawns lower than this number (use F3 to check the Y values of your town's ground and make sure this number is at least 1 less than the lowest point). It is not recommended to set this higher than 63 (sea level).
    
    cobweb_limit: 1
    #If ignore_near_cobwebs is enabled, this is the number of cobwebs that must be found for the plugin to allow a spawn near man-made blocks
    
    allow_treetop_spawn: false
    #This determines whether or not to allow mobs to spawn on top of trees
    
    block_check_radius: 15
    #This is the search radius of the general search made by the plugin
    
    ignore_near_cobwebs: true
    #If enabled, the plugin will allow mobs to spawn near cobwebs since this is an indicator that the spawn is in an abandoned mineshaft
    
    block_check_height: 5
    #This is the search height of the general search made by the plugin
    
    minimum_leaves: 4
    #This is the smallest amount of leaves that must be present for the treetop spawn canceller to activate
    
    use_structure_detection: true
    #If enabled, the plugin makes a second check around each man-made block that it finds to look for other man-made blocks around it. This prevents players exploiting the plugin by randomly placing man-made blocks to prevent spawns.
    
    struct_detect_threshold: 3
    #When Structure Detection is on, Structure Detection must find at least this many blocks around the first one detected for it to count towards the block_check_threshold
    
    allow_dungeon_spawn: true
    #This allows mobs to spawn near mob spawners
    
    
    #These are the block types that the plugin will search for. Putting things like DIRT, SAND, GRAVEL, or STONE in this list will likely eliminate a lot of spawns that you didn't mean to eliminate. These values must match the names of the materials in the Materials ENUM and can be found here: [URL]http://jd.bukkit.org/apidocs/org/bukkit/Material.html[/URL]
    detect_block_types:
    - WOOD
    - COBBLESTONE
    - DIAMOND_BLOCK
    - BRICK
    - FENCE
    - GOLD_BLOCK
    - IRON_BLOCK
    - LAPIS_BLOCK
    - SNOW_BLOCK
    - COBBLESTONE_STAIRS
    - WOOD_STAIRS
    - WOODEN_DOOR
    - IRON_DOOR
    - STEP
    - DOUBLE_STEP
    - WOOL
    - BED_BLOCK
    - CHEST
    - FENCE_GATE
    - MOSSY_COBBLESTONE
    - SMOOTH_BRICK
    - SMOOTH_STAIRS
    - THIN_GLASS
    - TRAP_DOOR


    Changelog:
    Show Spoiler

    • 1.0
      • Made everything configurable!
      • Updated the plugin to function with new Adventure Update mobs and block types.
      • Added a height limit for the plugin to help keep strongholds populated with mobs.
      • Added cobweb detection to keep abandoned mine shafts populated with evil blue spiders.
      • Did I mention, it's CONFIGURABLE?!
    • 0.8
      • Fixed stupid bugginess by optimizing the search for structures
      • Implemented a combined threshold for proper spawns so that a creature still doesn't spawn in a bare patch in between large buildings like before. However, spaces wider than a 20*20*5 block tetrahedron without man-made blocks will still allow spawns. Build a road or a fountain or something else that looks pretty in the empty space if you're having problems in your towns.
      • Started cleaning things up to make just about every aspect of the plugin end-user customizable. v1.0 should be coming soon with full customization.
    • 0.7.4
      • Actually added wool to the list of materials (I forgot last time >.<)
      • Worked out some bugs with structure detection and increased the search radius to reflect the higher level of specificity required to find structures. The radius was too small once I moved from the 0.5 system to the 0.7 system. I doubled it and the plugin is now working as effectively on my test server as it was with 0.5.2.
      • Made the plugin insanely buggy and laggy! Don't use this one unless FPS over 2 makes you cry.
    • 0.7
      • Added wool, both types of stairs/slabs/doors to the check for structures
      • Improved the structure detection algorithm to check for adjacent blocks rather than just a disorganized group
    • 0.5.2
      • CivilizedSpawn submitted for release on Bukkit forums!
      • fixed empty dungeons due to cobblestone (stops the search if a mob spawner is found nearby) (Verified that this works! Yay! :))
      • changed the way detection works
        • instead of cancelling as soon as a man-made block is found, increments a counter and if that counter exceeds a given level, then cancel.
        • the idea being that the plugin should look for structures, not single blocks.
        • still very open to any suggestions on better methods
      • adjusted search radiuses again
      • started adjusting code to make things configurable
    • 0.5.1
      • added additional check to keep monsters from spawning on trees (this annoyed me, but it'll be able to be turned off once this is configurable)
      • cleaned up extra code
      • commented the code to increase readability
    • 0.5
      • Plugin begins testing!
      • set up basic detection capability

    Todo list:
    Show Spoiler

    • High Priority: Possibly add a specific checks for adjacent blocks instead of just a total number of blocks in a range (to decrease detection of randomly scattered cobbles and focus on structure detection)
    • Find a dungeon on our server to make sure they're working again as of 0.5.2
    • Upload source code for other folks to look at I'll do this if someone requests it...
    • High Priority: Make block types, search radius, allow_tree_spawn true/false, structure_detection true/false, etc. all configurable
    • Look into possible tie-in with World Guard Regions (ability to set no-hostile-spawn zones, no-neutral-spawn zones, and no-any-spawn zones) for larger pop. servers as this will reduce the performance impact
    • Make structure detection work on a separate counter from the search counter.
    • Add slabs, doors, stairs, and wool to the check
    • Any other good ideas that come along!
     
    Pisi-Deff, Digi and Maxwolf Goodliffe like this.
  2. Offline

    qrux

    Wow, great!
    One suggestion; could you make an option to use WorldGuard regions? So that mobs doesn't spawn in specified regions?
     
  3. Offline

    freman

    I'll take it as it is, thanks :D
     
  4. Offline

    sluvine

    I'll look into it, but I believe there is functionality built into WG that allows you to determine "no-spawn" zones. Once I get config file usage set up, I'll see if I can get in touch with WorldGuard's dev to see if there is a good reason for the two plugins to interact :)

    No problem, it's my first plugin, glad to see people like it!
     
  5. Offline

    qrux

    WorldGuard only supports mob damage as far as i know. Good to hear you'll check it out! :)
     
  6. Offline

    Ehnohpe

    Hmm... Where is the .jar? I extracted it and cant find the jar.
     
  7. Offline

    qrux

    Um, it's right there.
    However if you're on Mac, if you haven't changed the settings, it automatically extracts the .jar for you aswell :p
    If that's the case, run unzip CivilizedSpawn.zip from a Terminal window!
     
  8. Offline

    Ehnohpe

    Ahhh that would be the reason! Thanks!
     
  9. hey i have never used this mod before how do i protect a certain area?
     
  10. Offline

    sluvine

    it's a passively applied protection. it's different from existing plugins in that you don't just designate an area as "protected" but you don't have to go through and place a huge ugly torch grid in your town either.

    for instance, on my server we have a town that no monsters spawn in because it's pretty densely populated with buildings and roads, and there is a wall surrounding the town on 3 sides (on the 4th side there is an ocean) that is at a minimum 5 blocks higher than the ground level at any given point. The buildings and roads trigger the CivilizedSpawn plugin to recognize the area as a "civilized" area; in other words, and area that has been settled and occupied by humans. the purpose of the wall is to keep out any mobs who spawn outside the town. it works pretty well at creating "wilderness" vs. "settlements" in that inside the town it's completely safe, but as soon as you walk outside the wall for a little bit there are monsters waiting to pounce on you.

    i suggest pairing my mod with MiningTNT in order to fully protect your structures from harm by creepers.
    [MERGETIME="1300079003"][/MERGETIME]
    By the way, I found a dungeon on my server tonight and have verified that this plugin no longer interferes with dungeon monster spawning. The first version I released here (0.5.2) added a check before all the others for a mob spawner within a 5ft cube and allows the spawn even if there is cobblestone nearby. The older versions didn't have this check but I still hadn't found a dungeon to test it with, but now I know it works!
     
  11. nice thanks but it seems to be well not working for me but dont worry i made my areas mob free whth i zone but thanks anyways
     
  12. Offline

    sluvine

    no problem! But I'm guessing that you either didn't have the area walled off (to protect from monsters walking into the area) or you didn't have enough structures in the area for the plugin to see it as a developed area.
     
  13. Offline

    NopeDK

    Hey,
    gotta say, great plugin but I want to know if you could change the release link so that this is compatible with CraftBukkitUpToDate, so updating gets easier?
    Cheers
     
  14. Offline

    sluvine

    I've never heard of it, but hook me up with a link and I'll definitely check it out!
     
  15. Offline

    davr

    This is a good idea...but I'm somewhat conflicted. It means that players can just place a single cobblestone every 20 blocks and completely stop monsters from spawning anywhere. I'm trying to think if there's a way to improve it.
     
  16. Offline

    sluvine

    It actually doesn't work that way anymore! It now looks for several blocks in that space. I'm currently writing "structure detection" into the plugin so that it actually tries to find structures (which in theory are just multiple adjacent blocks) instead of a preset number of blocks. I'm also working on making all the various elements of the plugin configurable... check back sometime this weekend, I should have time to post a new version!
     
  17. Offline

    Carnes

    Giving your plugin a shot. I like the idea of it being passive. Allows towns and structures to grow organically without an admin having to redefine the nospawn areas.
     
  18. Offline

    sluvine

    Glad to hear it. That was exactly my thought for the plugin. If you experience any irregular activity or think of anything that might need changed, please feel free to come back and let me know. I check the forums several times daily, so I'll likely get back to you pretty quickly.

    Also, I'm going to be updating the plugin this weekend to include at least one (better structure detection), if not more, of the planned items on the To Do List in my first post, so make sure you check back when it's released as it will likely be a vast improvement on a system that already works very well (at least on my own server).
     
  19. Offline

    GFernie

    nice plugin :D
    going to add this to my server, sick of creepers blowing up my inter-city railway! (laid over cobblestone so should work :p) also the number of torches needed to keep monsters out of my town generates a fair amount of lag on my computer >.<

    can you use a static download link or submit this to CB update so that it can automatically be updated, thanks.
     
  20. Offline

    EniGmA1987

    For some reason this isnt working for me. I have it installed and it loads properly, however monsters still seem to spawn in my area. Really odd too because the area had just wood planks, then monsters started spawning there so I lit it up with torches as well, and monsters still spawn even with man made block and full light. Do you have any ideas why monsters are still allowed to spawn?
     
  21. Offline

    JedMyre

    This looks like just what I need for our family server. I love the idea of controlling where mobs spawn dynamically using normal game mechanics.
     
  22. Offline

    Jonathan Bloom

    Thanks for making this plugin. Installed and will see how it goes.

    Would it be possible to get sandstone, slabs, stairs, doors, and wool added?

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

    sluvine

    Sorry for taking so long to get back to everyone! I'm going to finish some updates I was working on tonight when I'm done with work. There should be a new version (available at a static location) ready to download around 8 PM EST.

    Now to answer some questions...

    Thanks! You're the second to request this, and looking around the forums it seems like the standard, so I'll get on that tonight :)

    The only thing I can think of is that could be spawning just outside of that area and then walking into it? The plugin only stops them from spawning there; it doesn't stop them from walking in afterwards. Also, as of 0.5.2, the plugin looks for several man-made blocks in the area. Without seeing the area you're talking about, it's hard to say, but if you just have blocks scattered about to try and create a safe zone it won't work. The idea behind the plugin is that you're protecting a developed area with structures and roads and such. I'm actually ramping up the "structure detection" aspect of the plugin with my update tonight. In the future, when it's configurable, there will be an option to turn off structure detection for those who aren't as concerned with realism.

    If neither of those ideas work, I'd be happy to look at a screenshot of the area and try to help you out! I've been using it since before I released it and it seems to be working as planned.

    That's the idea exactly :D

    I'll add slabs, stairs, doors, and wool too! Not sure how I didn't think of doors. The others I left out of the initial release because I was still pretty new to the community and didn't realize how prevalent they were in construction. In theory, it shouldn't have much effect because those things will just be detected along with surrounding aspects of the structure, but I'll add them just in case.

    Sandstone is a no-go however, due to it occurring naturally now (it generates in-between sand and stone layers in vanilla Minecraft).

    Hopefully in one of the next few updates, this will all be customizable using the configuration file that I've yet to make.

    While I'm thinking about it, is there anyone who wouldn't mind messaging me and explaining how plugins are made configurable? I've never tried it before, and having some help would definitely speed the process along.

    Sorry for the giant response! I'll try to stay more current. For whatever reason (maybe due to the Forums changing servers?) I stopped getting email notifications about this thread!
     
  24. Offline

    EniGmA1987

    Perhaps they are just walking into the area then. Ill try the update when you put it up and see if it behaves the same way or not. And ill double check the whole area to seer if I can find an area where it would allow monsters to spawn nearby
     
  25. Offline

    JedMyre

    Would love to see the config file implemented so I can define which are man-made blocks and also the size of the no-spawn-zone around those blocks. I would personally set it to something like 30x30x15 for our server to keep it extra safe for the non-fighters/creatives.
     
  26. Offline

    sluvine

    Both of those options are planned for the config... I'm thinking of also letting admins determine whether they want structure detection on or off (with it off, it would just look for a single block in the radius instead of several [or several adjacent in the update]) as well as an option to enable mobs to spawn on top of trees like they usually do (I have it set up so that they can spawn on the ground under trees like normal but not on top of them; mobs kept spawning on top of the trees in the middle of my village, then jumping down and attacking!).

    Can you think of any other features that might be more useful if they were configurable?
     
  27. Offline

    JedMyre

    Hmm I just had a creeper take out part of a farm. Since you aren't in control of how monsters wander, could we have optional no-spawn-zone settings for each monster type? Maybe setting the no-spawn-zone to a high value (in my case for creepers) would function as an automatic spawn veto. Nothin else comes to mind other than trying to direct monsters away from structures as they wander, although that might be too difficult to implement.
     
  28. Offline

    phaed

    Can you localize this say just around spawn area? Or is this happen all over the map? I want to add this to my server but If I understand correctly it would make mob traps impossible and that's not a price I'm willing to pay.
     
  29. Offline

    EniGmA1987

    Some types of monster traps will work, and some wont. It just depends on which style you do and your configuration options.

    You also have to remember to use smooth stone instead of cobble when building the spawn room for the trap.
     
  30. Offline

    sluvine

    New version (0.7) uploaded with improved structure detection and stairs, slabs, doors, and wool added to the list of blocks to search for!

    I put walls up around my developed areas, and these do the job perfectly. It doesn't have to be a huge thing (though it's sometimes fun to make giant walls) since a mob can't jump over a sheer ledge 2 or more blocks in height.

    As far as designating specific areas, that would probably be something I'll look into if/when I see if this can tie in with WorldGuard. For now though, I'm trying to keep things simple.


    What Enigma suggests will work, but I hadn't thought about traps in the same way that I hadn't thought about dungeons initially. I should be able to easily fix that. It's my understanding that most traps involve dispensers, right? I fixed dungeons by making the plugin first check for a mob spawner in the area. If there isn't one, it goes on with it's checks, but if there is one, it stops and allows the spawn regardless of surrounding blocks. I could easily do the same thing with dispenser blocks. Look for it in the next version (not the one I just uploaded).
     

Share This Page