Updated documentation printer program, updated plugin.yml.

This commit is contained in:
sk89q 2011-01-29 12:40:42 -08:00
parent 4bae254963
commit 8dbd9645f9
2 changed files with 319 additions and 245 deletions

View File

@ -2,258 +2,249 @@ name: WorldEdit
main: com.sk89q.worldedit.bukkit.WorldEditPlugin
version: "WEVERSIONMACRO"
commands:
/limit:
description: See documentation
usage: /<command> <num>
toggleplace:
description: Toggle placing at pos #1
usage: /<command>
/undo:
description: Undo
usage: /<command>
/redo:
description: Redo
usage: /<command>
clearhistory:
description: Clear history
usage: /<command>
/pos1:
description: Set editing position #1
usage: /<command>
/pos2:
description: Set editing position #2
usage: /<command>
/hpos1:
description: Trace editing position #1
usage: /<command>
/hpos2:
description: Trace editing position #2
usage: /<command>
/chunk:
description: Select the chunk that you are in
usage: /<command>
/wand:
description: Gives you the edit wand
usage: /<command>
toggleeditwand:
description: Toggles edit wand selection
usage: /<command>
/expand:
description: Expands the selection
usage: /<command> <num> [direction]
/contract:
description: Contracts the selection
usage: /<command> <num> [direction]
/shift:
description: Shift the selection
usage: /<command> <num> [direction]
/size:
description: Get size of selected region
chunkinfo:
description: Get information about the chunk that you are inside
usage: /<command>
/count:
description: Count the number of blocks in the region
usage: /<command> <ids>
/distr:
description: Get the top block distribution
listchunks:
description: List chunks that your selection includes
usage: /<command>
delchunks:
description: Delete chunks that your selection includes
usage: /<command>
clearclipboard:
description: Clear your clipboard
usage: /<command>
/set:
description: Set all blocks inside region
usage: /<command> <id>
/replace:
description: Replace all existing blocks inside region
usage: /<command> [from-id] [to-id]
/overlay:
description: Overlay the area one layer
usage: /<command> <id>
/walls:
description: Build walls
usage: /<command> <id>
/outline:
description: Outline the region with blocks
usage: /<command> <id>
/move:
description: Move the selection
usage: /<command> [count] [dir] [leave-id]
/stack:
description: Stacks the selection
usage: /<command> [count] [dir]
/smooth:
description: Smooth an area's heightmap
usage: /<command> [iterations]
/copy:
description: Copies the currently selected region
usage: /<command>
/cut:
description: Cuts the currently selected region
usage: /<command>
/paste:
description: Pastes the clipboard
usage: /<command> <at-origin?>
/rotate:
description: Rotate the clipboard
usage: /<command> <angle>
/flip:
description: Flip the clipboard
usage: /<command> [dir]
/load:
description: Load .schematic into clipboard
description: Load a schematic into your clipboard
usage: /<command> <filename>
/save:
description: Save clipboard to .schematic
description: Save a schematic into your clipboard
usage: /<command> <filename>
clearclipboard:
description: Clear clipboard
usage: /<command>
/copy:
description: Copy the selection to the clipboard
usage: /<command>
/flip:
description: Flip the contents of the clipboard
usage: /<command> [dir]
/rotate:
description: Rotate the contents of the clipboard
usage: /<command> <angle-in-degrees>
/cut:
description: Cut the selection to the clipboard
usage: /<command> [leave-id]
/paste:
description: Paste the clipboard's contents
usage: /<command> [-ao]
toggleplace:
description:
usage: /<command>
/limit:
description: Modify block change limit
usage: /<command> <limit>
/hcyl:
description: Create a vertical hollow cylinder
usage: /<command> <id> <radius> [height]
description: Generate a hollow cylinder
usage: /<command> <block> <radius> [height]
/cyl:
description: Create a vertical cylinder
usage: /<command> <id> <radius> [height]
/sphere:
description: Create a sphere
usage: /<command> <id> <radius> [raised?]
description: Generate a cylinder
usage: /<command> <block> <radius> [height]
/hsphere:
description: Create a hollow sphere
usage: /<command> <id> <radius> [raised?]
description: Generate a hollow sphere
usage: /<command> <block> <radius> [raised?]
/sphere:
description: Generate a filled sphere
usage: /<command> <block> <radius> [raised?]
forestgen:
description: Make Notch tree forest
usage: /<command> [size] [density]
description: Generate a forest
usage: /<command> [size] [density]
pinegen:
description: Make an ugly pine tree forest
description: Generate a pine forest
usage: /<command> [size] [density]
pumpkins:
description: Make a pumpkin forest
description: Generate pumpkin patches
usage: /<command> [size]
/fill:
description: Fill a hole
usage: /<command> <id> <radius> [depth]
/fillr:
description: Fill a hole fully recursively
usage: /<command> <id> <radius>
fixwater:
description: Level nearby pools of water
usage: /<command> <radius>
fixlava:
description: Level nearby pools of lava
usage: /<command> <radius>
/drain:
description: Drain nearby water/lava pools
usage: /<command> <radius>
removeabove:
description: Remove blocks above head
usage: /<command> [size] [height]
removebelow:
description: Remove blocks below position
usage: /<command> [size] [height]
removenear:
description: Remove blocks near you
usage: /<command> [id] [size]
replacenear:
description: Replace all existing blocks nearby
usage: /<command> <size> <from-id> <to-id>
snow:
description: Simulate snow cover
usage: /<command> <radius>
thaw:
description: Unthaw/remove snow
usage: /<command> <radius>
butcher:
description: Kill nearby mobs
usage: /<command> [radius]
ex:
description: Extinguish fires
usage: /<command> [size]
chunkinfo:
description: Get the filename of the chunk that you are in
usage: /<command>
listchunks:
description: Print a list of used chunks
usage: /<command>
delchunks:
description: Generate a shell script to delete chunks
usage: /<command>
clearhistory:
description: Clear your history
usage: /<command>
/redo:
description: Redoes the last action (from history)
usage: /<command>
/undo:
description: Undoes the last action
usage: /<command>
unstuck:
description: Go up to the first free spot
usage: /<command>
description: Escape from being stuck inside a block
usage: /<command>
ascend:
description: Go up one level
usage: /<command>
description: Go up a floor
usage: /<command>
descend:
description: Go down one level
usage: /<command>
jumpto:
description: Jump to the block that you are looking at
usage: /<command>
description: Go down a floor
usage: /<command>
thru:
description: Go through the wall that you are looking at
usage: /<command>
description: Passthrough walls
usage: /<command>
jumpto:
description: Teleport to a location
usage: /<command>
ceil:
description: Get to the ceiling
usage: /<command> [clearence]
description: Go to the celing
usage: /<command> [clearance]
up:
description: Go up some distance
usage: /<command> <distance>
listsnapshots:
description: List the 5 newest snapshots
usage: /<command> [num]
/use:
description: Use a particular snapshot
usage: /<command> <snapshot-id>
/restore:
description: Restore a particular snapshot
usage: /<command> [snapshot-id]
/:
description: Toggles super pick axe.
usage: /<command>
single:
description: Switch to single block super pickaxe mode
usage: /<command>
area:
description: Switch to area super pickaxe mode
usage: /<command> <range>
recur:
description: Switch to recursive super pickaxe mode
usage: /<command> <range>
none:
description: Switch to no tool
usage: /<command>
info:
description: Switch to the info tool
usage: /<command>
tree:
description: Switch to the tree tool
usage: /<command>
pinetree:
description: Switch to the pine tree tool
usage: /<command>
bigtree:
description: Switch to the big tree tool
usage: /<command>
repl:
description: Switch to the block replacer tool
usage: /<command> <id>
brush:
description: Switch to the sphere brush tool
usage: /<command> <id> [radius] [no-replace?]
description: Go upwards some distance
usage: /<command> <block>
/overlay:
description: Set a block on top of blocks in the region
usage: /<command> <block>
/walls:
description: Build the four sides of the selection
usage: /<command> <block>
/faces:
description: Build the walls, ceiling, and roof of a selection
usage: /<command> <block>
aliases: /outline
/smooth:
description: Smooth the elevation in the selection
usage: /<command> [iterations]
/replace:
description: Replace all blocks in the selection with another
usage: /<command> [from-block] <to-block>
/stack:
description: Repeat the contents of the selection
usage: /<command> [-a] [count] [direction]
/set:
description: Set all the blocks inside the selection to a block
usage: /<command> <block>
/move:
description: Move the contents of the selection
usage: /<command> [count] [direction] [leave-id]
.s:
description: Execute last CraftScript
usage: /<command> [args...]
cs:
description: Execute a CraftScript
usage: /<command> <filename> [arg1 [args2 [arg3 [...]]]]
.s:
description: Re-execute last CraftScript
usage: /<command> [arg1 [args2 [arg3 [...]]]]
reloadwe:
description: Reload WorldEdit's configuration
usage: /<command>
usage: /<command> <filename> [args...]
/chunk:
description: Set the selection to your current chunk
usage: /<command>
/pos1:
description: Set position 1
usage: /<command>
/pos2:
description: Set position 2
usage: /<command>
/hpos1:
description: Set position 1 to targeted block
usage: /<command>
/hpos2:
description: Set position 2 to targeted block
usage: /<command>
/wand:
description: Get the wand object
usage: /<command>
toggleeditwand:
description: Toggle functionality of the edit wand
usage: /<command>
/contract:
description: Contract the selection area
usage: /<command> <amount> [reverse-amount] [direction]
/distr:
description: Get the distribution of blocks in the selection
usage: /<command>
//count:
description: Counts the number of a certain type of block
usage: /<command> <block>
/size:
description: Get information about the selection
usage: /<command>
/shift:
description: Shift the selection area
usage: /<command> <amount> [direction]
/expand:
description: Expand the selection area
usage: /<command> <amount> [reverse-amount] <direction>
/use:
description: Choose a snapshot to use
usage: /<command> <snapshot>
listsnapshots:
description: List snapshots
usage: /<command> [num]
/restore:
description: Restore the selection from a snapshot
usage: /<command> [snapshot]
/:
description: Toggle the super pickaxe pickaxe function
usage: /<command>
aliases: ,
area:
description: Enable the area super pickaxe pickaxe mode
usage: /<command> <radius>
none:
description: Turn off all superpickaxe alternate modes
usage: /<command>
bigtree:
description: Big tree generator tool
usage: /<command>
pinetree:
description: Pine tree generator tool
usage: /<command>
repl:
description: Block replacer tool
usage: /<command> <block>
brush:
description: Build spheres from far away
usage: /<command> <block> [radius] [no-replace?]
rbrush:
description: Brush tool that will only replace blocks
usage: /<command> <block> [radius]
recur:
description: Enable the recursive super pickaxe pickaxe mode
usage: /<command> <radius>
info:
description: Block information tool
usage: /<command>
single:
description: Enable the single block super pickaxe mode
usage: /<command>
tree:
description: Tree generator tool
usage: /<command>
/fillr:
description: Fill a hole recursively
usage: /<command> <block> <radius> [depth]
fixlava:
description: Fix lava to be stationary
usage: /<command> <radius>
fixwater:
description: Fix water to be stationary
usage: /<command> <radius>
removeabove:
description: Remove blocks above your head.
usage: /<command> [size] [height]
removebelow:
description: Remove blocks below your head.
usage: /<command> [size] [height]
removenear:
description: Remove blocks near you.
usage: /<command> <block> [size]
replacenear:
description: Replace nearby blocks
usage: /<command> <size> <from-id> <to-id>
snow:
description: Simulates snow
usage: /<command> [radius]
thaw:
description: Thaws the area
usage: /<command> [radius]
ex:
description: Extinguish nearby fire
usage: /<command> [radius]
aliases: ext, extinguish
butcher:
description: Kill all or nearby mobs
usage: /<command> [radius]
/fill:
description: Fill a hole
usage: /<command> <block> <radius> [depth]
/drain:
description: Drain a pool
usage: /<command> <radius>

