tweak undo message

Dieser Commit ist enthalten in:
Jesse Boyd 2018-10-13 15:21:39 +11:00
Ursprung 1a12c065a1
Commit 888cbcedee
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
2 geänderte Dateien mit 26 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -90,9 +90,9 @@ public enum BBC {
COMMAND_HISTORY_CLEAR("History cleared", "WorldEdit.History"), COMMAND_HISTORY_CLEAR("History cleared", "WorldEdit.History"),
COMMAND_REDO_ERROR("Nothing left to redo. (See also `/inspect` and `/frb`)", "WorldEdit.History"), COMMAND_REDO_ERROR("Nothing left to redo. (See also `/inspect` and `/frb`)", "WorldEdit.History"),
COMMAND_HISTORY_OTHER_ERROR("Unable to find session for %s0.", "WorldEdit.History"), COMMAND_HISTORY_OTHER_ERROR("Unable to find session for %s0.", "WorldEdit.History"),
COMMAND_REDO_SUCCESS("Redo successful.", "WorldEdit.History"), COMMAND_REDO_SUCCESS("Redo successful%s0.", "WorldEdit.History"),
COMMAND_UNDO_ERROR("Nothing left to undo. (See also `/inspect` and `/frb`)", "WorldEdit.History"), COMMAND_UNDO_ERROR("Nothing left to undo. (See also `/inspect` and `/frb`)", "WorldEdit.History"),
COMMAND_UNDO_SUCCESS("Undo successful.", "WorldEdit.History"), COMMAND_UNDO_SUCCESS("Undo successful%s0.", "WorldEdit.History"),
OPERATION("Operation queued (%s0)", "WorldEdit.Operation"), OPERATION("Operation queued (%s0)", "WorldEdit.Operation"),

Datei anzeigen

@ -226,8 +226,9 @@ public class HistoryCommands extends MethodCommands {
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));
FawePlayer.wrap(player).checkConfirmation(() -> { FawePlayer.wrap(player).checkConfirmation(() -> {
for (int i = 0; i < times; ++i) { EditSession undone = null;
EditSession undone; int i = 0;
for (; i < times; ++i) {
if (context.argsLength() < 2) { if (context.argsLength() < 2) {
undone = session.undo(session.getBlockBag(player), player); undone = session.undo(session.getBlockBag(player), player);
} else { } else {
@ -238,14 +239,16 @@ public class HistoryCommands extends MethodCommands {
break; break;
} }
undone = sess.undo(session.getBlockBag(player), player); undone = sess.undo(session.getBlockBag(player), player);
if (undone == null) break;
} }
if (undone != null) { }
BBC.COMMAND_UNDO_SUCCESS.send(player); if (undone == null) i--;
worldEdit.flushBlockBag(player, undone); if (i > 0) {
} else { BBC.COMMAND_UNDO_SUCCESS.send(player, i == 1 ? "" : " x" + i);
BBC.COMMAND_UNDO_ERROR.send(player); worldEdit.flushBlockBag(player, undone);
break; }
} if (undone == null) {
BBC.COMMAND_UNDO_ERROR.send(player);
} }
}, getArguments(context), times, 50, context); }, getArguments(context), times, 50, context);
} }
@ -262,8 +265,9 @@ public class HistoryCommands extends MethodCommands {
int times = Math.max(1, args.getInteger(0, 1)); int times = Math.max(1, args.getInteger(0, 1));
for (int i = 0; i < times; ++i) { EditSession redone = null;
EditSession redone; int i = 0;
for (; i < times; ++i) {
if (args.argsLength() < 2) { if (args.argsLength() < 2) {
redone = session.redo(session.getBlockBag(player), player); redone = session.redo(session.getBlockBag(player), player);
} else { } else {
@ -274,13 +278,16 @@ public class HistoryCommands extends MethodCommands {
break; break;
} }
redone = sess.redo(session.getBlockBag(player), player); redone = sess.redo(session.getBlockBag(player), player);
if (redone == null) break;
} }
if (redone != null) { }
BBC.COMMAND_REDO_SUCCESS.send(player); if (redone == null) i--;
worldEdit.flushBlockBag(player, redone); if (i > 0) {
} else { BBC.COMMAND_REDO_SUCCESS.send(player, i == 1 ? "" : " x" + i);
BBC.COMMAND_REDO_ERROR.send(player); worldEdit.flushBlockBag(player, redone);
} }
if (redone == null) {
BBC.COMMAND_REDO_ERROR.send(player);
} }
} }