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

    Jonathan Bloom

    Thank you so much for the stone slab support. This fixes a ton of issues.
     
  3. Offline

    EniGmA1987

    I dont know about the latest traps, but I dont think they use dispensers. It is just a big player-made room with lots of water cannals that funnel monsters to a killpoint and then funnel the dropped items to a pickup point. It usually uses lava and cactus to kill monsters. So it is all still doable as long as the trap is far enough away from the city and the player remember to use smooth stone instead of cobble to fix up any mistakes he/she made when building the monster spawn room.

    Just checking, but this does NOT check for signs and ladders right? Cause thats a good thing that it doesnt.

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

    sluvine

    That's correct. I figured those are almost if not just as likely to be found outside of a town as they are inside of one.

    I see... that's a shame. I was hoping there would be an easy fix. I'll have to try to work out some ideas to make traps unaffected. Although your idea with using smooth stone for the trap would be feasible. It's not even like it would have to be too far away from the area, just outside the search radius distance of the nearest man-made block. They could even have it right under the town as long as the ceiling level of the trap was at least 6 blocks underground.
     
  5. Offline

    Jonathan Bloom

    I had mobs spawnining in one of my buildings made of wool, glass, diamond, and gold.
     
  6. Offline

    sluvine

    New structure detection is a bit buggy... I'm going to rewrite it and hopefully it'll work the way I intended. I'll have it up in a few minutes.

    New version (0.7.4) is up, I believe the issues with structure detection have been resolved.

    When it was added in 0.7, I didn't expand the search radius to account for what I'll call the new algorithm's "picky-ness" when it comes to finding buildings. It's very specific about what is considered a building now, but I should have increased the radius. Now it checks a very large area for a set number of structure "indicators" (a small number of adjacent blocks in a group) and appears to be functioning quite well.

    As far as materials go, I thought that I added everything in v0.7, but it turns out that I forgot wool. That has also been fixed in 0.7.4.

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

    JedMyre

    Will you make this into a setting as well? Call it threshold-sensitivity or whatever. Say you set it to N. Then if N or more structure indicators are found within the designated proximity the spawn won't happen. Super tweak-able that way.
     
  8. Offline

    sluvine

    Yeah absolutely. I'm looking to make it as configurable as possible, I'm just trying to learn the best way to build an interface between java and the config file. I've been looking at a couple different Java libraries out there for using YAML files but I haven't been able to figure out how to read them into the code the way I need to. As soon as that's done though, everything about the plugin will be configurable :)
     
  9. Offline

    Tachoh

    0.7.4 caused my server to severely lag. Had to revert to an old version to fix this.
     
  10. Offline

    sluvine

    It didn't do this the first few times on my test server, but when I went back and looked at the actual logs on my real server, I saw the same thing :(.

    I looked over the code this afternoon when I was on my lunch break at work, and I think I found the part that needs optimized. The search method when looking for structures takes way too long the way I have it written. I'm going to re-write and hopefully it will resolve the lag issue.

    I'll post an update when it's fixed. For now, everyone should probably revert to either 0.7 or 0.5.2, depending on whether they want the new structure detection method (0.7) or the old, simple block-by-block search (0.5.2).
     
  11. Offline

    JedMyre

    These aren't the spawns you're looking for...
     
  12. Offline

    sluvine

    It took a lot longer for someone to notice this than I thought :p

    Version 0.8 is now downloadable!

    I believe I've fixed all my lag issues and the structure detection is finished for now (I hope!). I ended up doing a combination of an optimized version of the 0.7.4 algorithm and the basic block by block scanning from 0.5.*. The result is more accurate detection and less server-intensive code!

    Update your old versions and let me know if anything needs changed :).

    As for progress towards v1.0 and full customization, I still haven't had any time to learn about using YAML with Java to make the config files that people use here for their plugins. That is my highest priority right now, and that should be my next release, unless something is seriously wrong with this one.
     
  13. Offline

    JDD

    sluvine I would greatly like to use this plugin however it presents and issue for me I wanted to ask about. I have a very very large city being built. Our walls are made of stone not cobblestone but actual stone as we liked the look more. The top of the walls have alternating iron blocks and stone slabs and the towers have lapis lazuli blocks for decoration and some glass. Also our streets are made of sandstone. By all measures none of these are considered a normal building material and all but the ironblocks lapis blocks and slabs occur naturally. Therefore how can this plugin detect my walls and later my buildings when they are using these materials?
     
  14. Offline

    sluvine

    This definitely presents a case I hadn't thought of >.<

    However, depending on the distribution of the iron blocks, lapis blocks, slabs, and glass, the plugin could actually grab enough of them to detect the structure. With the current settings it takes two instances within the search area of 20x20x5 of at least three "man-made" blocks within a 5x5x3 area of each other and/or a total of 750 blocks in the entire 20x20x5 area.

    In terms of actually fixing the problem, I'm trying to think of a good way for the plugin to differentiate between stone that occurs naturally and stone structures. Maybe a check for dirt above the stone?

    I had been hoping to avoid dealing with torches in any way, but I could potentially add torches to the list of things included in the search. Assuming you were planning on lighting your wall with torches, this could potentially solve the problem as well.

    The sandstone streets present an interesting issue. It's nice that it occurs naturally now, but it certainly makes a problem for the purposes of this plugin. Perhaps I could add a check for sandstone that only counts sandstone with air directly above it.

    I'll keep brainstorming but anyone else who comes up with an idea is welcome to try to help out!
     
  15. Offline

    JDD

    is it possible for the plugin to check if the block was created by a player? Thus performing it's deductions that way.
     
  16. Offline

    sluvine

    Unfortunately it's only currently possible to make that kind of distinction using a database that logs players' placement of blocks. As I'm trying to keep this plugin as slim as possible, that's not really an option I would prefer to resort to :(

    I'll keep working on it though, hopefully something will come up.
     
  17. Offline

    JDD

    Decided to go ahead and give the plugin a shot and see if it would/wouldn't work. It currently will not keep mobs from spawning within my city :(
     
  18. Having block types configurable would be a huge improvement. I currently need doubleslabs and some other blocks protected too. How about putting the plugin up to github?
     
  19. Offline

    DeepDarkness

    Bloody brilliant solution, your man-made block detection method. I can't use this yet, as I have built a mob tower already out of mostly cobble. However when you make it customisable I definitely will - I'm sick of mobs spawning up trees!!! And I agree, torches everywhere looks ugly. Really looking forward to 1.0. Good luck!
     
  20. Offline

    sluvine

    Sorry to hear that :(. As soon as I get a chance I'm going to fool around with a couple ideas I had to see if I can get a more intelligent structure detection implemented that doesn't rely solely on block-types. Work is always crazy at the end of the month so I probably won't get a chance to do anything until this weekend.

    I might be wrong, but aren't double slabs just two slabs stacked on top of each other? Also, the next release of the plugin will be configurable. As I said above, as soon as I get a chance to work on it for a good bit of time I'll make some improvements.

    Thanks :). Check back near the end of the weekend. There should be a release up that is fully customizable and includes an additional detection algorithm that doesn't even look at block types in addition to the existing one! As part of the customization users will be able to choose any or all of the three methods to detect structures.
     
  21. Nope, it's another block type; double is id 43, and single step is id 44 :)
     
  22. Offline

    sluvine

    Whoops >.< hadn't realized that. That's something I can easily fix today after work, so I'll put up v0.8.1 or something like that with double-slabs added. Are there any other obvious ones that I missed? I was thinking of adding redstone wire as well.

    EDIT: Just to clarify, I'm still planning on the customization feature, this is just a quick fix until I have time to work on that.
     
  23. Offline

    JDD

    Also sluvine I have read through all the posts here and I think someone may or may not have mentioned this but I'll go ahead and mention it now. If you haven't already you might want to get this on board with CraftBukkitUpToDate.
     
  24. Offline

    EniGmA1987

    Thanks for being active on this. Do you know when this will officially support Craftbukkit build 602?

    Looking forward to version 0.8.1 :)
     
  25. I just figured out that this plugin alone blocks me from destroying blocks in the server on build #602. I don't know how it got to that but it does. Please update it :}
     
  26. Offline

    sluvine

    That is extremely confusing... :'(

    This plugin only looks at block material types and it only does that when monsters are spawning. I'm not sure how it could possibly interfere with destroying blocks, but I'll check it out and see what I can do.
     
  27. Offline

    mbandit

    I have also had the issue that it makes all players invisible to each other.
     
  28. Offline

    sintri

    may be interesting when it's updated.
     
  29. Offline

    wassilij

    I like this!
    Please update for Bukkit 617 :)
     
  30. Offline

    Justin Peeler

    Very excellent plugin. I'll be nervously looking over my shoulder in my town until this is updated for minecraft 1.4
     
  31. Offline

    rhadiem

    looking forward to trying this with 1.4! could you add livestock as an option too? I hate having pigs spawn inside my palace grounds :)
     

Share This Page