Updated documentation printer program, updated plugin.yml.

Dieser Commit ist enthalten in:
sk89q 2011-01-29 12:40:42 -08:00
Ursprung 4bae254963
Commit 8dbd9645f9
2 geänderte Dateien mit 319 neuen und 245 gelöschten Zeilen

Datei anzeigen

@ -2,258 +2,249 @@ name: WorldEdit
main: com.sk89q.worldedit.bukkit.WorldEditPlugin main: com.sk89q.worldedit.bukkit.WorldEditPlugin
version: "WEVERSIONMACRO" version: "WEVERSIONMACRO"
commands: 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
usage: /<command>
/count:
description: Count the number of blocks in the region
usage: /<command> <ids>
/distr:
description: Get the top block distribution
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
usage: /<command> <filename>
/save:
description: Save clipboard to .schematic
usage: /<command> <filename>
clearclipboard:
description: Clear clipboard
usage: /<command>
/hcyl:
description: Create a vertical hollow cylinder
usage: /<command> <id> <radius> [height]
/cyl:
description: Create a vertical cylinder
usage: /<command> <id> <radius> [height]
/sphere:
description: Create a sphere
usage: /<command> <id> <radius> [raised?]
/hsphere:
description: Create a hollow sphere
usage: /<command> <id> <radius> [raised?]
forestgen:
description: Make Notch tree forest
usage: /<command> [size] [density]
pinegen:
description: Make an ugly pine tree forest
usage: /<command> [size] [density]
pumpkins:
description: Make a pumpkin forest
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: chunkinfo:
description: Get the filename of the chunk that you are in description: Get information about the chunk that you are inside
usage: /<command> usage: /<command>
listchunks: listchunks:
description: Print a list of used chunks description: List chunks that your selection includes
usage: /<command> usage: /<command>
delchunks: delchunks:
description: Generate a shell script to delete chunks description: Delete chunks that your selection includes
usage: /<command>
clearclipboard:
description: Clear your clipboard
usage: /<command>
/load:
description: Load a schematic into your clipboard
usage: /<command> <filename>
/save:
description: Save a schematic into your clipboard
usage: /<command> <filename>
/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: Generate a hollow cylinder
usage: /<command> <block> <radius> [height]
/cyl:
description: Generate a cylinder
usage: /<command> <block> <radius> [height]
/hsphere:
description: Generate a hollow sphere
usage: /<command> <block> <radius> [raised?]
/sphere:
description: Generate a filled sphere
usage: /<command> <block> <radius> [raised?]
forestgen:
description: Generate a forest
usage: /<command> [size] [density]
pinegen:
description: Generate a pine forest
usage: /<command> [size] [density]
pumpkins:
description: Generate pumpkin patches
usage: /<command> [size]
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> usage: /<command>
unstuck: unstuck:
description: Go up to the first free spot description: Escape from being stuck inside a block
usage: /<command> usage: /<command>
ascend: ascend:
description: Go up one level description: Go up a floor
usage: /<command> usage: /<command>
descend: descend:
description: Go down one level description: Go down a floor
usage: /<command>
jumpto:
description: Jump to the block that you are looking at
usage: /<command> usage: /<command>
thru: thru:
description: Go through the wall that you are looking at description: Passthrough walls
usage: /<command>
jumpto:
description: Teleport to a location
usage: /<command> usage: /<command>
ceil: ceil:
description: Get to the ceiling description: Go to the celing
usage: /<command> [clearence] usage: /<command> [clearance]
up: up:
description: Go up some distance description: Go upwards some distance
usage: /<command> <distance> usage: /<command> <block>
/overlay:
listsnapshots: description: Set a block on top of blocks in the region
description: List the 5 newest snapshots usage: /<command> <block>
usage: /<command> [num] /walls:
/use: description: Build the four sides of the selection
description: Use a particular snapshot usage: /<command> <block>
usage: /<command> <snapshot-id> /faces:
/restore: description: Build the walls, ceiling, and roof of a selection
description: Restore a particular snapshot usage: /<command> <block>
usage: /<command> [snapshot-id] aliases: /outline
/smooth:
/: description: Smooth the elevation in the selection
description: Toggles super pick axe. usage: /<command> [iterations]
usage: /<command> /replace:
single: description: Replace all blocks in the selection with another
description: Switch to single block super pickaxe mode usage: /<command> [from-block] <to-block>
usage: /<command> /stack:
area: description: Repeat the contents of the selection
description: Switch to area super pickaxe mode usage: /<command> [-a] [count] [direction]
usage: /<command> <range> /set:
recur: description: Set all the blocks inside the selection to a block
description: Switch to recursive super pickaxe mode usage: /<command> <block>
usage: /<command> <range> /move:
none: description: Move the contents of the selection
description: Switch to no tool usage: /<command> [count] [direction] [leave-id]
usage: /<command> .s:
info: description: Execute last CraftScript
description: Switch to the info tool usage: /<command> [args...]
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?]
cs: cs:
description: Execute a CraftScript description: Execute a CraftScript
usage: /<command> <filename> [arg1 [args2 [arg3 [...]]]] usage: /<command> <filename> [args...]
.s: /chunk:
description: Re-execute last CraftScript description: Set the selection to your current chunk
usage: /<command> [arg1 [args2 [arg3 [...]]]]
reloadwe:
description: Reload WorldEdit's configuration
usage: /<command> 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>

Datei anzeigen

@ -21,14 +21,30 @@ package com.sk89q.worldedit.dev;
import java.io.*; import java.io.*;
import java.lang.reflect.Method; 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.util.commands.Command;
import com.sk89q.worldedit.commands.CommandPermissions; import com.sk89q.worldedit.commands.CommandPermissions;
public class DocumentationPrinter { public class DocumentationPrinter {
public static void main(String[] args) { public static void main(String[] args) throws IOException {
File commandsDir = new File(args[0]); 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$")) { if (!f.getName().matches("^.*\\.java$")) {
continue; continue;
} }
@ -44,6 +60,30 @@ public class DocumentationPrinter {
continue; 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()) { for (Method method : cls.getMethods()) {
if (!method.isAnnotationPresent(Command.class)) { if (!method.isAnnotationPresent(Command.class)) {
continue; continue;
@ -51,9 +91,9 @@ public class DocumentationPrinter {
Command cmd = method.getAnnotation(Command.class); Command cmd = method.getAnnotation(Command.class);
System.out.println("|-"); stream.println("|-");
System.out.print("| " + cmd.aliases()[0]); stream.print("| " + cmd.aliases()[0]);
System.out.print(" || "); stream.print(" || ");
if (method.isAnnotationPresent(CommandPermissions.class)) { if (method.isAnnotationPresent(CommandPermissions.class)) {
CommandPermissions perms = CommandPermissions perms =
@ -62,13 +102,56 @@ public class DocumentationPrinter {
String[] permKeys = perms.value(); String[] permKeys = perms.value();
for (int i = 0; i < permKeys.length; i++) { for (int i = 0; i < permKeys.length; i++) {
if (i > 0) { if (i > 0) {
System.out.print(", "); stream.print(", ");
} }
System.out.print(permKeys[i]); stream.print(permKeys[i]);
} }
} }
System.out.println(); 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) {
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));
}
} }
} }
} }