Fix rollback

This commit is contained in:
Jesse Boyd 2016-06-20 14:57:39 +10:00
parent 0d7c0474cc
commit 598928053d
2 changed files with 36 additions and 32 deletions

View File

@ -45,7 +45,7 @@ public class Rollback extends FaweCommand {
} }
player.deleteMeta("rollback"); player.deleteMeta("rollback");
final FaweLocation origin = player.getLocation(); final FaweLocation origin = player.getLocation();
rollback(player, true, Arrays.copyOfRange(args, 1, args.length), new RunnableVal<List<DiskStorageHistory>>() { rollback(player, !player.hasPermission("fawe.rollback.deep"), Arrays.copyOfRange(args, 1, args.length), new RunnableVal<List<DiskStorageHistory>>() {
@Override @Override
public void run(List<DiskStorageHistory> edits) { public void run(List<DiskStorageHistory> edits) {
long total = 0; long total = 0;

View File

@ -271,6 +271,7 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
if (summary != null) { if (summary != null) {
return summary; return summary;
} }
try {
if (bdFile.exists()) { if (bdFile.exists()) {
int ox = getOriginX(); int ox = getOriginX();
int oz = getOriginZ(); int oz = getOriginZ();
@ -293,8 +294,8 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
} }
byte[] buffer = new byte[9]; byte[] buffer = new byte[9];
int i = 0; int i = 0;
while (!shallow && i < Settings.BUFFER_SIZE) { int amount = (Settings.BUFFER_SIZE - HEADER_SIZE) / 9;
i++; while (!shallow && ++i < amount) {
if (gis.read(buffer) == -1) { if (gis.read(buffer) == -1) {
fis.close(); fis.close();
gis.close(); gis.close();
@ -310,6 +311,9 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
MainUtil.handleError(e); MainUtil.handleError(e);
} }
} }
} catch (Exception e) {
e.printStackTrace();
}
return summary; return summary;
} }