View File

@ -21,14 +21,30 @@ package com.sk89q.worldedit.dev;
import java.io.*;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import com.sk89q.util.StringUtil;
import com.sk89q.util.commands.Command;
import com.sk89q.worldedit.commands.CommandPermissions;
public class DocumentationPrinter {
public static void main(String[] args) {
public static void main(String[] args) throws IOException {
File commandsDir = new File(args[0]);
for (File f : commandsDir.listFiles()) {
List<Class<?>> commandClasses = getCommandClasses(commandsDir);
System.out.println("Writing permissions wiki table...");
writePermissionsWikiTable(commandClasses);
System.out.println("Writing Bukkit plugin.yml...");
writeBukkitYAML(commandClasses);
System.out.println("Done!");
}
private static List<Class<?>> getCommandClasses(File dir) {
List<Class<?>> classes = new ArrayList<Class<?>>();
for (File f : dir.listFiles()) {
if (!f.getName().matches("^.*\\.java$")) {
continue;
}
@ -43,18 +59,42 @@ public class DocumentationPrinter {
} catch (ClassNotFoundException e) {
continue;
}
classes.add(cls);
}
return classes;
}
private static void writePermissionsWikiTable(List<Class<?>> commandClasses)
throws IOException {
FileOutputStream stream = null;
try {
stream = new FileOutputStream("wiki_permissions.txt");
PrintStream print = new PrintStream(stream);
_writePermissionsWikiTable(print, commandClasses);
} finally {
if (stream != null) {
stream.close();
}
}
}
private static void _writePermissionsWikiTable(PrintStream stream,
List<Class<?>> commandClasses) {
for (Class<?> cls : commandClasses) {
for (Method method : cls.getMethods()) {
if (!method.isAnnotationPresent(Command.class)) {
continue;
}
Command cmd = method.getAnnotation(Command.class);
System.out.println("|-");
System.out.print("| " + cmd.aliases()[0]);
System.out.print(" || ");
stream.println("|-");
stream.print("| " + cmd.aliases()[0]);
stream.print(" || ");
if (method.isAnnotationPresent(CommandPermissions.class)) {
CommandPermissions perms =
method.getAnnotation(CommandPermissions.class);
@ -62,13 +102,56 @@ public class DocumentationPrinter {
String[] permKeys = perms.value();
for (int i = 0; i < permKeys.length; i++) {
if (i > 0) {
System.out.print(", ");
stream.print(", ");
}
System.out.print(permKeys[i]);
stream.print(permKeys[i]);
}
}
stream.println();
}
}
}
private static void writeBukkitYAML(List<Class<?>> commandClasses)
throws IOException {
FileOutputStream stream = null;
try {
stream = new FileOutputStream("plugin.yml");
PrintStream print = new PrintStream(stream);
_writeBukkitYAML(print, commandClasses);
} finally {
if (stream != null) {
stream.close();
}
}
}
private static void _writeBukkitYAML(PrintStream stream,
List<Class<?>> commandClasses) {
System.out.println();
stream.println("name: WorldEdit");
stream.println("main: com.sk89q.worldedit.bukkit.WorldEditPlugin");
stream.println("version: \"WEVERSIONMACRO\"");
stream.println("commands:");
for (Class<?> cls : commandClasses) {
for (Method method : cls.getMethods()) {
if (!method.isAnnotationPresent(Command.class)) {
continue;
}
Command cmd = method.getAnnotation(Command.class);
stream.println(" " + cmd.aliases()[0] + ":");
stream.println(" description: " + cmd.desc());
stream.println(" usage: /<command> "
+ (cmd.flags().length() > 0 ? "[-" + cmd.flags() + "] " : "")
+ cmd.usage());
if (cmd.aliases().length > 1) {
stream.println(" aliases: "
+ StringUtil.joinString(cmd.aliases(), ", ", 1));
}
}
}
}