StructureAPI
The StructureAPI
~ Loading and placing schematics has NEVER been SO EASY ~
The StructureAPI is that provides a convenient way to load and place schematics. Players can pick these schematics (also referred to as plans) from a menu and place them in the world. Scroll down to 'Quick Start' or watch the 'Quick Demo' to know more about how to setup your server with plans. StructureAPI aims to provide servers with a wide range of tools to place structures.
For older versions...
see structureapi 2.1.0 for the old page
Upgrading from 2.0.0 or 2.1.0? READ THIS!!
If you haven't created a backup yet CREATE BACKUPS OF YOUR SETTLERCRAFT-CORE DIRECTORY!!!. This update will upgrade the database and THERE IS NOW WAY BACK, NO DOWNGRADE POSSIBLE. Unless ofcourse you made backups ^^
Current Features
- Generate plans from schematics
- Loading plans into a fancy menu
- Select plans from a menu
- Buy plans from a menu (requires Vault)
- Build a structure or continue construction of a existing one
- Demolish a structure
- Rollback structures (since 2.2.0)
- Stop construction or demolition of a structure
- Structures don't overlap each other
- Substructures, structures may be placed inside other structures (configurable to enable/disable)
Quick Demo (2.0.0)
Quick Start
- Download schematics from any website (for example minecraft-schematics.com)
- Place the downloaded schematics within "plugins/SettlerCraft-StructureAPI/generate"
- Start the server or execute the command "stt generate plans" in the server console
- Place the schematics together with the generate XML in "plugins/SettlerCraft-StructureAPI/plans"
- Restart or reload the server
- Plans are now available in the menu, you can open the menu by either using the /stt menu or /stt shop
Note: There is a small requirement for loading the schematics into SettlerCraft. All schematics need to be placed in neutral position which means the schematic needs to be aligned to the east (front pointing to west), unless you don't care about it's orientation. You can do this by simply using the command '/stt rotate [structureid][degrees]' which will rotate a schematic permanently.
Commands (2.2.0)
See github commands for StructureAPI 2.2.x
Permissions
See github permissions for StructureAPI 2.2.x
Installation
See github installation for installing StructureAPI 2.2.x or higher
Required plugins/dependencies
- SettlerCraft-Core - Core functionality of SettlerCraft, contains a distribution of Neo4j database
- SettlerCraft-MenuAPI - Menu library of SettlerCraft
- WorldEdit 6.1
- AsyncWorldEdit - version 2.2.x (Note: you will need both AsyncWorldEdit and AsyncWorldEditInjector)
Optional Hooks
- StructureAPI-WorldGuard - WorldGuard support (requires worldguard 6.1)
- StructureAPI-HolographicDisplays - Hologram support (requires HolographicDisplays 2.1.x)
- StructureAPI-Towny - Support for Towny (since SettlerCraft-2.1.0) and ofcourse requires Towny. Mayors are able to place structures in the wildernis and players won't be able to place structures on or across plots they don't own.
- Vault 1.5.x
Optional Client Plugins (LiteLoader)
Developers
Project is under heavy development. Current implementation is very subject to change, extending this project will most likely break your code. A proper API and documentation is planned after this project has moved to Spigot.
https:github.com/chingo247/StructureAPI
Proper documentation is still in progress... Sorry! Also the API is still very subject to change.
Upcoming Features
- WorldGuard Default flags for structures
- Manual construction - Feed blocks to structures and make them grow
Found a bug ?
Report it here! and I'll try to fix it as soon as possible!
Ideas?
Ideas? Feel free to post below or PM me if u want!
@chingo247
Thanks for sharing this plugin, may you please add a video tutorial? thanks again!
[ UPDATE ]
Because of the high impact of updating from the current API to the upcoming one, I decided to take another week. I want to be absolutely sure that updating goes smoothly and doesn't mess up the server. As once updated there is NO WAY BACK
Sorry for the long wait for upcoming update. It's almost a complete rewrite of the current version, therefore I want to take a bit more time for testing.
[ UPDATE ]
At the moment I'm working on implementing substructures. I had some mayor difficulties on implementing that with a SQL database. I tried some workarounds to get this done, but the performance was very poor (high disk and memory usage)
Coincidentally I was also learning about Graphdatabases. So I decided to give this feature another shot with Neo4j. I have tested it out quite a bit and I know for sure that it will be fairly easy to store and retrieve structures (with substructures) this way.
Neo4j will be embedded in the next release, which means no installation is required. However because of the size (+-50 MB) the next release will look a bit differently. I decided to split up SettlerCraft into 3 plugins:
I will write/include an updater which will migrate the old data to the new API. However this will also mean that once updated there is no way back (so make backups...)
I expect to get the 'substructure' functionality ready at the end of this week, after that there will be a lot of testing and 'polishing' for 2 weeks (so release expected on May 10).
The plan-menu per structure I promised will not be implemented (yet). There will be other features in place, I will not name them yet but I can guarantee they are equally awesome.
After upcoming release I will also work on another plugin 'SettlerCraft-TownAPI', which will include the plan-menu per structure and other additional 'town-like' features. More about this soon.
Any questions? post them here ;)
@chingo247
Looking forward to it :D
Just for the ones who are reading this.. There is a big change coming up. It might still take a month before it's finished. The following features will be included:
Structure-PlanMenu, structure's can have their own planmenu with their own plans.@BucketConfigured
Short answer: No
Long answer:
There is no way to define the construction time of a build (/schematic). However, AsyncWorldEdit does provide some tuning with the placement speed, which allows you to define the amount of blocks that are placed at an interval.
Is there an option to set the construction time of a build? For example, if you wanted to build a mill, you could set in the config the time it will to take to construct it all.
@Hmmcrunchy
Checks are performed when a player creates or performs any construction related actions. Before a player places a schematic, the whole region is checked for overlap with structures and/or worldguard regions. The check isn't performed per block but with regions against each other, where each region is basicly a large cube.
After the checks are done a structure is created. The player who placed the structure is automatically added as owner to the structure. Also a worldguard region is created for the structure, where the player is also added to. Now only the player should be able to use commands (like cst build) or place/break blocks on this structure.
If all goes well, the structure will be build. At least that's what happens when a player uses a StructurePlan (as item). It's also possible through the API (on code level) to create and build a structure without providing any player.
In the end I don't perform checks per block, but check if a player is allowed to perform a certain action on a structure.
@chingo247 As in places the blocks as if it were the player placing them themselves rather than server, which would solve perm issue as it wouldn't be able to build - would this slow it up checking build perm on each block placed?
ah yes true didn't think that large.. if placed item dwarfed another region:)
Postponed the rollback feature... I need way more research on which database I should use
@Hmmcrunchy
What do you mean by remote block placing?
Also if the plugin you mentioned only checks if a block can be placed in the corner, then I guarantee that it will fail sometimes... Especially when placing a big schematic over a smaller schematic. All corners of the big schematic are outside the smaller schematic and would pass the test. While the small schematic is simply going to be replaced.
@chingo247
ha ha yea
I did come across another plugin which tested if the player that placed the item could build in each corner block of the schematic, it a block couldn't be placed in any corner then it failed to build, cant remember which one that was :/ ill try and find
can the plugin remote place a block as a player?
@Hmmcrunchy
Your are completely right, it SHOULD be that easy hehe :)
However there is no documentation or API provided only javadoc. Do you know by any chance any other plugins that use Towny in that kind of way?
@chingo247
Ah yes that's true would checking the whole schematic is in blocks that the player can build in work for towny, if one corner block was in town the schematic would fail to place or is that too simplistic :)
@Hmmcrunchy
I don't think I'll implement support for Towny, because of the way they implemented regions. Towny has a predefined grid of 16x16, which is not a feature but a limitation.
At the moment regions in SettlerCraft are fully 3-dimensional and aren't restricted to any kind of grid. If I were to implement Town-like behavior myself, I can keep it that way. I already planned to do something like this, but I will probably implement this in another plugin.
@chingo247
No problem great to see such awesome plugins being developed - :) good luck developing ill keep a close eye on this as it will really suit my server is it possible to support towny with claimed regions also?
@Hmmcrunchy Hey there!
Haven't been able to work on this plugin for a long time and will not really be able to work on this for about 2 months... (internship...). I still try to work on this in weekends!
Anyway thank you for your interest in this plugin :)
In the next version of the API an BuildOption object is passed through. Which will allow more options for placing schematics. I could come up with a filter that ignore a Material or ignores a material at certain layers.
At the moment I'm trying to implement the rollback feature, but with very little success.
chingo this is epic thanks so much for this :)
I too hope to place ships and other land structures, the ships will most likely be able to be then piloted via movecraft and sailed off into the sunset, do you forsee this being an issue re demolishing and or destroying the ship (sinking and block damage while a movecraft ship)
edit - I suppose could you get it to just place the structure and not remember it for the ships
another edit XD :
placing ships isn't that good if you have them in the water on the schematic, they appear above water with the seabed and water raised above sea level, as the plan placement is always the very bottom of the schem, is there a way to do it proportionally
@RaininSwords
Hello there,
first things first, I've done a major code cleanup this weekend after the release that is available on bukkit. I completely seperated the StructureAPI from the SettlerCraft.
To avoid that your application might break, because you are working with SettlerCraft-RC3 (which contains the old API), I've created a Pre-Release of SettlerCraft-RC-4, which is available on github: https://github.com/chingo247/SettlerCraft/releases/tag/1.0-RC4
The class you are probably will be intrested in is the StructureAPI. An instance of this can be retrieved by doing SettlerCraft.getInstance().getStructureAPI(). It doesn't offer much at build options at the moment, but it will expand for next release.
Note: Don't use anything related to the DocumentManagers. It's meant for adding extra data to structures, but it isn't ready for use (by developers) yet.
No I'll answer your questions ^^
"do the schematics get rid of water around them or do they just place it inside of the water?"
At the moment schematics will replace the whole area, including the water. So if a schematic contains air it will simply replace the water with air. There is a way to place a schematic without placing the air through worldedit, but my API doesn't support that (yet).
"Also does the destroying of the schematic look for the blocks it placed, or does it just remove whatever is inside of where the schematic is placed"
At the moment the schematic kinda reverse place itself. When demolishing it first checks whether the block was part of the schematic, if so then it will be replaced with air.
"if we had schematic ships being placed, then moved to a different location, then another ship comes along into the region where the first ship was placed, and someone does /cst demolish, will the first ship be removed, or will the other ship that was moved into the place where the original schematic was placed be removed?"
The command /cst demolish is bound by id. So it will only remove the structure (/ship) with the corresponding id.
Also at the moment I'm looking into Prism to make it possible to rollback structures, which means you can demolish a structure by a simple rollback or even better rollback a structure to a certain point.
Sadly I don't have much time to work on SettlerCraft this week, but I will try to improve the API and the javadocs
@chingo247
Hey, you my good sir just saved my staff a crap ton of time, we were going to make a plugin very similar to this. Except ours was to load ship schematics on placing a block, but this works also. I have a simple question though, because we are going to be using this so boats are placed in the ocean, do the schematics get rid of water around them or do they just place it inside of the water? Because if we had pockets of air in the middle of the ocean that would not be good. Also does the destroying of the schematic look for the blocks it placed, or does it just remove whatever is inside of where the schematic is placed, beacuse if we had schematic ships being placed, then moved to a different location, then another ship comes along into the region where the first ship was placed, and someone does /cst demolish, will the first ship be removed, or will the other ship that was moved into the place where the original schematic was placed be removed? Overall this plugin sounds awesome, keep up the good work!
P.S. Sorry for any typos or misspells, I'm using my phone to type all of this.