diff --git a/plugin.yml b/plugin.yml index 4bfb014df..2fef2ec87 100644 --- a/plugin.yml +++ b/plugin.yml @@ -23,9 +23,6 @@ commands: delchunks: description: Delete chunks that your selection includes usage: / - clearclipboard: - description: Clear your clipboard - usage: / /load: description: Load a schematic into your clipboard usage: / @@ -47,6 +44,12 @@ commands: /paste: description: Paste the clipboard's contents usage: / [-ao] + clearclipboard: + description: Clear your clipboard + usage: / + /limit: + description: Modify block change limit + usage: / toggleplace: description: usage: / @@ -54,9 +57,6 @@ commands: description: Search for an item usage: / [-bi] aliases: ['/l'] - /limit: - description: Modify block change limit - usage: / /sphere: description: Generate a filled sphere usage: / [raised?] @@ -75,17 +75,17 @@ commands: pumpkins: description: Generate pumpkin patches usage: / [size] - clearhistory: - description: Clear your history - usage: / - /redo: - description: Redoes the last action (from history) - usage: / [times] - aliases: ['redo'] /undo: description: Undoes the last action usage: / [times] aliases: ['undo'] + /redo: + description: Redoes the last action (from history) + usage: / [times] + aliases: ['redo'] + clearhistory: + description: Clear your history + usage: / unstuck: description: Escape from being stuck inside a block usage: / @@ -95,18 +95,27 @@ commands: descend: description: Go down a floor usage: / + ceil: + description: Go to the celing + usage: / [clearance] thru: description: Passthrough walls usage: / jumpto: description: Teleport to a location usage: / - ceil: - description: Go to the celing - usage: / [clearance] up: description: Go upwards some distance usage: / + /replace: + description: Replace all blocks in the selection with another + usage: / [from-block] + /stack: + description: Repeat the contents of the selection + usage: / [-a] [count] [direction] + /set: + description: Set all the blocks inside the selection to a block + usage: / /overlay: description: Set a block on top of blocks in the region usage: / @@ -120,24 +129,24 @@ commands: /smooth: description: Smooth the elevation in the selection usage: / [iterations] - /replace: - description: Replace all blocks in the selection with another - usage: / [from-block] - /stack: - description: Repeat the contents of the selection - usage: / [-a] [count] [direction] - /set: - description: Set all the blocks inside the selection to a block - usage: / /move: description: Move the contents of the selection usage: / [count] [direction] [leave-id] - .s: - description: Execute last CraftScript - usage: / [args...] cs: description: Execute a CraftScript usage: / [args...] + .s: + description: Execute last CraftScript + usage: / [args...] + //count: + description: Counts the number of a certain type of block + usage: / + /size: + description: Get information about the selection + usage: / + /shift: + description: Shift the selection area + usage: / [direction] /chunk: description: Set the selection to your current chunk usage: / @@ -159,36 +168,35 @@ commands: toggleeditwand: description: Toggle functionality of the edit wand usage: / - /contract: - description: Contract the selection area - usage: / [reverse-amount] [direction] - /distr: - description: Get the distribution of blocks in the selection - usage: / - //count: - description: Counts the number of a certain type of block - usage: / - /size: - description: Get information about the selection - usage: / - /shift: - description: Shift the selection area - usage: / [direction] /expand: description: Expand the selection area usage: / [reverse-amount] - /use: - description: Choose a snapshot to use - usage: / - listsnapshots: + /contract: + description: Contract the selection area + usage: / [reverse-amount] [direction] + /outset: + description: Outset the selection area + usage: / [-hv] + /inset: + description: Inset the selection area + usage: / [-hv] + /distr: + description: Get the distribution of blocks in the selection + usage: / [-c] + list: description: List snapshots usage: / [num] - /restore: + use: + description: Choose a snapshot to use + usage: / + snapshot: + description: Snapshot commands + usage: / + aliases: ['snap'] + restore: description: Restore the selection from a snapshot usage: / [snapshot] - area: - description: Enable the area super pickaxe pickaxe mode - usage: / + aliases: ['/restore'] recur: description: Enable the recursive super pickaxe pickaxe mode usage: / @@ -196,9 +204,18 @@ commands: single: description: Enable the single block super pickaxe mode usage: / + area: + description: Enable the area super pickaxe pickaxe mode + usage: / + info: + description: Block information tool + usage: / none: description: Turn off all superpickaxe alternate modes usage: / + tree: + description: Tree generator tool + usage: / [type] repl: description: Block replacer tool usage: / @@ -209,12 +226,9 @@ commands: description: Brush tool usage: / aliases: ['b'] - info: - description: Block information tool - usage: / - tree: - description: Tree generator tool - usage: / [type] + mask: + description: Set the brush mask + usage: / [mask] tool: description: Select a tool to bind usage: / @@ -227,12 +241,19 @@ commands: description: Select super pickaxe mode usage: / aliases: ['pickaxe', 'sp'] - mask: - description: Set the brush mask - usage: / [mask] + remove: + description: Remove all entities of a type + usage: / + aliases: ['rem', 'rement'] + /fill: + description: Fill a hole + usage: / [depth] /fillr: description: Fill a hole recursively usage: / [depth] + /drain: + description: Drain a pool + usage: / fixlava: description: Fix lava to be stationary usage: / @@ -264,13 +285,3 @@ commands: butcher: description: Kill all or nearby mobs usage: / [radius] - remove: - description: Remove all entities of a type - usage: / - aliases: ['rem', 'rement'] - /fill: - description: Fill a hole - usage: / [depth] - /drain: - description: Drain a pool - usage: / diff --git a/src/com/sk89q/worldedit/WorldEdit.java b/src/com/sk89q/worldedit/WorldEdit.java index dafc042d7..63665fbeb 100644 --- a/src/com/sk89q/worldedit/WorldEdit.java +++ b/src/com/sk89q/worldedit/WorldEdit.java @@ -109,7 +109,7 @@ public class WorldEdit { commands.register(RegionCommands.class); commands.register(ScriptingCommands.class); commands.register(SelectionCommands.class); - commands.register(SnapshotCommands.class); + commands.register(SnapshotUtilCommands.class); commands.register(ToolUtilCommands.class); commands.register(ToolCommands.class); commands.register(UtilityCommands.class); diff --git a/src/com/sk89q/worldedit/commands/SnapshotCommands.java b/src/com/sk89q/worldedit/commands/SnapshotCommands.java index f601a4426..bcd92d27a 100644 --- a/src/com/sk89q/worldedit/commands/SnapshotCommands.java +++ b/src/com/sk89q/worldedit/commands/SnapshotCommands.java @@ -26,12 +26,8 @@ import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.worldedit.*; -import com.sk89q.worldedit.data.ChunkStore; -import com.sk89q.worldedit.data.DataException; -import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.snapshots.InvalidSnapshotException; import com.sk89q.worldedit.snapshots.Snapshot; -import com.sk89q.worldedit.snapshots.SnapshotRestore; /** * Snapshot commands. @@ -42,7 +38,7 @@ public class SnapshotCommands { private static Logger logger = Logger.getLogger("Minecraft.WorldEdit"); @Command( - aliases = {"listsnapshots"}, + aliases = {"list"}, usage = "[num]", desc = "List snapshots", min = 0, @@ -66,7 +62,7 @@ public class SnapshotCommands { player.print((i + 1) + ". " + snapshots[i].getName()); } - player.print("Use //use [snapshot] or //use latest to set the snapshot."); + player.print("Use /snap use [snapshot] or /snap use latest."); } else { player.printError("No snapshots are available. See console for details."); @@ -88,7 +84,7 @@ public class SnapshotCommands { } @Command( - aliases = {"/use"}, + aliases = {"use"}, usage = "", desc = "Choose a snapshot to use", min = 1, @@ -127,103 +123,4 @@ public class SnapshotCommands { } } } - - @Command( - aliases = {"/restore"}, - usage = "[snapshot]", - desc = "Restore the selection from a snapshot", - min = 0, - max = 1 - ) - @CommandPermissions({"worldedit.snapshots.restore"}) - public static void restore(CommandContext args, WorldEdit we, - LocalSession session, LocalPlayer player, EditSession editSession) - throws WorldEditException { - - LocalConfiguration config = we.getConfiguration(); - - if (config.snapshotRepo == null) { - player.printError("Snapshot/backup restore is not configured."); - return; - } - - Region region = session.getRegion(); - Snapshot snapshot; - - if (args.argsLength() > 0) { - try { - snapshot = config.snapshotRepo.getSnapshot(args.getString(0)); - } catch (InvalidSnapshotException e) { - player.printError("That snapshot does not exist or is not available."); - return; - } - } else { - snapshot = session.getSnapshot(); - } - - ChunkStore chunkStore = null; - - // No snapshot set? - if (snapshot == null) { - snapshot = config.snapshotRepo.getDefaultSnapshot(); - - if (snapshot == null) { - player.printError("No snapshots were found. See console for details."); - - // Okay, let's toss some debugging information! - File dir = config.snapshotRepo.getDirectory(); - - try { - logger.info("WorldEdit found no snapshots: looked in: " + - dir.getCanonicalPath()); - } catch (IOException e) { - logger.info("WorldEdit found no snapshots: looked in " - + "(NON-RESOLVABLE PATH - does it exist?): " + - dir.getPath()); - } - - return; - } - } - - // Load chunk store - try { - chunkStore = snapshot.getChunkStore(); - player.print("Snapshot '" + snapshot.getName() + "' loaded; now restoring..."); - } catch (DataException e) { - player.printError("Failed to load snapshot: " + e.getMessage()); - return; - } catch (IOException e) { - player.printError("Failed to load snapshot: " + e.getMessage()); - return; - } - - try { - // Restore snapshot - SnapshotRestore restore = new SnapshotRestore(chunkStore, region); - //player.print(restore.getChunksAffected() + " chunk(s) will be loaded."); - - restore.restore(editSession); - - if (restore.hadTotalFailure()) { - String error = restore.getLastErrorMessage(); - if (error != null) { - player.printError("Errors prevented any blocks from being restored."); - player.printError("Last error: " + error); - } else { - player.printError("No chunks could be loaded. (Bad archive?)"); - } - } else { - player.print(String.format("Restored; %d " - + "missing chunks and %d other errors.", - restore.getMissingChunks().size(), - restore.getErrorChunks().size())); - } - } finally { - try { - chunkStore.close(); - } catch (IOException e) { - } - } - } } diff --git a/src/com/sk89q/worldedit/commands/SnapshotUtilCommands.java b/src/com/sk89q/worldedit/commands/SnapshotUtilCommands.java new file mode 100644 index 000000000..1dce23e39 --- /dev/null +++ b/src/com/sk89q/worldedit/commands/SnapshotUtilCommands.java @@ -0,0 +1,153 @@ +// $Id$ +/* + * WorldEdit + * Copyright (C) 2010, 2011 sk89q + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +package com.sk89q.worldedit.commands; + +import java.io.File; +import java.io.IOException; +import java.util.logging.Logger; +import com.sk89q.minecraft.util.commands.Command; +import com.sk89q.minecraft.util.commands.CommandContext; +import com.sk89q.minecraft.util.commands.CommandPermissions; +import com.sk89q.minecraft.util.commands.NestedCommand; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalPlayer; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.data.ChunkStore; +import com.sk89q.worldedit.data.DataException; +import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.snapshots.InvalidSnapshotException; +import com.sk89q.worldedit.snapshots.Snapshot; +import com.sk89q.worldedit.snapshots.SnapshotRestore; + +public class SnapshotUtilCommands { + private static Logger logger = Logger.getLogger("Minecraft.WorldEdit"); + + @Command( + aliases = {"snapshot", "snap"}, + desc = "Snapshot commands" + ) + @NestedCommand({SnapshotCommands.class}) + public static void snapshot(CommandContext args, WorldEdit we, + LocalSession session, LocalPlayer player, EditSession editSession) + throws WorldEditException { + } + + @Command( + aliases = {"restore", "/restore"}, + usage = "[snapshot]", + desc = "Restore the selection from a snapshot", + min = 0, + max = 1 + ) + @CommandPermissions({"worldedit.snapshots.restore"}) + public static void restore(CommandContext args, WorldEdit we, + LocalSession session, LocalPlayer player, EditSession editSession) + throws WorldEditException { + + LocalConfiguration config = we.getConfiguration(); + + if (config.snapshotRepo == null) { + player.printError("Snapshot/backup restore is not configured."); + return; + } + + Region region = session.getRegion(); + Snapshot snapshot; + + if (args.argsLength() > 0) { + try { + snapshot = config.snapshotRepo.getSnapshot(args.getString(0)); + } catch (InvalidSnapshotException e) { + player.printError("That snapshot does not exist or is not available."); + return; + } + } else { + snapshot = session.getSnapshot(); + } + + ChunkStore chunkStore = null; + + // No snapshot set? + if (snapshot == null) { + snapshot = config.snapshotRepo.getDefaultSnapshot(); + + if (snapshot == null) { + player.printError("No snapshots were found. See console for details."); + + // Okay, let's toss some debugging information! + File dir = config.snapshotRepo.getDirectory(); + + try { + logger.info("WorldEdit found no snapshots: looked in: " + + dir.getCanonicalPath()); + } catch (IOException e) { + logger.info("WorldEdit found no snapshots: looked in " + + "(NON-RESOLVABLE PATH - does it exist?): " + + dir.getPath()); + } + + return; + } + } + + // Load chunk store + try { + chunkStore = snapshot.getChunkStore(); + player.print("Snapshot '" + snapshot.getName() + "' loaded; now restoring..."); + } catch (DataException e) { + player.printError("Failed to load snapshot: " + e.getMessage()); + return; + } catch (IOException e) { + player.printError("Failed to load snapshot: " + e.getMessage()); + return; + } + + try { + // Restore snapshot + SnapshotRestore restore = new SnapshotRestore(chunkStore, region); + //player.print(restore.getChunksAffected() + " chunk(s) will be loaded."); + + restore.restore(editSession); + + if (restore.hadTotalFailure()) { + String error = restore.getLastErrorMessage(); + if (error != null) { + player.printError("Errors prevented any blocks from being restored."); + player.printError("Last error: " + error); + } else { + player.printError("No chunks could be loaded. (Bad archive?)"); + } + } else { + player.print(String.format("Restored; %d " + + "missing chunks and %d other errors.", + restore.getMissingChunks().size(), + restore.getErrorChunks().size())); + } + } finally { + try { + chunkStore.close(); + } catch (IOException e) { + } + } + } +}