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