edit session worldedit code example
Example: worldedit create a new edit session api
try (EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1)) {
// use the edit session here ...
} // it is automatically closed/flushed when the code exits the block