geforkt von Mirrors/FastAsyncWorldEdit
Added multiple undo/redo, fixed compile error.
Dieser Commit ist enthalten in:
Ursprung
abaeaa99ac
Commit
7088fadab8
@ -80,10 +80,10 @@ commands:
|
||||
usage: /<command>
|
||||
/redo:
|
||||
description: Redoes the last action (from history)
|
||||
usage: /<command>
|
||||
usage: /<command> [times]
|
||||
/undo:
|
||||
description: Undoes the last action
|
||||
usage: /<command>
|
||||
usage: /<command> [times]
|
||||
unstuck:
|
||||
description: Escape from being stuck inside a block
|
||||
usage: /<command>
|
||||
|
@ -47,9 +47,9 @@ import com.sk89q.worldedit.regions.Region;
|
||||
public class WorldEditPlugin extends JavaPlugin {
|
||||
private static final Logger logger = Logger.getLogger("Minecraft.WorldEdit");
|
||||
|
||||
private final ServerInterface server;
|
||||
private final WorldEdit controller;
|
||||
private final WorldEditAPI api;
|
||||
final ServerInterface server;
|
||||
final WorldEdit controller;
|
||||
final WorldEditAPI api;
|
||||
|
||||
private final LocalConfiguration config;
|
||||
private final PermissionsResolverManager perms;
|
||||
|
@ -32,43 +32,52 @@ import com.sk89q.worldedit.*;
|
||||
public class HistoryCommands {
|
||||
@Command(
|
||||
aliases = {"/undo"},
|
||||
usage = "",
|
||||
usage = "[times]",
|
||||
desc = "Undoes the last action",
|
||||
min = 0,
|
||||
max = 0
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions({"worldedit.history.undo"})
|
||||
public static void undo(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
int times = Math.max(1, args.getInteger(0, 1));
|
||||
|
||||
for (int i = 0; i < times; i++) {
|
||||
EditSession undone = session.undo(session.getBlockBag(player));
|
||||
if (undone != null) {
|
||||
player.print("Undo successful.");
|
||||
we.flushBlockBag(player, undone);
|
||||
} else {
|
||||
player.printError("Nothing to undo.");
|
||||
player.printError("Nothing left to undo.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"/redo"},
|
||||
usage = "",
|
||||
usage = "[times]",
|
||||
desc = "Redoes the last action (from history)",
|
||||
min = 0,
|
||||
max = 0
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions({"worldedit.history.redo"})
|
||||
public static void redo(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
int times = Math.max(1, args.getInteger(0, 1));
|
||||
|
||||
for (int i = 0; i < times; i++) {
|
||||
EditSession redone = session.redo(session.getBlockBag(player));
|
||||
if (redone != null) {
|
||||
player.print("Redo successful.");
|
||||
we.flushBlockBag(player, redone);
|
||||
} else {
|
||||
player.printError("Nothing to redo.");
|
||||
player.printError("Nothing left to redo.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren