Fix undo
This commit is contained in:
parent
ca5ffe081b
commit
8da1224e08
@ -1051,9 +1051,9 @@ public class MainUtil {
|
||||
public static void deleteOlder(File directory, final long timeDiff, boolean printDebug) {
|
||||
final long now = System.currentTimeMillis();
|
||||
ForkJoinPool pool = new ForkJoinPool();
|
||||
iterateFiles(directory, new RunnableVal<File>() {
|
||||
iterateFiles(directory, new Consumer<File>() {
|
||||
@Override
|
||||
public void run(File file) {
|
||||
public void accept(File file) {
|
||||
long age = now - file.lastModified();
|
||||
if (age > timeDiff) {
|
||||
pool.submit(() -> file.delete());
|
||||
|
@ -232,31 +232,29 @@ public class HistoryCommands extends MethodCommands {
|
||||
@CommandPermissions("worldedit.history.undo")
|
||||
public void undo(Player player, LocalSession session, CommandContext context) throws WorldEditException {
|
||||
int times = Math.max(1, context.getInteger(0, 1));
|
||||
if (times > 50) {
|
||||
FawePlayer.wrap(player).checkConfirmation(() -> {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
EditSession undone;
|
||||
if (context.argsLength() < 2) {
|
||||
undone = session.undo(session.getBlockBag(player), player);
|
||||
} else {
|
||||
player.checkPermission("worldedit.history.undo.other");
|
||||
LocalSession sess = worldEdit.getSession(context.getString(1));
|
||||
if (sess == null) {
|
||||
BBC.COMMAND_HISTORY_OTHER_ERROR.send(player, context.getString(1));
|
||||
break;
|
||||
}
|
||||
undone = sess.undo(session.getBlockBag(player), player);
|
||||
}
|
||||
if (undone != null) {
|
||||
BBC.COMMAND_UNDO_SUCCESS.send(player);
|
||||
worldEdit.flushBlockBag(player, undone);
|
||||
} else {
|
||||
BBC.COMMAND_UNDO_ERROR.send(player);
|
||||
FawePlayer.wrap(player).checkConfirmation(() -> {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
EditSession undone;
|
||||
if (context.argsLength() < 2) {
|
||||
undone = session.undo(session.getBlockBag(player), player);
|
||||
} else {
|
||||
player.checkPermission("worldedit.history.undo.other");
|
||||
LocalSession sess = worldEdit.getSessionManager().findByName(context.getString(1));
|
||||
if (sess == null) {
|
||||
BBC.COMMAND_HISTORY_OTHER_ERROR.send(player, context.getString(1));
|
||||
break;
|
||||
}
|
||||
undone = sess.undo(session.getBlockBag(player), player);
|
||||
}
|
||||
}, getArguments(context), times, 50);
|
||||
}
|
||||
if (undone != null) {
|
||||
BBC.COMMAND_UNDO_SUCCESS.send(player);
|
||||
worldEdit.flushBlockBag(player, undone);
|
||||
} else {
|
||||
BBC.COMMAND_UNDO_ERROR.send(player);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, getArguments(context), times, 50);
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
Loading…
Reference in New Issue
Block a user