-
Notifications
You must be signed in to change notification settings - Fork 225
WorldEdit EditSession
Alw3ys edited this page Mar 16, 2017
·
5 revisions
The EditSession is used by WorldEdit to make and record changes to the World. The EditSessionBuilder gives you full control over it.
- A world must be provided, see
FaweAPI.getWorld(...)
Example:
EditSession editSession = new EditSessionBuilder(world).fastmode(true).build();
Unset values will revert to their default:
- player: The player doing the edit (defaults to to null)
- limit: Block/Entity/Action limit (defaults to player limit or unlimited)
- changeSet: Stores changes (defaults to config.yml value)
- allowedRegions: Allowed editable regions (defaults to player's allowed regions, or everywhere)
- autoQueue: Changes can occur before flushQueue() (defaults true)
- fastmode: bypasses history (defaults to player fastmode or config.yml console history)
- checkMemory: If low memory checks are enabled (defaults to player's fastmode or true)
- combineStages: If history is combined with dispatching (defaults to config value)
- blockBag: The blockbag to use (defaults to null)
- eventBus: The eventBus to use (defaults to null)
- event: The event to call (defaults to null)
Here's a non FAWE example:
// If no player is doing the changes
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(worldEditWorld, -1);
// For a specific player
editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(worldEditWorld, -1, actor);
// Do stuff with the EditSession
editSession.setBlock(new Vector(x, y, z), new BaseBlock(id, data));
// All changes will have been made once flushQueue is called
editSession.flushQueue();
Here's a FAWE example:
EditSession editSession = new EditSessionBuilder(world).fastmode(true).build();
editSession.setBlock(new Vector(x, y, z), new BaseBlock(id, data));
editSession.flushQueue();
Where editSession
is what you are undoing.
// Create a new EditSession however you want
EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(editSession.getWorld(), -1, null, null);
// Undo it
editSession.undo(newEditSession);
editSession.flushQueue();
This wiki is outdated, move to https://github.com/IntellectualSites/FastAsyncWorldEdit-Documentation/
This Wiki is for Legacy Versions (1.8 - 1.12.2). Check here for 1.13+ versions: https://github.com/IntellectualSites/FastAsyncWorldEdit-Documentation/