mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
rename to SimpleChangeSetSummary
This commit is contained in:
parent
b173c85c78
commit
a52b645175
@ -5,6 +5,7 @@ import com.boydti.fawe.database.DBHandler;
|
||||
import com.boydti.fawe.database.RollbackDatabase;
|
||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.boydti.fawe.object.changeset.SimpleChangeSetSummary;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
@ -405,35 +405,10 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
||||
return new NBTInputStream(MainUtil.getCompressedIS(new FileInputStream(nbtfFile)));
|
||||
}
|
||||
|
||||
protected DiskStorageSummary summarizeShallow() {
|
||||
return new DiskStorageSummary(getOriginX(), getOriginZ());
|
||||
}
|
||||
|
||||
public DiskStorageSummary summarize(Region region, boolean shallow) {
|
||||
@Override
|
||||
public SimpleChangeSetSummary summarize(Region region, boolean shallow) {
|
||||
if (bdFile.exists()) {
|
||||
int ox = getOriginX();
|
||||
int oz = getOriginZ();
|
||||
DiskStorageSummary summary = summarizeShallow();
|
||||
if (region != null && !region.contains(ox, oz)) {
|
||||
return summary;
|
||||
}
|
||||
try (FaweInputStream fis = getBlockIS()) {
|
||||
if (!shallow) {
|
||||
int amount = (Settings.IMP.HISTORY.BUFFER_SIZE - HEADER_SIZE) / 9;
|
||||
MutableFullBlockChange change = new MutableFullBlockChange(null, 0, false);
|
||||
for (int i = 0; i < amount; i++) {
|
||||
int x = posDel.readX(fis) + ox;
|
||||
int y = posDel.readY(fis);
|
||||
int z = posDel.readZ(fis) + ox;
|
||||
idDel.readCombined(fis, change);
|
||||
summary.add(x, z, change.to);
|
||||
}
|
||||
}
|
||||
} catch (EOFException ignored) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return summary;
|
||||
return super.summarize(region, shallow);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.jnbt.NBTOutputStream;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.history.change.Change;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -729,4 +730,35 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
|
||||
public Iterator<Change> forwardIterator() {
|
||||
return getIterator(true);
|
||||
}
|
||||
|
||||
protected SimpleChangeSetSummary summarizeShallow() {
|
||||
return new SimpleChangeSetSummary(getOriginX(), getOriginZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleChangeSetSummary summarize(Region region, boolean shallow) {
|
||||
int ox = getOriginX();
|
||||
int oz = getOriginZ();
|
||||
SimpleChangeSetSummary summary = summarizeShallow();
|
||||
if (region != null && !region.contains(ox, oz)) {
|
||||
return summary;
|
||||
}
|
||||
try (FaweInputStream fis = getBlockIS()) {
|
||||
if (!shallow) {
|
||||
int amount = (Settings.IMP.HISTORY.BUFFER_SIZE - HEADER_SIZE) / 9;
|
||||
MutableFullBlockChange change = new MutableFullBlockChange(null, 0, false);
|
||||
for (int i = 0; i < amount; i++) {
|
||||
int x = posDel.readX(fis) + ox;
|
||||
int y = posDel.readY(fis);
|
||||
int z = posDel.readZ(fis) + ox;
|
||||
idDel.readCombined(fis, change);
|
||||
summary.add(x, z, change.to);
|
||||
}
|
||||
}
|
||||
} catch (EOFException ignored) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return summary;
|
||||
}
|
||||
}
|
||||
|
@ -3,12 +3,16 @@ package com.boydti.fawe.object.changeset;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FaweInputStream;
|
||||
import com.boydti.fawe.object.FaweOutputStream;
|
||||
import com.boydti.fawe.object.change.MutableFullBlockChange;
|
||||
import com.boydti.fawe.object.io.FastByteArrayOutputStream;
|
||||
import com.boydti.fawe.object.io.FastByteArraysInputStream;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.jnbt.NBTOutputStream;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
@ -241,6 +245,5 @@ public class MemoryOptimizedHistory extends FaweStreamChangeSet {
|
||||
@Override
|
||||
public void setRecordChanges(boolean recordChanges) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import com.boydti.fawe.database.DBHandler;
|
||||
import com.boydti.fawe.database.RollbackDatabase;
|
||||
import com.boydti.fawe.logging.rollback.RollbackOptimizedHistory;
|
||||
import com.boydti.fawe.object.RegionWrapper;
|
||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||
import com.boydti.fawe.object.changeset.SimpleChangeSetSummary;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
|
Loading…
Reference in New Issue
Block a user