From 6434c04ce45c2c02f8a6f338fdf0f2a99fc69ef5 Mon Sep 17 00:00:00 2001 From: sk89q Date: Sat, 29 Jan 2011 12:46:22 -0800 Subject: [PATCH] Fixed a bad plugin.yml. --- plugin.yml | 6 ++--- src/com/sk89q/util/StringUtil.java | 23 +++++++++++++++++++ .../worldedit/dev/DocumentationPrinter.java | 5 ++-- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/plugin.yml b/plugin.yml index f67455476..ebba11b69 100644 --- a/plugin.yml +++ b/plugin.yml @@ -101,7 +101,7 @@ commands: /faces: description: Build the walls, ceiling, and roof of a selection usage: / - aliases: /outline + aliases: ['/outline'] /smooth: description: Smooth the elevation in the selection usage: / [iterations] @@ -174,7 +174,7 @@ commands: /: description: Toggle the super pickaxe pickaxe function usage: / - aliases: , + aliases: [','] area: description: Enable the area super pickaxe pickaxe mode usage: / @@ -238,7 +238,7 @@ commands: ex: description: Extinguish nearby fire usage: / [radius] - aliases: ext, extinguish + aliases: ['ext', 'extinguish'] butcher: description: Kill all or nearby mobs usage: / [radius] diff --git a/src/com/sk89q/util/StringUtil.java b/src/com/sk89q/util/StringUtil.java index 8652fdde1..78a525ee7 100644 --- a/src/com/sk89q/util/StringUtil.java +++ b/src/com/sk89q/util/StringUtil.java @@ -59,6 +59,29 @@ public class StringUtil { return buffer.toString(); } + /** + * Join an array of strings into a string. + * + * @param str + * @param delimiter + * @param initialIndex + * @return + */ + public static String joinQuotedString(String[] str, String delimiter, + int initialIndex, String quote) { + if (str.length == 0) { + return ""; + } + StringBuilder buffer = new StringBuilder(); + buffer.append(quote); + buffer.append(str[initialIndex]); + buffer.append(quote); + for (int i = initialIndex + 1; i < str.length; i++) { + buffer.append(delimiter).append(quote).append(str[i]).append(quote); + } + return buffer.toString(); + } + /** * Join an array of strings into a string. * diff --git a/src/com/sk89q/worldedit/dev/DocumentationPrinter.java b/src/com/sk89q/worldedit/dev/DocumentationPrinter.java index 087654961..36444f86e 100644 --- a/src/com/sk89q/worldedit/dev/DocumentationPrinter.java +++ b/src/com/sk89q/worldedit/dev/DocumentationPrinter.java @@ -149,8 +149,9 @@ public class DocumentationPrinter { + (cmd.flags().length() > 0 ? "[-" + cmd.flags() + "] " : "") + cmd.usage()); if (cmd.aliases().length > 1) { - stream.println(" aliases: " - + StringUtil.joinString(cmd.aliases(), ", ", 1)); + stream.println(" aliases: [" + + StringUtil.joinQuotedString(cmd.aliases(), ", ", 1, "'") + + "]"); } } }