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: As long as ignore_animals is set to true, this plugin will not affect the spawning of friendly mobs. 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. 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. 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. 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. 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). 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. 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. 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: Spoiler (Move your mouse to the spoiler area to reveal the content) Show Spoiler Hide 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: Spoiler (Move your mouse to the spoiler area to reveal the content) Show Spoiler Hide 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: Spoiler (Move your mouse to the spoiler area to reveal the content) Show Spoiler Hide 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!