- Notifications
You must be signed in to change notification settings - Fork 223
Rollback API
Jesse Boyd edited this page Aug 15, 2016
·
1 revision
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).
- Settings.HISTORY.USE_DISK=true
- Settings.HISTORY.USE_DATABASE=true
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.
RollbackDatabasedb = DBHandler.IMP.getDatabase(worldName);
booleandeleteAfterLookup = 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 pointdb.getPotentialEdits(uuid, minTime, pos1, pos2, newRunnableVal<DiskStorageHistory>() {
@Overridepublicvoidrun(DiskStorageHistorypotentialEdit) {
try {
UUIDuuid = potentialEdit.getUUID();
Stringname = Fawe.imp().getName(uuid);
intindex = potentialEdit.getIndex();
longage = System.currentTimeMillis() - potentialEdit.getBDFile().lastModified();
StringageFormatted = 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 changesIterator<MutableFullBlockChange> iter = potentialEdit.getFullBlockIterator(false);
while (iter.hasNext()) {
MutableFullBlockChangechange = 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))intfrom = change.from;
intto = change.to;
// Do something with this information?
}
} catch (IOExceptione) {
e.printStackTrace();
}
}
}, newRunnable() {
@Overridepublicvoidrun() {
// This runs when the lookup is finished
}
}, deleteAfterLookup);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/