mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-22 02:25:53 +01:00
Page:
Rollback API
Pages
API
Anvil API
AsyncWorld
Brushes
Clipboard API
Commands
Configuration
Copying a region to another world.
CreateFromImage
Download Instructions: Bukkit Spigot
Fawe TaskManager
FawePlayer
FaweQueue
Home
JavaScript API
Jobs API
Light API
NBT stream API
Packet sending
Pasting a schematic
Permissions
Progress API
Recovering corrupt NBT files (MCA Schematic etc.)
Region restriction API
Registering Custom Masks, Patterns and Transforms
Registering custom brushes or commands
Rollback API
Some tips when using the FAWE API
TaskBuilder
TextureUtil block and biome coloring
Third party loggers
Transforms
Web API
WorldEdit FAWE mask list
WorldEdit EditSession
WorldEdit World Player
WorldEdit and FAWE patterns
1
Rollback API
Jesse Boyd edited this page 2016-08-16 00:44:56 +10:00
Table of Contents
If you aren't using a third party WorldEdit logging solution such as BlocksHub, there is the inbuilt FAWE logger which is significantly faster and uses much less space on disk (compression).
Requirements
- Settings.HISTORY.USE_DISK=true
- Settings.HISTORY.USE_DATABASE=true
Performing a lookup
The database only contains a list of edits and the effected region, not all block changes. To perform a full rollback you need to read the changes for each potential edit.
RollbackDatabase db = DBHandler.IMP.getDatabase(worldName);
boolean deleteAfterLookup = false;
// To search all players provide null for the uuid
// To search all time, use 0 for the minTime
// pos1 and pos2 can be a single point
db.getPotentialEdits(uuid, minTime, pos1, pos2, new RunnableVal<DiskStorageHistory>() {
@Override
public void run(DiskStorageHistory potentialEdit) {
try {
UUID uuid = potentialEdit.getUUID();
String name = Fawe.imp().getName(uuid);
int index = potentialEdit.getIndex();
long age = System.currentTimeMillis() - potentialEdit.getBDFile().lastModified();
String ageFormatted = MainUtil.secToTime(age / 1000);
// I want to now read each block change for the edit
// Note: There are also iterators for entity/tile changes
// - Or just use `potentialEdit.getIterator(dir)` for all changes
Iterator<MutableFullBlockChange> iter = potentialEdit.getFullBlockIterator(false);
while (iter.hasNext()) {
MutableFullBlockChange change = iter.next();
/* Maybe you only want to do something if the block is in a certain position?
if (change.x != x || change.y != y || change.z != z) {
continue;
}
*/
// The combinedId (see FaweCache#getId(combined), FaweCache#getData(combined))
int from = change.from;
int to = change.to;
// Do something with this information?
}
} catch (IOException e) {
e.printStackTrace();
}
}
}, new Runnable() {
@Override
public void run() {
// This runs when the lookup is finished
}
}, deleteAfterLookup);
This Wiki is for Legacy Versions (1.8 - 1.12.2). Check here for 1.13+ versions: https://github.com/IntellectualSites/FastAsyncWorldEdit-Documentation/