[Cherbot-commit] SF.net SVN: cherbot: [16] trunk
Status: Alpha
Brought to you by:
christianhujer
|
From: <chr...@us...> - 2006-10-28 22:33:15
|
Revision: 16
http://svn.sourceforge.net/cherbot/?rev=16&view=rev
Author: christianhujer
Date: 2006-10-28 15:32:24 -0700 (Sat, 28 Oct 2006)
Log Message:
-----------
Reformatted code according to project code style.
Modified Paths:
--------------
trunk/cherbot.ipr
trunk/src/net/sf/cherbot/BlackListManager.java
trunk/src/net/sf/cherbot/CherBot.java
trunk/src/net/sf/cherbot/CherBotException.java
trunk/src/net/sf/cherbot/CherBotLogger.java
trunk/src/net/sf/cherbot/CherBotPermission.java
trunk/src/net/sf/cherbot/CherBotSecurityManager.java
trunk/src/net/sf/cherbot/CollectionsManager.java
trunk/src/net/sf/cherbot/CommType.java
trunk/src/net/sf/cherbot/Crime.java
trunk/src/net/sf/cherbot/CrimeManager.java
trunk/src/net/sf/cherbot/CronManager.java
trunk/src/net/sf/cherbot/DeathsManager.java
trunk/src/net/sf/cherbot/DummyManagerProxy.java
trunk/src/net/sf/cherbot/EmotesManager.java
trunk/src/net/sf/cherbot/ExampleTestCase.java
trunk/src/net/sf/cherbot/ExampleTester.java
trunk/src/net/sf/cherbot/GreetingsManager.java
trunk/src/net/sf/cherbot/GroupManager.java
trunk/src/net/sf/cherbot/LamentsManager.java
trunk/src/net/sf/cherbot/MailManager.java
trunk/src/net/sf/cherbot/Manager.java
trunk/src/net/sf/cherbot/ManagerDocumenter.java
trunk/src/net/sf/cherbot/NoSuchPlayerException.java
trunk/src/net/sf/cherbot/NoobManager.java
trunk/src/net/sf/cherbot/PlayerManager.java
trunk/src/net/sf/cherbot/PollManager.java
trunk/src/net/sf/cherbot/RodBabyManager.java
trunk/src/net/sf/cherbot/RodBabyWannabeManager.java
trunk/src/net/sf/cherbot/SalesManager.java
trunk/src/net/sf/cherbot/SmutException.java
trunk/src/net/sf/cherbot/SmutManager.java
trunk/src/net/sf/cherbot/TestManager.java
trunk/src/net/sf/cherbot/TimeManager.java
Modified: trunk/cherbot.ipr
===================================================================
--- trunk/cherbot.ipr 2006-10-28 22:29:28 UTC (rev 15)
+++ trunk/cherbot.ipr 2006-10-28 22:32:24 UTC (rev 16)
@@ -23,7 +23,7 @@
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
<option name="GENERATE_FINAL_LOCALS" value="true" />
<option name="GENERATE_FINAL_PARAMETERS" value="true" />
- <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="0" />
+ <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="9999" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="1" />
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
<value />
Modified: trunk/src/net/sf/cherbot/BlackListManager.java
===================================================================
--- trunk/src/net/sf/cherbot/BlackListManager.java 2006-10-28 22:29:28 UTC (rev 15)
+++ trunk/src/net/sf/cherbot/BlackListManager.java 2006-10-28 22:32:24 UTC (rev 16)
@@ -9,55 +9,65 @@
import java.util.SortedSet;
import java.util.TreeSet;
-/** Manages a black list of users that may not use Cherbot.
+/**
+ * Manages a black list of users that may not use Cherbot.
* @author $Author: chris $
* @version $Id: BlackListManager.java,v 1.13 2005/11/09 20:30:00 chris Exp $
*/
@Manager.Description("Blacklist of players that are denied to use Cherbot.")
-@Manager.Features({"Blacklist players that are denied to use Cherbot."})
+@Manager.Features({ "Blacklist players that are denied to use Cherbot." })
public class BlackListManager extends Manager {
- /** Version information */
+ /**
+ * Version information
+ */
public static final String version = "$Revision: 1.13 $";
- /** Permission to modify blacklist. */
+ /**
+ * Permission to modify blacklist.
+ */
private static final String PERM_BLACKLIST = "Blacklist";
- /** The black list. */
+ /**
+ * The black list.
+ */
private SortedSet<String> blacklist = new TreeSet<String>();
{ // Commands
new Command("(?:$LIST ?(?:the )?blacklist(?:ed players)?|wh(?:o|ich players?) (?:is|are|r) (?:blacklisted|on (?:the )?blacklist))[.!?]?") {
@Description("Lists the blacklisted players.")
- @Examples({"List blacklist", "Tell me the blacklisted players.", "Who is blacklisted?", "Which players are on the blacklist?"})
+ @Examples({ "List blacklist", "Tell me the blacklisted players.", "Who is blacklisted?", "Which players are on the blacklist?" })
@Override public void performImpl() {
listBlacklist();
}
};
new Command("(?:put|add) $PLAYER (?:to|on) blacklist[.!]?") {
@Description("Puts a player on the blacklist.")
- @Examples({"Put Lead on blacklist.", "Add Lead to blacklist."})
+ @Examples({ "Put Lead on blacklist.", "Add Lead to blacklist." })
@Override public void performImpl() {
addBlacklist(player(1));
}
};
new Command("(?:remove) $PLAYER from blacklist[.!]?") {
@Description("Removes a player from the blacklist.")
- @Examples({"Remove Lead from blacklist."})
+ @Examples({ "Remove Lead from blacklist." })
@Override public void performImpl() {
removeBlacklist(player(1));
}
};
} // Commands
- /** Create the BlackListManager.
+ /**
+ * Create the BlackListManager.
* @param cherbot CherBot
*/
public BlackListManager(final CherBot cherbot) {
super(cherbot, "blacklist");
}
- /** List the blacklist. */
+ /**
+ * List the blacklist.
+ */
private void listBlacklist() {
if (blacklist.size() == 0) {
answer("Noone's on the blacklist yet.");
@@ -70,7 +80,8 @@
}
}
- /** Puts a player to the blacklist.
+ /**
+ * Puts a player to the blacklist.
* @param player Player to blacklist
*/
private void addBlacklist(final String player) {
@@ -83,7 +94,8 @@
}
}
- /** Removes a player from the blacklist.
+ /**
+ * Removes a player from the blacklist.
* @param player Player to remove
*/
private void removeBlacklist(final String player) {
@@ -96,19 +108,24 @@
}
}
- /** Checks wether a player is blacklisted.
+ /**
+ * Checks wether a player is blacklisted.
* @param player Player to check
*/
public boolean isBlacklisted(final String player) {
return blacklist.contains(player);
}
- /** Checks wether the actor is blacklisted. */
+ /**
+ * Checks wether the actor is blacklisted.
+ */
public boolean isBlacklisted() {
return blacklist.contains(getActor());
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
@Override public void help() {
answer("I have a blacklist. Players on the blacklist cannot use Cherbot.");
}
Modified: trunk/src/net/sf/cherbot/CherBot.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBot.java 2006-10-28 22:29:28 UTC (rev 15)
+++ trunk/src/net/sf/cherbot/CherBot.java 2006-10-28 22:32:24 UTC (rev 16)
@@ -12,51 +12,72 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.BreakIterator;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sf.cherbot.Manager.Command;
-/** A Daimonin bot.
+/**
+ * A Daimonin bot.
+ * @author $Author: chris $
+ * @version $Id: CherBot.java,v 1.31 2005/11/09 20:30:00 chris Exp $
* @todo split this class into four: A generic base class for robots, a class handling Daimonin-specific stuff, an interface for network
* implementations implemted by the latter, and this specific CherBot subclass.
* @todo perhaps add a graphical interface.
- * @author $Author: chris $
- * @version $Id: CherBot.java,v 1.31 2005/11/09 20:30:00 chris Exp $
*/
public class CherBot {
- /** Lihes of code. */
+ /**
+ * Lihes of code.
+ */
private static final int LINES_OF_CODE = 11137;
- /** Wether to stop.
+ /**
+ * Wether to stop.
* This variable initially is false.
* Telling the Bot to stop sets this variable to true, terminating the two thread loops for receiving packets and the console.
*/
private boolean stop;
- /** The user name this bot should use for connecting with the server. */
+ /**
+ * The user name this bot should use for connecting with the server.
+ */
private String username;
- /** The password this bot sohuld use for connecting with the server. */
+ /**
+ * The password this bot sohuld use for connecting with the server.
+ */
private String password;
- /** The SecurityManager.
+ /**
+ * The SecurityManager.
* Provides access to security handling possibly used by every other manager.
* Thus needs to be available to all managers.
*/
private CherBotSecurityManager securityManager;
- /** The internal manager. */
+ /**
+ * The internal manager.
+ */
private InternalManager internalManager;
- /** The Blacklist manager. */
+ /**
+ * The Blacklist manager.
+ */
private BlackListManager blacklistManager;
- /** The Player manager. */
+ /**
+ * The Player manager.
+ */
private PlayerManager playerManager;
- /** The Managers as a list for looping or similar.
+ /**
+ * The Managers as a list for looping or similar.
* It's a List because the order in which the managers are added really matters.
* Managers might have regular expression overlapping, an input string could match the commands of more than just one manager.
* The managers are searched in their creation order.
@@ -64,21 +85,26 @@
*/
private List<Manager> managers = new ArrayList<Manager>();
- /** The Managers as map, for getting the Manager on a specific topic.
+ /**
+ * The Managers as map, for getting the Manager on a specific topic.
* Key: topic of Manager ({@link Manager#getTopic()}).
* Value: Manager
*/
- private Map<String,Manager> managerMap = new HashMap<String,Manager>();
+ private Map<String, Manager> managerMap = new HashMap<String, Manager>();
- /** The Managers with timers. */
+ /**
+ * The Managers with timers.
+ */
private List<Manager> timers = new ArrayList<Manager>();
- /** The Commands.
+ /**
+ * The Commands.
* The order is important, this must be a List.
*/
private List<Command> commands = new ArrayList<Command>();
- /** Main program.
+ /**
+ * Main program.
* @param args command line arguments
* @throws IOException in case of I/O problems
*/
@@ -88,7 +114,8 @@
bot.run();
}
- /** Create the CherBot.
+ /**
+ * Create the CherBot.
* This creates the managers.
* @todo put the list of managers that should be created in a file, read the file and use reflection to create the managers.
* This would allow users to configure what modules the bot should load without recompiling the bot.
@@ -119,12 +146,15 @@
new NoobManager(this);
}
- /** Quit Cherbot. */
+ /**
+ * Quit Cherbot.
+ */
public void quit() {
System.exit(0);
}
- /** Add a Manager.
+ /**
+ * Add a Manager.
* The constructor of Manager invokes this method.
* So do not call this method or a Manager would be added twice.
* @param manager Manager to add
@@ -137,7 +167,8 @@
managerMap.put(manager.getTopic(), manager);
}
- /** Get a Manager for a certain topic.
+ /**
+ * Get a Manager for a certain topic.
* @param topic Topic to get Manager for
* @return Manager for <var>topic</var> or <code>null</code> if no manager for the specified topic is known
*/
@@ -145,7 +176,8 @@
return managerMap.get(topic);
}
- /** Get all managers.
+ /**
+ * Get all managers.
* The returned collection is immutable.
* @return all managers
*/
@@ -153,7 +185,8 @@
return Collections.unmodifiableList(managers);
}
- /** Get the SecurityManager.
+ /**
+ * Get the SecurityManager.
* Don't rely on the SecurityManager instance being the same all the time for an instance of CherBot.
* The SecurityManager might change over the time.
* @return SecurityManager
@@ -162,7 +195,8 @@
return securityManager;
}
- /** Add a Command.
+ /**
+ * Add a Command.
* The constructor of Manager.Command indirectly invokes this method by invoking Manager.addCommand.
* So do not call this method or a Command would be added twice.
* @param command Command to add
@@ -171,20 +205,22 @@
commands.add(command);
}
- /** Get username used by the bot.
+ /**
+ * Get username used by the bot.
* @return username
*/
public String getUsername() {
return username;
}
- /** Connect to a server.
+ /**
+ * Connect to a server.
* @param username username
* @param password password
- * @param server Server to connect to
+ * @param server Server to connect to
* @throws IOException if the socket cannot be opened.
*/
- @SuppressWarnings({"SocketOpenedButNotSafelyClosed"})
+ @SuppressWarnings({ "SocketOpenedButNotSafelyClosed" })
public void connect(final String username, final String password, final String server) throws IOException {
this.username = username;
this.password = password;
@@ -196,7 +232,8 @@
//say("food");
}
- /** Keep the bot running.
+ /**
+ * Keep the bot running.
* @throws IOException in case of I/O problems
*/
public void run() throws IOException {
@@ -212,14 +249,16 @@
}
}
- /** Answer.
+ /**
+ * Answer.
* @param cs String to answer
*/
public void answer(final CharSequence cs) {
tell(actor, cs.toString()); // TODO: Improve CharSequence handling
}
- /** Shout.
+ /**
+ * Shout.
* @param s String to shout
*/
public void shout(final String s) {
@@ -231,7 +270,8 @@
}
}
- /** Tell
+ /**
+ * Tell
* @param p Player name
* @param s String to tell
*/
@@ -250,7 +290,8 @@
}
}
- /** Reply
+ /**
+ * Reply
* @param s String to tell
*/
public void reply(final String s) throws IOException {
@@ -260,7 +301,8 @@
}
}
- /** Say.
+ /**
+ * Say.
* @param s String to say
*/
public void say(final String s) {
@@ -270,11 +312,12 @@
}
}
- /** Split a String into substrings.
+ /**
+ * Split a String into substrings.
* @param s String to split
* @return substrings
*/
- @SuppressWarnings({"AssignmentToForLoopParameter"})
+ @SuppressWarnings({ "AssignmentToForLoopParameter" })
private static Iterable<String> lineSplit(final String s) {
final BreakIterator it = BreakIterator.getLineInstance();
it.setText(s);
@@ -282,9 +325,11 @@
final int width = 230;
for (int end = it.last(), split = it.first(), current = 0; current <= end;) {
current = it.next();
- if (current-split > width) {
+ if (current - split > width) {
current = it.previous();
- if (current == split) { current = it.next(); }
+ if (current == split) {
+ current = it.next();
+ }
ret.add(s.substring(split, current));
split = current;
} else if (current == end) {
@@ -295,13 +340,18 @@
return ret;
}
- /** Pattern for game entering. */
+ /**
+ * Pattern for game entering.
+ */
private static final Pattern enter = Pattern.compile("(\\S+) has entered the game.");
- /** Pattern for game kill. */
+ /**
+ * Pattern for game kill.
+ */
private static final Pattern kill = Pattern.compile("(.+) killed (\\S+)( with (.*))?.");
- /** Dispatch a packet of data.
+ /**
+ * Dispatch a packet of data.
* @param data packet to dispatch
* @throws IOException in case of I/O problems
*/
@@ -309,19 +359,21 @@
} // dispatch
private static final String[] colors = {
- "\000\033[0m\001", // default / white
- "\000\033[33m\001", // orange
- "\000\033[96m\001", // light blue / navy
- "\000\033[91m\001", // red
- "\000\033[92m\001", // green
- "\000\033[94m\001", // blue
- "\000\033[37m\001", // grey
- "\000\033[93m\001", // yellow
- "\000\033[36m\001", // dark navy
- "\000\033[0m\001", // don't know
- "\000\033[93m\001", // yellow again
+ "\000\033[0m\001", // default / white
+ "\000\033[33m\001", // orange
+ "\000\033[96m\001", // light blue / navy
+ "\000\033[91m\001", // red
+ "\000\033[92m\001", // green
+ "\000\033[94m\001", // blue
+ "\000\033[37m\001", // grey
+ "\000\033[93m\001", // yellow
+ "\000\033[36m\001", // dark navy
+ "\000\033[0m\001", // don't know
+ "\000\033[93m\001", // yellow again
};
- /** Switch output to a certain color.
+
+ /**
+ * Switch output to a certain color.
* @param n color to switch to
*/
private static void switchColor(final int n) {
@@ -332,8 +384,9 @@
}
}
- /** Handle communication.
- * @param ct Communication Type
+ /**
+ * Handle communication.
+ * @param ct Communication Type
* @param who speaker
* @param msg message
* @throws IOException in case of I/O problems
@@ -341,7 +394,9 @@
*/
private void communicate(final CommType ct, final String who, final String msg) throws IOException {
playerManager.see(who);
- if (username.equals(who)) { return; } // avoid loop dispatch!
+ if (username.equals(who)) {
+ return;
+ } // avoid loop dispatch!
if (ct == CommType.shout) {
final Pattern p = Pattern.compile(username + "(?:(?:,|:)? *)(.*)");
final Matcher matcher = p.matcher(msg);
@@ -354,18 +409,22 @@
}
}
- /** Who executes the current / executed the last command. */
+ /**
+ * Who executes the current / executed the last command.
+ */
private String actor;
- /** Get the actor (player that executes current / executed the last command).
+ /**
+ * Get the actor (player that executes current / executed the last command).
* @return actor
*/
public String getActor() {
return actor;
}
- /** Dispatch a message, try to execute it's command.
- * @param who speaker
+ /**
+ * Dispatch a message, try to execute it's command.
+ * @param who speaker
* @param rawCmd Command to perform
* @todo this needs to be improved so /shout can also be used to communicate with Cherbot and Cherbot could respond on shout
*/
@@ -389,7 +448,8 @@
}
}
- /** Handle enter.
+ /**
+ * Handle enter.
* @param who person that entered.
*/
private void enter(final String who) {
@@ -398,53 +458,60 @@
}
}
- /** Handle kill.
+ /**
+ * Handle kill.
* @param killer Killer
- * @param who person that was killed
- * @param with with what
+ * @param who person that was killed
+ * @param with with what
* @throws IOException in case of I/O problems
*/
private void kill(final String killer, final String who, final String with) throws IOException {
- if (username.equals(who)) { return; } // avoid lamenting myself
+ if (username.equals(who)) {
+ return;
+ } // avoid lamenting myself
for (Manager manager : managers) {
manager.died(who, killer, with);
}
}
- /** Write a line to stdout.
+ /**
+ * Write a line to stdout.
* @param s line to write
*/
private static void println(final String s) {
System.out.println(s);
}
- /** The internal manager.
+ /**
+ * The internal manager.
* @author $Author: chris $
* @version $Revision: 1.31 $
*/
@Manager.Description("Manages the other modules and gives some general information about the bot.")
@Manager.Features({
- "Load and save persistent data.",
- "List commands.",
- "Tell what's new."
- })
+ "Load and save persistent data.",
+ "List commands.",
+ "Tell what's new."
+ })
private class InternalManager extends Manager {
+
private static final String PERM_SAVE = "Internal.Save";
+
private static final String PERM_LOAD = "Internal.Load";
+
private static final String PERM_QUIT = "Internal.Quit";
- /* Commands. */
- {
+ /* Commands. */ {
new Command("(?:in )?wh(?:ich|at) (?:programming[- ])?language (?:(?:were|are) $YOU|have you been) (?:written|programmed|coded)(?: in)?[?]?") {
@Description("You can ask in which language cherbot is written in.")
- @Examples({"What language are you coded in?", "In which programming language have you been written?"})
+ @Examples({ "What language are you coded in?", "In which programming language have you been written?" })
@Override public void performImpl() {
answer("I'm written in " + LINES_OF_CODE + " of Java code.");
}
};
new Command("save[.!]?") {
@Description("Saves all module data to persistent storage.")
- @Examples({"Save!"})
+ @Examples({ "Save!" })
@Override public void performImpl() {
checkPermission(new CherBotPermission(PERM_SAVE));
try {
@@ -457,7 +524,7 @@
};
new Command("save (\\w+)[.!]") {
@Description("Saves a specific module's data to persistent storage.")
- @Examples({"Save collections!", "Save sales!"})
+ @Examples({ "Save collections!", "Save sales!" })
@Override public void performImpl() {
final String module = matcher.group(1);
checkPermission(new CherBotPermission(PERM_SAVE + '.' + module));
@@ -473,7 +540,7 @@
};
new Command("load[.!]?") {
@Description("Load all module data from persistent storage.")
- @Examples({"Load!"})
+ @Examples({ "Load!" })
@Override public void performImpl() {
checkPermission(new CherBotPermission(PERM_LOAD));
try {
@@ -486,7 +553,7 @@
};
new Command("load (\\w+)[.!]?") {
@Description("Load a specific module's data from persistent storage.")
- @Examples({"Load collections!", "Load sales!"})
+ @Examples({ "Load collections!", "Load sales!" })
@Override public void performImpl() {
final String module = matcher.group(1);
checkPermission(new CherBotPermission(PERM_LOAD + '.' + module));
@@ -502,41 +569,49 @@
};
new Command("help[.!]?") {
@Description("Displays some general help.")
- @Examples({"Help!"})
+ @Examples({ "Help!" })
@Override public void performImpl() {
answer("More info: about, info, help commands, help topics, help usage, help testing");
}
};
new Command("(about|tell me about $YOU)[.!]?") {
@Description("Displays some information about Cherbot.")
- @Examples({"About!", "Tell me about you!"})
+ @Examples({ "About!", "Tell me about you!" })
@Override public void performImpl() {
answer("Hello. I am Cherbot, Cheristheus' stupid bot, written in 12 hours, approx. " + LINES_OF_CODE + " lines of code.\nI understand several commands, but most of them are privileged. If you talk to me, use short yet complete correct English sentences. I usually won't respond to single words thrown at me. If I say something like \"I don't want to.\", that means you used the correct command but you don't have enough permissions.\nAsk me about 'help topics' to find out what I can.");
}
};
new Command("(list|show|help) modules[.!]?") {
@Description("Lists which modules Cherbot has loaded.")
- @Examples({"List modules!", "Show modules!" })
+ @Examples({ "List modules!", "Show modules!" })
@Override public void performImpl() {
final StringBuilder mods = new StringBuilder();
for (Manager manager : managers) {
- if (mods.length() > 0) { mods.append(", "); } else { mods.append("Loaded modules: "); }
+ if (mods.length() > 0) {
+ mods.append(", ");
+ } else {
+ mods.append("Loaded modules: ");
+ }
mods.append(manager.getTopic());
}
mods
- .append(". ")
- .append(Integer.toString(managers.size()))
- .append(" modules total. Use 'help <modulename>' to get information on a specific module.");
+ .append(". ")
+ .append(Integer.toString(managers.size()))
+ .append(" modules total. Use 'help <modulename>' to get information on a specific module.");
answer(mods.toString());
}
};
new Command("(list|show|help) commands[.!]?") {
@Description("Lists the commands. Won't really list the commands but show the modules, since the commands are quite a lot now.")
- @Examples({"List commands!", "Show commands!"})
+ @Examples({ "List commands!", "Show commands!" })
@Override public void performImpl() {
final StringBuilder sb = new StringBuilder();
for (Manager manager : managers) {
- if (sb.length() == 0) { sb.append("Loaded modules: "); } else { sb.append(", "); }
+ if (sb.length() == 0) {
+ sb.append("Loaded modules: ");
+ } else {
+ sb.append(", ");
+ }
sb.append(manager.getTopic());
}
sb.append(". To know the commands for a specific module, use 'help commands <modulename>', like 'help commands topics'.");
@@ -545,7 +620,7 @@
};
new Command("(list|show|help) commands? (of |from )?(the |module )?(\\w+)([- ](module|commands))?[.!]?") {
@Description("Lists all commands from the specified module.")
- @Examples({"Show commands from module sales", "Show commands from the sales-module!"})
+ @Examples({ "Show commands from module sales", "Show commands from the sales-module!" })
@Override public void performImpl() {
final String topic = matcher.group(4);
final StringBuilder sb = new StringBuilder();
@@ -564,14 +639,14 @@
};
new Command("(list||show|help) (me )?all commands[.!]?") {
@Description("Lists all commands. Please don't use it.")
- @Examples({"List all commands!", "Show me all commands!"})
+ @Examples({ "List all commands!", "Show me all commands!" })
@Override public void performImpl() {
answer("The commands might be quite a lot. If you really want me to do that, tell me 'Really list all commands.'.");
}
};
new Command("really (list|show|help) (me )?all commands[.!]?") {
@Description("Lists all commands. Please don't use it.")
- @Examples({"Really list all commands!", "Really show me all commands!"})
+ @Examples({ "Really list all commands!", "Really show me all commands!" })
@Override public void performImpl() {
final StringBuilder sb = new StringBuilder();
for (Manager manager : managers) {
@@ -584,7 +659,7 @@
};
new Command("help (.*?)[.!]?") {
@Description("List the help on a specific module.")
- @Examples({"Help collections!", "Help sales!"})
+ @Examples({ "Help collections!", "Help sales!" })
@Override public void performImpl() {
final String topic = matcher.group(1);
if (topic.equals("usage")) {
@@ -600,47 +675,47 @@
};
new Command("info[.!]?") {
@Description("Gives some general info about Cherbot.")
- @Examples({"Info"})
+ @Examples({ "Info" })
@Override public void performImpl() {
final StringBuilder info = new StringBuilder();
info
- .append("Version: some alpha.\n")
- .append("Lines of code: approx. ")
- .append(LINES_OF_CODE)
- .append(".\n")
- .append("Loaded modules: ")
- .append(managers.size())
- .append(".\n")
- .append("Known commands: ")
- .append(commands.size())
- .append('.');
+ .append("Version: some alpha.\n")
+ .append("Lines of code: approx. ")
+ .append(LINES_OF_CODE)
+ .append(".\n")
+ .append("Loaded modules: ")
+ .append(managers.size())
+ .append(".\n")
+ .append("Known commands: ")
+ .append(commands.size())
+ .append('.');
answer(info.toString());
}
};
new Command("how many commands do $YOU know[?]?") {
@Description("Asks Cherbot how many commands it knows.")
- @Examples({"How many commands do you know?"})
+ @Examples({ "How many commands do you know?" })
@Override public void performImpl() {
answer("I know " + commands.size() + " commands.");
}
};
new Command("what('?s| is) new[?]?") {
@Description("Reports what's new since the last versions.")
- @Examples({"What's new?"})
+ @Examples({ "What's new?" })
@Override public void performImpl() {
whatsNew();
}
};
new Command("ping") {
@Description("Command to test wether Cherbot is still active. If Cherbot works, it will respond \"pong\".")
- @Examples({"ping"})
+ @Examples({ "ping" })
public void performImpl() {
answer("pong");
}
};
new Command("quit[.!]?") {
@Description("Quit Cherbot.")
- @Examples({"Quit!"})
+ @Examples({ "Quit!" })
@Override public void performImpl() {
checkPermission(new CherBotPermission(PERM_QUIT));
answer("Quitting.");
@@ -651,14 +726,17 @@
// private final String[] permissions = { PERM_SAVE, PERM_LOAD };
- /** Create an internal manager.
+ /**
+ * Create an internal manager.
* @param cherBot Cher Bot
*/
InternalManager(final CherBot cherBot) {
super(cherBot, "topics");
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
@Override public void help() {
final StringBuilder topics = new StringBuilder();
for (Manager manager : managers) {
@@ -678,18 +756,26 @@
// return permissions;
//}
- /** What's new. */
+ /**
+ * What's new.
+ */
private void whatsNew() {
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(new FileInputStream("news.txt")));
final StringBuilder sb = new StringBuilder();
- for (String line; (line = in.readLine()) != null; sb.append(line).append('\n'));
+ for (String line; (line = in.readLine()) != null; sb.append(line).append('\n')) {
+ ;
+ }
answer(sb.toString());
} catch (IOException e) {
answer("No news available.");
} finally {
- try { in.close(); } catch (Exception e) { /* ignore */ } finally { in = null; }
+ try {
+ in.close();
+ } catch (Exception e) { /* ignore */ } finally {
+ in = null;
+ }
}
}
@@ -707,6 +793,7 @@
}
}
}
+
@Override public void load() {
for (Manager manager : managers) {
if (manager != InternalManager.this) {
Modified: trunk/src/net/sf/cherbot/CherBotException.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBotException.java 2006-10-28 22:29:28 UTC (rev 15)
+++ trunk/src/net/sf/cherbot/CherBotException.java 2006-10-28 22:32:24 UTC (rev 16)
@@ -6,7 +6,8 @@
package net.sf.cherbot;
-/** Base Exception for exteptions that could occur when using players.
+/**
+ * Base Exception for exteptions that could occur when using players.
* These exceptions are runtime exceptions thrown if actors use illegal arguments or commands in a wrong state.
* The message of such an exception must be a message meaningful to the end user (bot user).
* @author $Author: chris $
@@ -14,13 +15,18 @@
*/
public class CherBotException extends RuntimeException {
- /** Version information */
+ /**
+ * Version information
+ */
public static final String version = "$Revision: 1.3 $";
- /** Serial Version. */
+ /**
+ * Serial Version.
+ */
private static final long serialVersionUID = 1L;
- /** Create a CherBotException.
+ /**
+ * Create a CherBotException.
* @param msg Message (displayed to end user)
*/
public CherBotException(final String msg) {
Modified: trunk/src/net/sf/cherbot/CherBotLogger.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBotLogger.java 2006-10-28 22:29:28 UTC (rev 15)
+++ trunk/src/net/sf/cherbot/CherBotLogger.java 2006-10-28 22:32:24 UTC (rev 16)
@@ -10,25 +10,33 @@
import java.io.IOException;
import java.io.PrintWriter;
-/** This class is used for logging within Cherbot.
+/**
+ * This class is used for logging within Cherbot.
* @author $Author: chris $
* @version $Id: CherBotLogger.java,v 1.2 2005/08/31 13:55:28 chris Exp $
*/
public class CherBotLogger {
- /** Version information */
+ /**
+ * Version information
+ */
public static final String version = "$Revision: 1.2 $";
- /** The logger. */
+ /**
+ * The logger.
+ */
private PrintWriter log;
- /** Create a logger. */
- @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"})
+ /**
+ * Create a logger.
+ */
+ @SuppressWarnings({ "IOResourceOpenedButNotSafelyClosed" })
public CherBotLogger() throws IOException {
log = new PrintWriter(new FileWriter("log.txt", true));
}
- /** Log something said.
+ /**
+ * Log something said.
* @param who Who said it
* @param msg What he said
*/
@@ -36,7 +44,8 @@
log.append("[say] ").append(who).append(": ").append(msg).println();
}
- /** Log something told.
+ /**
+ * Log something told.
* @param who Who told it
* @param msg What he told
*/
@@ -44,7 +53,8 @@
log.append("[tell] ").append(who).append(": ").append(msg).println();
}
- /** Log something shouted.
+ /**
+ * Log something shouted.
* @param who Who shouted it
* @param msg What he shouted
*/
@@ -52,7 +62,8 @@
log.append("[shout] ").append(who).append(": ").append(msg).println();
}
- /** Log a successful command.
+ /**
+ * Log a successful command.
* @param who Who invoked it
* @param msg Message that triggered command
* @param cmd Command
@@ -61,17 +72,19 @@
log.append("[cmd] ").append("[").append(cmd.getManager().getTopic()).append("]").append(who).append(": ").append(msg).println();
}
- /** Log an unsuccessful command.
+ /**
+ * Log an unsuccessful command.
* @param who Who invoked it
* @param msg Message that triggered command
* @param cmd Command
- * @param ex Exception that made the command fail
+ * @param ex Exception that made the command fail
*/
public void fail(final String who, final String msg, final Manager.Command cmd, final Exception ex) {
log.append("[fail] ").append("[").append(cmd.getManager().getTopic()).append("]").append(who).append(": ").append(msg).append("!").append(ex.toString()).println();
}
- /** Log that a command wasn't found.
+ /**
+ * Log that a command wasn't found.
* @param who Who tried to command
* @param msg Message that didn't trigger a command
*/
Modified: trunk/src/net/sf/cherbot/CherBotPermission.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBotPermission.java 2006-10-28 22:29:28 UTC (rev 15)
+++ trunk/src/net/sf/cherbot/CherBotPermission.java 2006-10-28 22:32:24 UTC (rev 16)
@@ -8,19 +8,25 @@
import java.security.BasicPermission;
-/** Permissions to access the CherBot.
+/**
+ * Permissions to access the CherBot.
* @author $Author: chris $
* @version $Id: CherBotPermission.java,v 1.1 2005/03/01 09:14:02 chris Exp $
*/
public class CherBotPermission extends BasicPermission {
- /** Version information */
+ /**
+ * Version information
+ */
public static final String version = "$Revision: 1.1 $";
- /** Serial Version. */
+ /**
+ * Serial Version.
+ */
private static final long serialVersionUID = 1L;
- /** Create a CherBotPermission.
+ /**
+ * Create a CherBotPermission.
* @param name name
*/
public CherBotPermission(final String name) {
Modified: trunk/src/net/sf/cherbot/CherBotSecurityManager.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBotSecurityManager.java 2006-10-28 22:29:28 UTC (rev 15)
+++ trunk/src/net/sf/cherbot/CherBotSecurityManager.java 2006-10-28 22:32:24 UTC (rev 16)
@@ -23,37 +23,51 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-/** SecurityManager for CherBot.
+/**
+ * SecurityManager for CherBot.
* The CherBotSecurityManager manages the permissions granted for the individual modules and actions.
* @author $Author: chris $
* @version $Id: CherBotSecurityManager.java,v 1.17 2005/11/09 20:30:00 chris Exp $
*/
@Manager.Description("Cherbot has a sophisticated security system, derived from Java. It is comparable with JAAS, the security concept used in Java application servers. This module controls security.")
-@Manager.Features({"Grant permissions", "Revoke permissions", "List permissions"})
+@Manager.Features({ "Grant permissions", "Revoke permissions", "List permissions" })
public class CherBotSecurityManager extends Manager {
- /** Version information */
+ /**
+ * Version information
+ */
public static final String version = "$Revision: 1.17 $";
- /** Permission to grant permissions. */
- private static final String PERM_GRANT = "Security.Grant";
+ /**
+ * Permission to grant permissions.
+ */
+ private static final String PERM_GRANT = "Security.Grant";
- /** Permission to revoke permissions. */
- private static final String PERM_REVOKE = "Security.Revoke";
+ /**
+ * Permission to revoke permissions.
+ */
+ private static final String PERM_REVOKE = "Security.Revoke";
- /** Permission to list own permissions. */
- private static final String PERM_LIST_OWN = "Security.List.Own";
+ /**
+ * Permission to list own permissions.
+ */
+ private static final String PERM_LIST_OWN = "Security.List.Own";
- /** Permission to list other player's permissions. */
+ /**
+ * Permission to list other player's permissions.
+ */
private static final String PERM_LIST_OTHER = "Security.List";
- /** The Permissions.
+ /**
+ * The Permissions.
* Key: player name.
* Value: Set with permission names.
*/
- private Map<String,Permissions> permissions = new HashMap<String,Permissions>();
+ private Map<String, Permissions> permissions = new HashMap<String, Permissions>();
- /** NullStringComparator. */
+ /**
+ * NullStringComparator.
+ */
private Comparator<String> nullStringComparator = new Comparator<String>() {
public int compare(final String o1, final String o2) {
if (o1 == null && o2 == null) {
@@ -72,7 +86,7 @@
/* Grant command. */
new Command("(?:grant|allow) $PLAYER(?: access| permission)?(?: to| on)? (.*?)[.!]?") {
@Description("Grants someone the permission to do something.")
- @Examples({"Grant Michtoen permission on *.", "Allow Michtoen access to *.", "Allow Tehrtapimp to Greetings.Set.Own."})
+ @Examples({ "Grant Michtoen permission on *.", "Allow Michtoen access to *.", "Allow Tehrtapimp to Greetings.Set.Own." })
@Override public void performImpl() {
grant(player(1), gr(2));
}
@@ -81,7 +95,7 @@
/* Revoke command. */
new Command("(?:deny|revoke) $PLAYER(?:'s?)?(?: access| permission)?(?: to| on)? (.*?)[.!]?") {
@Description("Revokes someone's permission to do something.")
- @Examples({"Deny Tehrtapimp to Greetings.Set.Own."})
+ @Examples({ "Deny Tehrtapimp to Greetings.Set.Own." })
@Override public void performImpl() {
revoke(player(1), gr(2));
}
@@ -90,7 +104,7 @@
/* List command. */
new Command("(?:$LIST|what (?:are|r)) my permissions[.!?]?") {
@Description("Shows what permissions you have.")
- @Examples({"What are my permissions?", "Show me my permissions."})
+ @Examples({ "What are my permissions?", "Show me my permissions." })
@Override public void performImpl() {
list(getCherBot().getActor());
}
@@ -99,7 +113,7 @@
/* List command. */
new Command("(?:$LIST|what (?:are|r)) $PLAYER(?:'s?)? permissions[.!?]?") {
@Description("Lists somebody else's permissions.")
- @Examples({"List Michtoen's permissions."})
+ @Examples({ "List Michtoen's permissions." })
@Override public void performImpl() {
list(player(1));
}
@@ -108,7 +122,7 @@
/* List command. */
new Command("$LIST permissions[.!]?") {
@Description("Lists all permissoins.")
- @Examples({"List permissions."})
+ @Examples({ "List permissions." })
@Override public void performImpl() {
final SortedSet<String> players = new TreeSet<String>(nullStringComparator);
players.addAll(permissions.keySet());
@@ -119,14 +133,17 @@
};
} // Commands
- /** Create the SecurityManager. */
+ /**
+ * Create the SecurityManager.
+ */
public CherBotSecurityManager(final CherBot cherBot) {
super(cherBot, "security");
final Permissions pm = new Permissions();
pm.add(new AllPermission());
}
- /** Get the String to add to a grant / revoke permission for checking.
+ /**
+ * Get the String to add to a grant / revoke permission for checking.
* @param permission permission to get String from
* @return part
*/
@@ -136,21 +153,26 @@
return m.matches() ? '.' + m.group(1) : "";
}
- /** Grant permission to someone on something.
- * @param player to whome are permissions granted
+ /**
+ * Grant permission to someone on something.
+ * @param player to whome are permissions granted
* @param permission Permission to grant
*/
private void grant(final String player, final String permission) {
checkPermission(PERM_GRANT + getPart(permission));
Permissions perms = permissions.get(player);
- if (perms == null) { perms = new Permissions(); permissions.put(player, perms); }
+ if (perms == null) {
+ perms = new Permissions();
+ permissions.put(player, perms);
+ }
perms.add(new CherBotPermission(permission));
answer("Granted " + permission + "-permission to " + player);
tell(player, getActor() + " granted you " + permission + "-permission.");
}
- /** Revoke permission to someoneon something
- * @param player whose permissions are to be revoked
+ /**
+ * Revoke permission to someoneon something
+ * @param player whose permissions are to be revoked
* @param permission Permissions to revoke
*/
private void revoke(final String player, final String permission) {
@@ -159,7 +181,8 @@
tell(player, getActor() + " revoked your " + permission + "-permission.");
}
- /** List permissons.
+ /**
+ * List permissons.
* @param player whose permissions to list
*/
private void list(final String player) {
@@ -179,26 +202,32 @@
}
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
@Override public void help() {
answer("The Security engine controls access on the different bot functions that I have. If you're unsure about wether to first write the permissions or first write the player in a command, first write the player, then the permissions.");
}
- /** Check wether a player has a certain permission.
+ /**
+ * Check wether a player has a certain permission.
* @param player Player to check
- * @param perm Permission to check
+ * @param perm Permission to check
*/
public void checkPermissionImpl(final String player, final CherBotPermission perm) {
checkPermissionImpl(player, perm, "I don't want to.");
}
- /** Check wether a player has a certain permission.
+ /**
+ * Check wether a player has a certain permission.
* @param player Player to check
- * @param perm Permission to check
- * @param msg Message to use in case the permission isn't granted
+ * @param perm Permission to check
+ * @param msg Message to use in case the permission isn't granted
*/
public void checkPermissionImpl(final String player, final CherBotPermission perm, final String msg) {
- if (player == null) { return; } // console
+ if (player == null) {
+ return;
+ } // console
final Permissions perms = permissions.get(player);
if (perms == null || !perms.implies(perm)) {
System.err.println("Security: Permission denied for " + player + ": " + perm + "(perms: " + perms + ")");
@@ -207,18 +236,23 @@
System.err.println("Security: Permission granted to " + player + " for " + perm);
}
- /** Return wether a player has a certain permission.
+ /**
+ * Return wether a player has a certain permission.
* @param player Player to check
- * @param perm Permission to check
+ * @param perm Permission to check
* @return <code>ture</code> if and only if player has permissoin
*/
public boolean hasPermissionImpl(final String player, final String perm) {
- if (player == null) { return true; } // console
+ if (player == null) {
+ return true;
+ } // console
final Permissions perms = permissions.get(player);
return perms != null && perms.implies(new CherBotPermission(perm));
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
@Override public void load() throws IOException {
// Text interface (unfinished):
//BufferedReader in = null;
@@ -241,11 +275,17 @@
ioe.initCause(e);
throw ioe;
} finally {
- try { in.close(); } catch (Exception e) { /* ignore */ } finally { in = null; }
+ try {
+ in.close();
+ } catch (Exception e) { /* ignore */ } finally {
+ in = null;
+ }
}
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
@Override public void save() throws IOException {
// Text interface (loading is unfinished):
//PrintWriter out = null;
@@ -272,7 +312,11 @@
out = new ObjectOutputStream(new FileOutputStream("security.dat"));
out.writeObject(permissions);
} finally {
- try { out.close(); } catch (Exception e) { /* ignore */ } finally { out = null; }
+ try {
+ out.close();
+ } catch (Exception e) { /* ignore */ } finally {
+ out = null;
+ }
}
}
Modified: trunk/src/net/sf/cherbot/CollectionsManager.java
===================================================================
--- trunk/src/net/sf/cherbot/CollectionsManager.java 2006-10-28 22:29:28 UTC (rev 15)
+++ trunk/src/net/sf/cherbot/CollectionsManager.java 2006-10-28 22:32:24 UTC (rev 16)
@@ -16,38 +16,49 @@
import java.util.TreeSet;
import java.util.regex.Matcher;
-/** Manager for collectors.
+/**
+ * Manager for collectors.
* @author $Author: chris $
* @version $Id: CollectionsManager.java,v 1.21 2005/11/09 20:30:00 chris Exp $
*/
@Manager.Description("This module allows players to manage a list of items they collect. You can also ask what other players collect or who collects a certain item. Like most modules, querying works also if the queried player is not online.")
@Manager.Features({
- "Manage your own list of collectables by adding to, removing from and clearing your list.",
- "Query what another player collects.",
- "Query which players collect a certain collectable."
-})
+ "Manage your own list of collectables by adding to, removing from and clearing your list.",
+ "Query what another player collects.",
+ "Query which players collect a certain collectable."
+ })
public class CollectionsManager extends Manager {
- /** Version information */
+ /**
+ * Version information
+ */
public static final String version = "$Revision: 1.21 $";
- /** Permission to collect. */
+ /**
+ * Permission to collect.
+ */
private static final String PERM_COLLECT = "Collections.Edit";
- /** Entry.
+ /**
+ * Entry.
* @author $Author: chris $
* @version $Revision: 1.21 $
*/
private static class Entry implements Comparable<Entry> {
- /** Collector. */
+ /**
+ * Collector.
+ */
private final String collector;
- /** Collectable. */
+ /**
+ * Collectable.
+ */
private final String collectable;
- /** Create an Entry.
- * @param collector Collector
+ /**
+ * Create an Entry.
+ * @param collector Collector
* @param collectable Collectable
*/
Entry(final String collector, final String collectable) {
@@ -55,7 +66,9 @@
this.collectable = collectable;
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
@Override public boolean equals(final Object obj) {
if (obj == null || !(obj instanceof Entry)) {
return false;
@@ -64,12 +77,16 @@
return collector.equals(e.collector) && collectable.equals(e.collectable);
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
@Override public int hashCode() {
return collector.hashCode() ^ collectable.hashCode();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public int compareTo(final Entry e) {
int ret = collector.compareTo(e.collector);
if (ret == 0) {
@@ -80,20 +97,26 @@
} // class Entry
- /** Table. */
+ /**
+ * Table.
+ */
private Set<Entry> collections = new HashSet<Entry>();
- /** Listeners. */
+ /**
+ * Listeners.
+ */
private Set<String> listeners = new HashSet<String>();
- /** Command subpattern for collecting. */
+ /**
+ * Command subpattern for collecting.
+ */
public static final String C_COLLECT = "(?:buy|collect|need|purchase)";
{ // Commands
// TODO: add need, purchase, want and buy as verbs along with collects
new Command("what (?:items )?$COLLECTs (\\S+?)[?]?") {
@Description("Lists what items a person collects.")
- @Examples({"What items collects Nakron?", "What collects Nakron?"})
+ @Examples({ "What items collects Nakron?", "What collects Nakron?" })
@Override public void performImpl() {
listCollectablesFor(player(1));
}
@@ -101,7 +124,7 @@
new Command("(?:who (?:$COLLECTs(?: stuff)?|(?:are|r) (?:the )?collectors|is collect(?:or|ing))[?]?|$LIST collectors[.!]?)") {
@Description("Lists which players collect items.")
- @Examples({"Who collects?", "Who collects stuff?", "Who are the collectors?", "Who is collecting?", "List collectors."})
+ @Examples({ "Who collects?", "Who collects stuff?", "Who are the collectors?", "Who is collecting?", "List collectors." })
@Override public void performImpl() {
listCollectors();
}
@@ -109,7 +132,7 @@
new Command("(?:what(?:'s| is|(?: items)? (?:are|r)) (?:collected|(?:the |a )?collectables?)[?]?|$LIST collectables[.!]?)") {
@Description("Lists what items are collected.")
- @Examples({"What are the collectables?", "What items are collected?", "What is collectable?", "List collectables."})
+ @Examples({ "What are the collectables?", "What items are collected?", "What is collectable?", "List collectables." })
@Override public void performImpl() {
listCollectables();
}
@@ -117,7 +140,7 @@
new Command("(?:any(?:body|one) $COLLECTs|does any(?:body|one) $COLLECT|Is any(?:body|one) $COLLECTing|who(?:(?:'s| is) $COLLECTing| $COLLECTs| does $COLLECT)) (.*?)[?]?") {
@Description("Lists who collects a certain item. Be sure to double check. If a search for \"shield\" yields a player, check wether he really collects the kind of shield you have - perhaps he/she only collects certain types of shields. It is recommended to ask the terms in singular form.")
- @Examples({"Anyone collects shield?", "Who collects gem?", "Is anybody collecting jewel?"})
+ @Examples({ "Anyone collects shield?", "Who collects gem?", "Is anybody collecting jewel?" })
@Override public void performImpl() {
listCollectorsFor(collectable(gr(1)));
}
@@ -125,7 +148,7 @@
new Command("(?:any(?:body|one) online $COLLECTs|does any(?:body|one) online $COLLECT|is any(?:body|one) online $COLLECTing|who(?:(?:'s| is) online $COLLECTing| online $COLLECTs| online does $COLLECT)) (.*?)[?]?") {
@Description("Lists who collects a certain item. Be sure to double check. If a search for \"shield\" yields a player, check wether he really collects the kind of shield you have - perhaps he/she only collects certain types of shields. It is recommended to ask the terms in singular form.")
- @Examples({"Anyone online collects shield?", "Who online collects gem?", "Is anybody online collecting jewel?"})
+ @Examples({ "Anyone online collects shield?", "Who online collects gem?", "Is anybody online collecting jewel?" })
@Override public void performImpl() {
listOnlineCollectorsFor(collectable(gr(1)));
}
@@ -133,7 +156,7 @@
new Command("what(?:'s|(?: items)? is| does) $PLAYER $COLLECT(?:ing)?[?]?") {
@Description("Lists what items a person collects.")
- @Examples({"What's Nakron collecting?", "What items is Nakron collecting?", "What does Nakron collect?"})
+ @Examples({ "What's Nakron collecting?", "What items is Nakron collecting?", "What does Nakron collect?" })
@Override public void performImpl() {
listCollectablesFor(player(1));
}
@@ -141,7 +164,7 @@
new Command("I(?: $COLLECT nothing|(?: do(?:n'?t| not) $COLLECT|(?:'m| am) not $COLLECTing) anything)[.]?") {
@Description("Tells cherbot to completely discard your list of collections. Use it if you start over with a new initially empty list.")
- @Examples({"I collect nothing."})
+ @Examples({ "I collect nothing." })
@Override public void performImpl() {
clearCollects(getActor());
}
@@ -149,14 +172,14 @@
new Command("I(?:(?: am|'m) $COLLECTing| $COLLECT) (.*?)[.]?") {
@Description("Informs Cherbot of what you collect. Maybe you're interested in using different spellings if more than one spelling is common. Hint: use / for alternatives.")
- @Examples({"I collect rings, amulets, ammys, crowns and bracers.", "I collect slash/pierce weapons, rings/ammys (hp+/pierce protection) and cursed/damned potions."})
+ @Examples({ "I collect rings, amulets, ammys, crowns and bracers.", "I collect slash/pierce weapons, rings/ammys (hp+/pierce protection) and cursed/damned potions." })
@Override public void performImpl() {
collect(getActor(), collectables(gr(1)));
}
};
new Command("$PLAYER(?:(?: is|'s) $COLLECTing| $COLLECTs) nothing[.]?") {
@Description("Informs Cherbot that another person collects nothing.")
- @Examples({"Cherbot collects nothing."})
+ @Examples({ "Cherbot collects nothing." })
@Override public void performImpl() {
clearCollects(player(1));
}
@@ -164,7 +187,7 @@
new Command("$PLAYER(?:(?: is|'s) $COLLECTing| $COLLECTs) (.*?)[.]?") {
@Description("Informs Cherbot that another person collects something.")
- @Examples({"Cherbot collects dust."})
+ @Examples({ "Cherbot colle...
[truncated message content] |