Minor tweaks

This commit is contained in:
Jesse Boyd 2016-04-22 07:10:41 +10:00
parent fd37adaac8
commit e158b4d222
4 changed files with 67 additions and 68 deletions

View File

@ -11,7 +11,6 @@ import com.boydti.fawe.object.changeset.DiskStorageHistory;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.SetQueue;
import com.boydti.fawe.util.TaskManager;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.blocks.ItemType;
import com.sk89q.worldedit.world.World;
@ -105,16 +104,13 @@ public class Rollback extends FaweCommand {
SetQueue.IMP.addTask(this);
}
};
TaskManager.IMP.async(task);
task.run();
}
}
return true;
}
public void rollback(final FawePlayer player, final boolean shallow, final String[] args, final RunnableVal<List<DiskStorageHistory>> result) {
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
UUID user = null;
int radius = Integer.MAX_VALUE;
long time = Long.MAX_VALUE;
@ -173,6 +169,4 @@ public class Rollback extends FaweCommand {
}
result.run(edits);
}
});
}
}

View File

@ -1,6 +1,7 @@
package com.boydti.fawe.object;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.util.TaskManager;
public abstract class FaweCommand<T> {
public final String perm;
@ -20,13 +21,18 @@ public abstract class FaweCommand<T> {
} else {
if (player.getMeta("fawe_action") != null) {
BBC.WORLDEDIT_COMMAND_LIMIT.send(player);
return false;
return true;
}
player.setMeta("fawe_action", true);
boolean result = execute(player, args);
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
execute(player, args);
player.deleteMeta("fawe_action");
return result;
}
});
}
return true;
}
public abstract boolean execute(final FawePlayer<T> player, final String... args);

View File

@ -394,8 +394,8 @@ public class DiskStorageHistory implements ChangeSet, FaweChangeSet {
}
int x = ((byte) buffer[0] & 0xFF) + ((byte) buffer[1] << 8) + ox;
int z = ((byte) buffer[2] & 0xFF) + ((byte) buffer[3] << 8) + oz;
int combined1 = buffer[7];
int combined2 = buffer[8];
int combined1 = buffer[7] & 0xFF;
int combined2 = buffer[8] & 0xFF;
summary.add(x, z, ((combined2 << 4) + (combined1 >> 4)));
}
} catch (IOException e) {

View File

@ -164,16 +164,13 @@ public class MainUtil {
if (file.getName().endsWith(".bd")) {
if (timediff > Integer.MAX_VALUE || now - file.lastModified() <= timediff) {
files.add(file);
if (files.size() > 64) {
if (files.size() > 2048) {
return null;
}
}
}
}
}
if (files.size() > 64) {
return null;
}
World world = origin.getWorld();
Collections.sort(files, new Comparator<File>() {
@Override
@ -190,8 +187,10 @@ public class MainUtil {
RegionWrapper region = new RegionWrapper(summary.minX, summary.maxX, summary.minZ, summary.maxZ);
if (region.distance(origin.x, origin.z) <= radius) {
result.add(dsh);
if (result.size() > 64) {
return null;
}
}
}
return result;
}