cherbot-commit Mailing List for CherBot (Page 5)
Status: Alpha
Brought to you by:
christianhujer
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(39) |
Nov
(1) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
(67) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
(1) |
Nov
|
Dec
|
| 2008 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(6) |
Dec
(19) |
| 2009 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <chr...@us...> - 2007-06-09 14:40:42
|
Revision: 49
http://svn.sourceforge.net/cherbot/?rev=49&view=rev
Author: christianhujer
Date: 2007-06-09 07:40:33 -0700 (Sat, 09 Jun 2007)
Log Message:
-----------
Added japi argparser library.
Added Paths:
-----------
trunk/lib/japi-lib-argparser-0.1.jar
Added: trunk/lib/japi-lib-argparser-0.1.jar
===================================================================
(Binary files differ)
Property changes on: trunk/lib/japi-lib-argparser-0.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-06-09 14:40:20
|
Revision: 48
http://svn.sourceforge.net/cherbot/?rev=48&view=rev
Author: christianhujer
Date: 2007-06-09 07:39:55 -0700 (Sat, 09 Jun 2007)
Log Message:
-----------
Added missing annotations license.
Added Paths:
-----------
trunk/lib/LICENSE-annotations.jar
Added: trunk/lib/LICENSE-annotations.jar
===================================================================
--- trunk/lib/LICENSE-annotations.jar (rev 0)
+++ trunk/lib/LICENSE-annotations.jar 2007-06-09 14:39:55 UTC (rev 48)
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
Property changes on: trunk/lib/LICENSE-annotations.jar
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ LF
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-06-09 14:22:45
|
Revision: 47
http://svn.sourceforge.net/cherbot/?rev=47&view=rev
Author: christianhujer
Date: 2007-06-09 07:22:44 -0700 (Sat, 09 Jun 2007)
Log Message:
-----------
Added unit test tree.
Modified Paths:
--------------
trunk/cherbot.iml
Added Paths:
-----------
trunk/src/test/
trunk/src/test/net/
trunk/src/test/net/sf/
trunk/src/test/net/sf/cherbot/
Modified: trunk/cherbot.iml
===================================================================
--- trunk/cherbot.iml 2007-06-09 14:02:47 UTC (rev 46)
+++ trunk/cherbot.iml 2007-06-09 14:22:44 UTC (rev 47)
@@ -6,6 +6,7 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" packagePrefix="test" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-06-09 14:02:52
|
Revision: 46
http://svn.sourceforge.net/cherbot/?rev=46&view=rev
Author: christianhujer
Date: 2007-06-09 07:02:47 -0700 (Sat, 09 Jun 2007)
Log Message:
-----------
Removed old code, updated requirements.
Modified Paths:
--------------
trunk/cherbot.iml
trunk/cherbot.ipr
trunk/src/doc/requirements2.0.xhtml
Removed Paths:
-------------
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.iml
===================================================================
--- trunk/cherbot.iml 2007-06-08 19:41:29 UTC (rev 45)
+++ trunk/cherbot.iml 2007-06-09 14:02:47 UTC (rev 46)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="DependecySynchronizer" />
<component name="ModuleRootManager" />
<component name="NewModuleRootManager" inherit-compiler-output="true">
Modified: trunk/cherbot.ipr
===================================================================
--- trunk/cherbot.ipr 2007-06-08 19:41:29 UTC (rev 45)
+++ trunk/cherbot.ipr 2007-06-09 14:02:47 UTC (rev 46)
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project version="4" relativePaths="true">
+<project relativePaths="true" version="4">
<component name="AntConfiguration">
<defaultAnt bundledAnt="true" />
</component>
<component name="BuildJarProjectSettings">
<option name="BUILD_JARS_ON_MAKE" value="false" />
</component>
+ <component name="ClearCase" />
<component name="CodeStyleProjectProfileManger">
<option name="PROJECT_PROFILE" />
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
@@ -42,6 +43,15 @@
<option name="METHOD_ANNOTATION_WRAP" value="1" />
<option name="CLASS_ANNOTATION_WRAP" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="1" />
+ <ADDITIONAL_INDENT_OPTIONS fileType="js">
+ <option name="INDENT_SIZE" value="4" />
+ <option name="CONTINUATION_INDENT_SIZE" value="8" />
+ <option name="TAB_SIZE" value="4" />
+ <option name="USE_TAB_CHARACTER" value="false" />
+ <option name="SMART_TABS" value="false" />
+ <option name="LABEL_INDENT_SIZE" value="0" />
+ <option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ </ADDITIONAL_INDENT_OPTIONS>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
@@ -94,7 +104,7 @@
<option name="MAXIMUM_HEAP_SIZE" value="128" />
</component>
<component name="EntryPointsManager">
- <entry_points />
+ <entry_points version="2.0" />
</component>
<component name="ExportToHTMLSettings">
<option name="PRINT_LINE_NUMBERS" value="false" />
@@ -135,7 +145,9 @@
<option name="ignoreLocalVariables" value="false" />
<option name="ignorePrivateMethodsAndFields" value="false" />
</inspection_tool>
- <inspection_tool class="FeatureEnvy" level="WARNING" enabled="true" />
+ <inspection_tool class="FeatureEnvy" level="WARNING" enabled="true">
+ <option name="ignoreTestCases" value="false" />
+ </inspection_tool>
<inspection_tool class="InstanceofThis" level="WARNING" enabled="true" />
<inspection_tool class="MagicNumber" level="WARNING" enabled="true">
<option name="m_ignoreInHashCode" value="true" />
@@ -191,7 +203,9 @@
</inspection_tool>
<inspection_tool class="ThrowablePrintStackTrace" level="WARNING" enabled="true" />
<inspection_tool class="ThreadDumpStack" level="WARNING" enabled="true" />
- <inspection_tool class="ObsoleteCollection" level="WARNING" enabled="true" />
+ <inspection_tool class="ObsoleteCollection" level="WARNING" enabled="true">
+ <option name="ignoreLibraryArguments" value="false" />
+ </inspection_tool>
<inspection_tool class="SystemOutErr" level="WARNING" enabled="true" />
<inspection_tool class="UseOfAnotherObjectsPrivateField" level="WARNING" enabled="true" />
<inspection_tool class="AssignmentToCollectionFieldFromParameter" level="WARNING" enabled="true">
@@ -204,8 +218,12 @@
<inspection_tool class="PackageVisibleInnerClass" level="WARNING" enabled="true" />
<inspection_tool class="ProtectedField" level="WARNING" enabled="true" />
<inspection_tool class="ProtectedInnerClass" level="WARNING" enabled="true" />
- <inspection_tool class="PublicField" level="WARNING" enabled="true" />
- <inspection_tool class="PublicInnerClass" level="WARNING" enabled="true" />
+ <inspection_tool class="PublicField" level="WARNING" enabled="true">
+ <option name="ignoreEnums" value="false" />
+ </inspection_tool>
+ <inspection_tool class="PublicInnerClass" level="WARNING" enabled="true">
+ <option name="ignoreEnums" value="false" />
+ </inspection_tool>
<inspection_tool class="ReturnOfCollectionField" level="WARNING" enabled="true">
<option name="ignorePrivateMethods" value="true" />
</inspection_tool>
@@ -305,7 +323,7 @@
<option name="m_maxLength" value="64" />
</inspection_tool>
<inspection_tool class="BooleanMethodNameMustStartWithQuestion" level="WARNING" enabled="true">
- <option name="nameCheckString" value="is,can,has,should,could,will,shall,check,contains,equals,add,put,remove,startsWith,endsWith" />
+ <option name="questionString" value="is,can,has,should,could,will,shall,check,contains,equals,add,put,remove,startsWith,endsWith" />
</inspection_tool>
<inspection_tool class="ClassNameSameAsAncestorName" level="WARNING" enabled="true" />
<inspection_tool class="ClassNamingConvention" level="WARNING" enabled="true">
@@ -361,7 +379,7 @@
<option name="m_maxLength" value="20" />
</inspection_tool>
<inspection_tool class="NonBooleanMethodNameMayNotStartWithQuestion" level="WARNING" enabled="true">
- <option name="nameCheckString" value="is,can,has,should,could,will,shall,check,contains,equals,startsWith,endsWith" />
+ <option name="questionString" value="is,can,has,should,could,will,shall,check,contains,equals,startsWith,endsWith" />
</inspection_tool>
<inspection_tool class="UpperCaseFieldNameNotConstant" level="WARNING" enabled="true" />
<inspection_tool class="NonExceptionNameEndsWithException" level="WARNING" enabled="true" />
@@ -508,7 +526,9 @@
<inspection_tool class="EmptyClass" level="WARNING" enabled="true" />
<inspection_tool class="FinalMethodInFinalClass" level="WARNING" enabled="true" />
<inspection_tool class="MissingDeprecatedAnnotation" level="WARNING" enabled="true" />
- <inspection_tool class="MissingOverrideAnnotation" level="WARNING" enabled="true" />
+ <inspection_tool class="MissingOverrideAnnotation" level="WARNING" enabled="true">
+ <option name="useJdk6Rules" value="false" />
+ </inspection_tool>
<inspection_tool class="MultipleTopLevelClassesInFile" level="WARNING" enabled="true" />
<inspection_tool class="NoopMethodInAbstractClass" level="WARNING" enabled="true" />
<inspection_tool class="ProtectedMemberInFinalClass" level="WARNING" enabled="true" />
@@ -849,6 +869,13 @@
<output url="file://$PROJECT_DIR$/ideaclasses" />
</component>
<component name="ProjectRunConfigurationManager" />
+ <component name="ResourceManagerContainer">
+ <option name="myResourceBundles">
+ <value>
+ <list size="0" />
+ </value>
+ </option>
+ </component>
<component name="RmicSettings">
<option name="IS_EANABLED" value="false" />
<option name="DEBUGGING_INFO" value="true" />
@@ -857,6 +884,10 @@
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
</component>
<component name="StarteamVcsAdapter" />
+ <component name="SvnBranchConfigurationManager" />
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="svn" />
+ </component>
<component name="VssVcs" />
<component name="com.intellij.jsf.UserDefinedFacesConfigs">
<option name="USER_DEFINED_CONFIGS">
@@ -1085,6 +1116,5 @@
<option name="COPY_FORMS_RUNTIME_TO_OUTPUT" value="true" />
<option name="DEFAULT_LAYOUT_MANAGER" value="GridLayoutManager" />
</component>
- <UsedPathMacros />
</project>
Modified: trunk/src/doc/requirements2.0.xhtml
===================================================================
--- trunk/src/doc/requirements2.0.xhtml 2007-06-08 19:41:29 UTC (rev 45)
+++ trunk/src/doc/requirements2.0.xhtml 2007-06-09 14:02:47 UTC (rev 46)
@@ -26,5 +26,14 @@
<li>Web interface.</li>
<li>Graphical user interface.</li>
</ul>
+ <h2>Detailed requirements</h2>
+ <ul>
+ <li>CherBot must work for Daimonin.</li>
+ <li>CherBot must work for Crossfire.</li>
+ <li>CherBot must work for IRC.</li>
+ <li>CherBot must be able to connect to more than one server.</li>
+ <li>CherBot must maintain groups called clans.</li>
+ <li>CherBot must be able to act as a communication proxy / multiplexer for members of a clan.</li>
+ </ul>
</body>
</html>
Deleted: trunk/src/net/sf/cherbot/BlackListManager.java
===================================================================
--- trunk/src/net/sf/cherbot/BlackListManager.java 2007-06-08 19:41:29 UTC (rev 45)
+++ trunk/src/net/sf/cherbot/BlackListManager.java 2007-06-09 14:02:47 UTC (rev 46)
@@ -1,134 +0,0 @@
-/*
- * Copyright © 2006, Christian Hujer and the CherBot developers. All Rights Reserved.
- * License: GNU General Public License v2.0 or newer.
- * See file COPYING in the root directory of this project.
- */
-
-package net.sf.cherbot;
-
-import java.util.SortedSet;
-import java.util.TreeSet;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Manages a black list of users that may not use Cherbot.
- * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
- */
-@Manager.Description("Blacklist of players that are denied to use Cherbot.")
-@Manager.Features({ "Blacklist players that are denied to use Cherbot." })
-public class BlackListManager extends Manager {
-
- /**
- * Permission to modify blacklist.
- */
- private static final String PERM_BLACKLIST = "Blacklist";
-
- /**
- * 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?" })
- @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." })
- @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." })
- @Override public void performImpl() {
- removeBlacklist(player(1));
- }
- };
- } // Commands
-
- /**
- * Create the BlackListManager.
- * @param cherbot CherBot
- */
- public BlackListManager(@NotNull final CherBot cherbot) {
- super(cherbot, "blacklist");
- }
-
- /**
- * List the blacklist.
- */
- private void listBlacklist() {
- if (blacklist.size() == 0) {
- answer("Noone's on the blacklist yet.");
- } else {
- final StringBuilder sb = new StringBuilder();
- sb.append("The following players are blacklisted: ");
- concat(sb, blacklist);
- sb.append('.');
- answer(sb.toString());
- }
- }
-
- /**
- * Puts a player to the blacklist.
- * @param player Player to blacklist
- */
- private void addBlacklist(@NotNull final String player) {
- checkPermission(PERM_BLACKLIST);
- if (blacklist.add(player)) {
- answer("Added " + player + " to the blacklist.");
- tell(player, getActor() + " has put you on the blacklist. You cannot use Cherbot anymore.");
- } else {
- answer(player + " already was on the blacklist.");
- }
- }
-
- /**
- * Removes a player from the blacklist.
- * @param player Player to remove
- */
- private void removeBlacklist(@NotNull final String player) {
- checkPermission(PERM_BLACKLIST);
- if (blacklist.remove(player)) {
- answer("Removed " + player + " from the blacklist.");
- tell(player, getActor() + " has removed you from the blacklist. You can use Cherbot again.");
- } else {
- answer(player + " wasn't blacklisted anyway.");
- }
- }
-
- /**
- * Checks wether a player is blacklisted.
- * @param player Player to check
- * @return <code>true</code> if <var>player</var> is blacklisted, otherwise <code>false</code>.
- */
- public boolean isBlacklisted(@NotNull final String player) {
- return blacklist.contains(player);
- }
-
- /**
- * Checks wether the actor is blacklisted.
- * @return <code>true</code> if the actor is blacklisted, otherwise <code>false</code>.
- */
- public boolean isBlacklisted() {
- return blacklist.contains(getActor());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override public void help() {
- answer("I have a blacklist. Players on the blacklist cannot use Cherbot.");
- }
-
- { // IO Modules
- new CollectionIOModule("blacklist.txt", blacklist, false);
- } // IO Modules
-
-} // class BlackListManager
Deleted: trunk/src/net/sf/cherbot/CherBot.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBot.java 2007-06-08 19:41:29 UTC (rev 45)
+++ trunk/src/net/sf/cherbot/CherBot.java 2007-06-09 14:02:47 UTC (rev 46)
@@ -1,809 +0,0 @@
-/*
- * Copyright © 2006, Christian Hujer and the CherBot developers. All Rights Reserved.
- * License: GNU General Public License v2.0 or newer.
- * See file COPYING in the root directory of this project.
- */
-
-package net.sf.cherbot;
-
-
-import java.io.BufferedReader;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.text.BreakIterator;
-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.
- * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
- * @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.
- */
-public class CherBot {
-
- /**
- * Lihes of code.
- */
- private static final int LINES_OF_CODE = 11137;
-
- /**
- * 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.
- */
- private String username;
-
- /**
- * The password this bot sohuld use for connecting with the server.
- */
- private String password;
-
- /**
- * 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.
- */
- private InternalManager internalManager;
-
- /**
- * The Blacklist manager.
- */
- private BlackListManager blacklistManager;
-
- /**
- * The Player manager.
- */
- private PlayerManager playerManager;
-
- /**
- * 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.
- * The basic association relation between the bot (1) and the managers (n) is a bidirectional composition.
- */
- private List<Manager> managers = new ArrayList<Manager>();
-
- /**
- * 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>();
-
- /**
- * The Managers with timers.
- */
- private List<Manager> timers = new ArrayList<Manager>();
-
- /**
- * The Commands.
- * The order is important, this must be a List.
- */
- private List<Command> commands = new ArrayList<Command>();
-
- /**
- * Main program.
- * @param args command line arguments
- * @throws IOException in case of I/O problems
- */
- public static void main(final String... args) throws IOException {
- final CherBot bot = new CherBot();
- bot.connect(args[0], args[1], args[2]);
- bot.run();
- }
-
- /**
- * 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.
- */
- public CherBot() {
- // Add Managers
- // The order is important, since commands (regexes) are searched in the order the managers are constructed.
- // Also some managers require other managers to already exist
- new SmutManager(this);
- securityManager = new CherBotSecurityManager(this);
- internalManager = new InternalManager(this);
- blacklistManager = new BlackListManager(this);
- playerManager = new PlayerManager(this);
- new TimeManager(this);
- new TestManager(this);
- new GreetingsManager(this);
- new LamentsManager(this);
- new CollectionsManager(this);
- //new CrimeManager(this);
- new RodBabyManager(this);
- new RodBabyWannabeManager(this);
- new DeathsManager(this);
- new PollManager(this);
- new SalesManager(this);
- new MailManager(this);
- new EmotesManager(this);
- new GroupManager(this);
- new NoobManager(this);
- }
-
- /**
- * Quit Cherbot.
- */
- public void quit() {
- System.exit(0);
- }
-
- /**
- * 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
- */
- public void addManager(final Manager manager) {
- managers.add(manager);
- if (manager.getTicksDelay() != 0) {
- timers.add(manager);
- }
- managerMap.put(manager.getTopic(), manager);
- }
-
- /**
- * 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
- */
- public Manager getManager(final String topic) {
- return managerMap.get(topic);
- }
-
- /**
- * Get all managers.
- * The returned collection is immutable.
- * @return all managers
- */
- public Collection<Manager> managers() {
- return Collections.unmodifiableList(managers);
- }
-
- /**
- * 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
- */
- public CherBotSecurityManager getSecurityManager() {
- return securityManager;
- }
-
- /**
- * 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
- */
- public void addCommand(final Command command) {
- commands.add(command);
- }
-
- /**
- * Get username used by the bot.
- * @return username
- */
- public String getUsername() {
- return username;
- }
-
- /**
- * Connect to a server.
- * @param username username
- * @param password password
- * @param server Server to connect to
- * @throws IOException if the socket cannot be opened.
- */
- @SuppressWarnings({ "SocketOpenedButNotSafelyClosed" })
- public void connect(final String username, final String password, final String server) throws IOException {
- this.username = username;
- this.password = password;
- try {
- internalManager.load();
- } catch (final Exception e) {
- System.err.println(e);
- }
- //say("food");
- }
-
- /**
- * Keep the bot running.
- * @throws IOException in case of I/O problems
- */
- public void run() throws IOException {
- try {
- while (!stop) {
- }
- } finally {
- try {
- internalManager.save();
- } catch (final Exception e) {
- System.err.println(e);
- }
- }
- }
-
- /**
- * Answer.
- * @param cs String to answer
- */
- public void answer(final CharSequence cs) {
- tell(actor, cs.toString()); // TODO: Improve CharSequence handling
- }
-
- /**
- * Shout.
- * @param s String to shout
- */
- public void shout(final String s) {
- final StringBuilder sb = new StringBuilder();
- for (final String line : lineSplit(s)) {
- sb.setLength(0);
- sb.append("/shout ");
- sb.append(line);
- }
- }
-
- /**
- * Tell.
- * @param p Player name
- * @param s String to tell
- */
- public void tell(final String p, final String s) {
- if (s.length() == 0) {
- return; // nothing to tell.
- }
- if (p == null) {
- println(s);
- } else {
- // either lineSplit or ncom has a bug. Probably lineSplit.
- final StringBuilder sb = new StringBuilder();
- for (final String line : lineSplit(s)) {
- sb.setLength(0);
- }
- }
- }
-
- /**
- * Reply.
- * @param s String to tell
- * @throws IOException in case of I/O problems.
- */
- public void reply(final String s) throws IOException {
- final StringBuilder sb = new StringBuilder();
- for (final String line : lineSplit(s)) {
- sb.setLength(0);
- }
- }
-
- /**
- * Say.
- * @param s String to say
- */
- public void say(final String s) {
- final StringBuilder sb = new StringBuilder();
- for (final String line : lineSplit(s)) {
- sb.setLength(0);
- }
- }
-
- /**
- * Split a String into substrings.
- * @param s String to split
- * @return substrings
- */
- @SuppressWarnings({ "AssignmentToForLoopParameter" })
- private static Iterable<String> lineSplit(final String s) {
- final BreakIterator it = BreakIterator.getLineInstance();
- it.setText(s);
- final List<String> ret = new ArrayList<String>();
- final int width = 230;
- for (int end = it.last(), split = it.first(), current = 0; current <= end;) {
- current = it.next();
- if (current - split > width) {
- current = it.previous();
- if (current == split) {
- current = it.next();
- }
- ret.add(s.substring(split, current));
- split = current;
- } else if (current == end) {
- ret.add(s.substring(split, current));
- current++;
- }
- }
- return ret;
- }
-
- /**
- * Pattern for game entering.
- */
- private static final Pattern enter = Pattern.compile("(\\S+) has entered the game.");
-
- /**
- * Pattern for game kill.
- */
- private static final Pattern kill = Pattern.compile("(.+) killed (\\S+)( with (.*))?.");
-
- /**
- * Dispatch a packet of data.
- * @param data packet to dispatch
- * @throws IOException in case of I/O problems
- */
- private void dispatch(final byte[] data) throws IOException {
- } // 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
- };
-
- /**
- * Switch output to a certain color.
- * @param n color to switch to
- */
- private static void switchColor(final int n) {
- try {
- System.out.print(colors[n]);
- } catch (final ArrayIndexOutOfBoundsException e) {
- System.err.println("Unknown color number: " + n);
- }
- }
-
- /**
- * Handle communication.
- * @param ct Communication Type
- * @param who speaker
- * @param msg message
- * @throws IOException in case of I/O problems
- * @todo this needs to be improved so /shout can also be used to communicate with Cherbot and Cherbot could respond on shout
- */
- 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 (ct == CommType.SHOUT) {
- final Pattern p = Pattern.compile(username + "(?:(?:,|:)? *)(.*)");
- final Matcher matcher = p.matcher(msg);
- if (matcher.matches()) {
- final String cmd = matcher.group(1);
- dispatch(who, cmd);
- }
- } else {
- dispatch(who, msg);
- }
- }
-
- /**
- * Who executes the current / executed the last command.
- */
- private String actor;
-
- /**
- * 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
- * @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
- */
- private synchronized void dispatch(final String who, final String rawCmd) {
- final String cookedCmd = rawCmd.replaceAll("\\s+", " ").trim();
- actor = who;
- if (actor != null && blacklistManager.isBlacklisted()) {
- answer("You are denied.");
- return;
- }
- try {
- for (final Command command : commands) {
- if (command.perform(cookedCmd)) {
- break;
- }
- }
- } catch (final CherBotException e) {
- answer("I can't: " + e.getMessage());
- } catch (final SecurityException e) {
- answer("I don't want to: " + e.getMessage());
- }
- }
-
- /**
- * Handle enter.
- * @param who person that entered.
- */
- private void enter(final String who) {
- for (final Manager manager : managers) {
- manager.entered(who);
- }
- }
-
- /**
- * Handle kill.
- * @param killer Killer
- * @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
- for (final Manager manager : managers) {
- manager.died(who, killer, with);
- }
- }
-
- /**
- * Write a line to stdout.
- * @param s line to write
- */
- private static void println(final String s) {
- System.out.println(s);
- }
-
- /**
- * The internal manager.
- * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
- */
- @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."
- })
- 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. */ {
- 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?" })
- @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!" })
- @Override public void performImpl() {
- checkPermission(new CherBotPermission(PERM_SAVE));
- try {
- save();
- answer("Saved all modules.");
- } catch (final Exception e) {
- answer("Save failed: " + e);
- }
- }
- };
- new Command("save (\\w+)[.!]") {
- @Description("Saves a specific module's data to persistent storage.")
- @Examples({ "Save collections!", "Save sales!" })
- @Override public void performImpl() {
- final String module = matcher.group(1);
- checkPermission(new CherBotPermission(PERM_SAVE + '.' + module));
- try {
- managerMap.get(module).save();
- answer("Saved module " + module + '.');
- } catch (final NullPointerException e) {
- answer("No such module.");
- } catch (final Exception e) {
- answer("Error while saving module " + module + ": " + e);
- }
- }
- };
- new Command("load[.!]?") {
- @Description("Load all module data from persistent storage.")
- @Examples({ "Load!" })
- @Override public void performImpl() {
- checkPermission(new CherBotPermission(PERM_LOAD));
- try {
- load();
- answer("Loaded.");
- } catch (final Exception e) {
- answer("Save failed: " + e);
- }
- }
- };
- new Command("load (\\w+)[.!]?") {
- @Description("Load a specific module's data from persistent storage.")
- @Examples({ "Load collections!", "Load sales!" })
- @Override public void performImpl() {
- final String module = matcher.group(1);
- checkPermission(new CherBotPermission(PERM_LOAD + '.' + module));
- try {
- managerMap.get(module).load();
- answer("Loaded module " + module + '.');
- } catch (final NullPointerException e) {
- answer("No such module.");
- } catch (final Exception e) {
- answer("Error while loading module " + module + ": " + e);
- }
- }
- };
- new Command("help[.!]?") {
- @Description("Displays some general 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!" })
- @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!" })
- @Override public void performImpl() {
- final StringBuilder mods = new StringBuilder();
- for (final Manager manager : managers) {
- 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.");
- 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!" })
- @Override public void performImpl() {
- final StringBuilder sb = new StringBuilder();
- for (final Manager manager : managers) {
- 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'.");
- answer(sb.toString());
- }
- };
- 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!" })
- @Override public void performImpl() {
- final String topic = matcher.group(4);
- final StringBuilder sb = new StringBuilder();
- for (final Manager manager : managers) {
- if (topic.equals(manager.getTopic())) {
- sb.append("Commands for module ").append(topic).append('\n');
- for (final Command command : manager.commands()) {
- sb.append(command.getPattern()).append('\n');
- }
- answer(sb.toString());
- return;
- }
- }
- answer("No such module: " + topic);
- }
- };
- 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!" })
- @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!" })
- @Override public void performImpl() {
- final StringBuilder sb = new StringBuilder();
- for (final Manager manager : managers) {
- sb.append(manager.getTopic()).append('\n').append(manager.getTopic().replaceAll(".", "-")).append('\n');
- for (final Command command : manager.commands()) {
- sb.append(command.getPattern()).append('\n');
- }
- }
- }
- };
- new Command("help (.*?)[.!]?") {
- @Description("List the help on a specific module.")
- @Examples({ "Help collections!", "Help sales!" })
- @Override public void performImpl() {
- final String topic = matcher.group(1);
- if (topic.equals("usage")) {
- answer("Usage: tell me a command. You may also use shout or say but I will nearly always respond in tell. I don't want to bother other players. Use good, clear, correct, complete English sentences, that will work best. Tell me 'help commands' to find out what I understand.");
- } else {
- for (final Manager manager : managers) {
- if (topic.equalsIgnoreCase(manager.getTopic())) {
- manager.help();
- }
- }
- }
- }
- };
- new Command("info[.!]?") {
- @Description("Gives some general info about Cherbot.")
- @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('.');
- 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?" })
- @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?" })
- @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" })
- public void performImpl() {
- answer("pong");
- }
- };
- new Command("quit[.!]?") {
- @Description("Quit Cherbot.")
- @Examples({ "Quit!" })
- @Override public void performImpl() {
- checkPermission(new CherBotPermission(PERM_QUIT));
- answer("Quitting.");
- quit();
- }
- };
- } // Commands
-
- // private final String[] permissions = { PERM_SAVE, PERM_LOAD };
-
- /**
- * Create an internal manager.
- * @param cherBot Cher Bot
- */
- InternalManager(final CherBot cherBot) {
- super(cherBot, "topics");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override public void help() {
- final StringBuilder topics = new StringBuilder();
- for (final Manager manager : managers) {
- if (topics.length() > 0) {
- topics.append(", ");
- }
- topics.append(manager.getTopic());
- }
- topics.insert(0, "I have help on the following topics: \n");
- topics.append(".\n");
- topics.append("Use help <topic> (without <>) to learn more on a specific topic.");
- answer(topics.toString());
- }
-
- ///** {@inheritDoc} */
- //public String[] getPermissions() {
- // return permissions;
- //}
-
- /**
- * What's new.
- */
- private void whatsNew() {
- try {
- final BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("news.txt")));
- try {
- final StringBuilder sb = new StringBuilder();
- for (String line; (line = in.readLine()) != null; sb.append(line).append('\n')) {
- ;
- }
- answer(sb.toString());
- } finally {
- in.close();
- }
- } catch (final IOException e) {
- answer("No news available.");
- }
- }
-
- { // IO Modules
- new IOModule() {
- @Override public void save() {
- for (final Manager manager : managers) {
- if (manager != InternalManager.this) {
- try {
- manager.save();
- } catch (final Exception e) {
- System.err.println("Error while saving data from module " + manager.getTopic() + ": " + e);
- e.printStackTrace();
- }
- }
- }
- }
-
- @Override public void load() {
- for (final Manager manager : managers) {
- if (manager != InternalManager.this) {
- try {
- manager.load();
- } catch (final Exception e) {
- System.err.println("Error while loading data for module " + manager.getTopic() + ": " + e);
- e.printStackTrace();
- }
- }
- }
- }
- };
- }
- } // class InternalManager
-
-} // class CherBot
Deleted: trunk/src/net/sf/cherbot/CherBotException.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBotException.java 2007-06-08 19:41:29 UTC (rev 45)
+++ trunk/src/net/sf/cherbot/CherBotException.java 2007-06-09 14:02:47 UTC (rev 46)
@@ -1,25 +0,0 @@
-/*
- * Copyright © 2006, Christian Hujer and the CherBot developers. All Rights Reserved.
- * License: GNU General Public License v2.0 or newer.
- * See file COPYING in the root directory of this project.
- */
-
-package net.sf.cherbot;
-
-/**
- * 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 <a href="mailto:ch...@ri...">Christian Hujer</a>
- */
-public class CherBotException extends RuntimeException {
-
- /**
- * Create a CherBotException.
- * @param msg Message (displayed to end user)
- */
- public CherBotException(final String msg) {
- super(msg);
- }
-
-} // class CherBotException
Deleted: trunk/src/net/sf/cherbot/CherBotLogger.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBotLogger.java 2007-06-08 19:41:29 UTC (rev 45)
+++ trunk/src/net/sf/cherbot/CherBotLogger.java 2007-06-09 14:02:47 UTC (rev 46)
@@ -1,90 +0,0 @@
-/*
- * Copyright © 2006, Christian Hujer and the CherBot developers. All Rights Reserved.
- * License: GNU General Public License v2.0 or newer.
- * See file COPYING in the root directory of this project.
- */
-
-package net.sf.cherbot;
-
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * This class is used for logging within Cherbot.
- * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
- */
-public class CherBotLogger {
-
- /**
- * The logger.
- */
- private PrintWriter log;
-
- /**
- * Create a logger.
- * @throws IOException in case of I/O problems during logger creation.
- */
- @SuppressWarnings({ "IOResourceOpenedButNotSafelyClosed" })
- public CherBotLogger() throws IOException {
- log = new PrintWriter(new FileWriter("log.txt", true));
- }
-
- /**
- * Log something said.
- * @param who Who said it
- * @param msg What he said
- */
- public void say(final String who, final String msg) {
- log.append("[say] ").append(who).append(": ").append(msg).println();
- }
-
- /**
- * Log something told.
- * @param who Who told it
- * @param msg What he told
- */
- public void tell(final String who, final String msg) {
- log.append("[tell] ").append(who).append(": ").append(msg).println();
- }
-
- /**
- * Log something shouted.
- * @param who Who shouted it
- * @param msg What he shouted
- */
- public void shout(final String who, final String msg) {
- log.append("[shout] ").append(who).append(": ").append(msg).println();
- }
-
- /**
- * Log a successful command.
- * @param who Who invoked it
- * @param msg Message that triggered command
- * @param cmd Command
- */
- public void command(final String who, final String msg, final Manager.Command cmd) {
- log.append("[cmd] ").append("[").append(cmd.getManager().getTopic()).append("]").append(who).append(": ").append(msg).println();
- }
-
- /**
- * 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
- */
- 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.
- * @param who Who tried to command
- * @param msg Message that didn't trigger a command
- */
- public void noCommand(final String who, final String msg) {
- log.append("[nocmd] ").append(who).append(": ").append(msg).println();
- }
-
-} // class CherBotLogger
Deleted: trunk/src/net/sf/cherbot/CherBotPermission.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBotPermission.java 2007-06-08 19:41:29 UTC (rev 45)
+++ trunk/src/net/sf/cherbot/CherBotPermission.java 2007-06-09 14:02:47 UTC (rev 46)
@@ -1,30 +0,0 @@
-/*
- * Copyright © 2006, Christian Hujer and the CherBot developers. All Rights Reserved.
- * License: GNU General Public License v2.0 or newer.
- * See file COPYING in the root directory of this project.
- */
-
-package net.sf.cherbot;
-
-import java.security.BasicPermission;
-
-/**
- * Permissions to access the CherBot.
- * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
- */
-public class CherBotPermission extends BasicPermission {
-
- /**
- * Serial Version.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Create a CherBotPermission.
- * @param name name
- */
- public CherBotPermission(final String name) {
- super(name);
- }
-
-} // class CherBotPermission
Deleted: trunk/src/net/sf/cherbot/CherBotSecurityManager.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBotSecurityManager.java 2007-06-08 19:41:29 UTC (rev 45)
+++ trunk/src/net/sf/cherbot/CherBotSecurityManager.java 2007-06-09 14:02:47 UTC (rev 46)
@@ -1,310 +0,0 @@
-/*
- * Copyright © 2006, Christian Hujer and the CherBot developers. All Rights Reserved.
- * License: GNU General Public License v2.0 or newer.
- * See file COPYING in the root directory of this project.
- */
-
-package net.sf.cherbot;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.security.AllPermission;
-import java.security.Permission;
-import java.security.Permissions;
-import java.util.Comparator;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * SecurityManager for CherBot.
- * The CherBotSecurityManager manages the permissions granted for the individual modules and actions.
- * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
- */
-@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" })
-public class CherBotSecurityManager extends Manager {
-
- /**
- * 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 list own permissions.
- */
- private static final String PERM_LIST_OWN = "Security.List.Own";
-
- /**
- * Permission to list other player's permissions.
- */
- private static final String PERM_LIST_OTHER = "Security.List";
-
- /**
- * The Permissions.
- * Key: player name.
- * Value: Set with permission names.
- */
- private Map<String, Permissions> permissions = new HashMap<String, Permissions>();
-
- /**
- * NullStringComparator.
- */
- private Comparator<String> nullStringComparator = new Comparator<String>() {
- public int compare(final String o1, final String o2) {
- if (o1 == null && o2 == null) {
- return 0;
- } else if (o1 == null) {
- return -1;
- } else if (o2 == null) {
- return 1;
- } else {
- return o1.compareTo(o2);
- }
- }
- };
-
- { // Commands
- /* 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." })
- @Override public void performImpl() {
- grant(player(1), gr(2));
- }
- };
-
- /* 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." })
- @Override public void performImpl() {
- revoke(player(1), gr(2));
- }
- };
-
- /* 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." })
- @Override public void performImpl() {
- list(getCherBot().getActor());
- }
- };
-
- /* List command. */
- new Command("(?:$LIST|what (?:are|r)) $PLAYER(?:'s?)? permissions[.!?]?") {
- @Description("Lists somebody else's permissions.")
- @Examples({ "List Michtoen's permissions." })
- @Override public void performImpl() {
- list(player(1));
- }
- };
-
- /* List command. */
- new Command("$LIST permissions[.!]?") {
- @Description("Lists all permissoins.")
- @Examples({ "List permissions." })
- @Override public void performImpl() {
- final SortedSet<String> players = new TreeSet<String>(nullStringComparator);
- players.addAll(permissions.keySet());
- for (final String player : players) {
- list(player);
- }
- }
- };
- } // Commands
-
- /**
- * Create the SecurityManager.
- * @param cherBot reference to CherBot instance.
- */
- 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.
- * @param permission permission to get String from
- * @return part
- */
- private static String getPart(final String permission) {
- final Pattern p = Pattern.compile("(\\.+)\\."); // intentionally greedy
- final Matcher m = p.matcher(permission);
- return m.matches() ? '.' + m.group(1) : "";
- }
-
- /**
- * 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);
- }
- 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
- * @param permission Permissions to revoke
- */
- private void revoke(final String player, final String permission) {
- checkPermission(PERM_REVOKE + getPart(permission));
- answer("Revoked " + permission + "-permission for " + player);
- tell(player, getActor() + " revoked your " + permission + "-permission.");
- }
-
- /**
- * List permissons.
- * @param player whose permissions to list
- */
- private void list(final String player) {
- final boolean own = player != null && player.equals(getActor());
- checkPermission(own ? PERM_LIST_OWN : PERM_LIST_OTHER);
- final Permissions perms = permissions.get(player);
- if (perms == null) {
- answer((own ? "You do" : player + " does") + " not have any permissions.");
- } else {
- final StringBuilder sb = new StringBuilder();
- for (Enumeration<Permission> enu = perms.elements(); enu.hasMoreElements();) {
- sb.append(sb.length() > 0 ? ", " : (own ? "Your" : player + "'s") + " permissions: ");
- sb.append(enu.nextElement().getName());
- }
- sb.append('.');
- answer(sb.toString());
- }
- }
-
- /**
- * {@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, th...
[truncated message content] |
|
From: <chr...@us...> - 2007-06-08 19:41:35
|
Revision: 45
http://svn.sourceforge.net/cherbot/?rev=45&view=rev
Author: christianhujer
Date: 2007-06-08 12:41:29 -0700 (Fri, 08 Jun 2007)
Log Message:
-----------
Creating snapshot branch for 1.0. Trunk will be for version 2 from now on.
Added Paths:
-----------
branches/1.0/
Copied: branches/1.0 (from rev 44, trunk)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-02-10 22:12:59
|
Revision: 44
http://svn.sourceforge.net/cherbot/?rev=44&view=rev
Author: christianhujer
Date: 2007-02-10 14:12:53 -0800 (Sat, 10 Feb 2007)
Log Message:
-----------
Fixed some code style issues.
Modified Paths:
--------------
trunk/src/net/sf/cherbot/CronManager.java
trunk/src/net/sf/cherbot/Manager.java
trunk/src/net/sf/cherbot/TimeManager.java
Modified: trunk/src/net/sf/cherbot/CronManager.java
===================================================================
--- trunk/src/net/sf/cherbot/CronManager.java 2007-02-10 21:45:34 UTC (rev 43)
+++ trunk/src/net/sf/cherbot/CronManager.java 2007-02-10 22:12:53 UTC (rev 44)
@@ -85,7 +85,7 @@
/**
* CronTask convenience base class.
*/
- public static abstract class AbstractCronTask implements CronTask {
+ public abstract static class AbstractCronTask implements CronTask {
/**
* The name for this task.
@@ -112,7 +112,7 @@
/**
* CronTask convenience base class.
*/
- public static abstract class RegularCronTask extends AbstractCronTask {
+ public abstract static class RegularCronTask extends AbstractCronTask {
/**
* The number of ticks for the task.
Modified: trunk/src/net/sf/cherbot/Manager.java
===================================================================
--- trunk/src/net/sf/cherbot/Manager.java 2007-02-10 21:45:34 UTC (rev 43)
+++ trunk/src/net/sf/cherbot/Manager.java 2007-02-10 22:12:53 UTC (rev 44)
@@ -494,7 +494,7 @@
* @return sb for convenience
* @see #split(String)
*/
- protected static final StringBuilder concat(final StringBuilder sb, final Iterable<String> it) {
+ protected static StringBuilder concat(final StringBuilder sb, final Iterable<String> it) {
final Iterator<String> iterator = it.iterator();
if (iterator.hasNext()) {
String s = iterator.next();
@@ -514,7 +514,7 @@
* @return Iterable for parts
* @see #concat(StringBuilder,Iterable)
*/
- protected static final String[] split(final String s) {
+ protected static String[] split(final String s) {
return s.split(", ?| and | or ");
}
@@ -1086,7 +1086,7 @@
* Converter used by MapIOMOdule.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
- protected static abstract class Converter<ValueType> {
+ protected abstract static class Converter<ValueType> {
/**
* String Converter that doesn't change.
@@ -1199,7 +1199,7 @@
* {@inheritDoc}
*/
@Override public En fromString(final String value) {
- return (En) Enum.<En>valueOf(cl, value);
+ return Enum.valueOf(cl, value);
}
} // class EnumConverter
Modified: trunk/src/net/sf/cherbot/TimeManager.java
===================================================================
--- trunk/src/net/sf/cherbot/TimeManager.java 2007-02-10 21:45:34 UTC (rev 43)
+++ trunk/src/net/sf/cherbot/TimeManager.java 2007-02-10 22:12:53 UTC (rev 44)
@@ -171,8 +171,7 @@
*/
@Override public void text(final String msg) {
Matcher matcher;
- if (false) {
- } else if ((matcher = regexDaytime.matcher(msg)).matches()) {
+ if ((matcher = regexDaytime.matcher(msg)).matches()) {
time.minutes = Integer.parseInt(matcher.group(1));
time.hours = Integer.parseInt(matcher.group(2));
if (matcher.group(3).equals("pm") && time.hours < 12) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-02-10 21:45:35
|
Revision: 43
http://svn.sourceforge.net/cherbot/?rev=43&view=rev
Author: christianhujer
Date: 2007-02-10 13:45:34 -0800 (Sat, 10 Feb 2007)
Log Message:
-----------
Fixed some javadoc issues.
Modified Paths:
--------------
trunk/src/net/sf/cherbot/CherBotSecurityManager.java
trunk/src/net/sf/cherbot/Crime.java
trunk/src/net/sf/cherbot/CrimeManager.java
trunk/src/net/sf/cherbot/GroupManager.java
trunk/src/net/sf/cherbot/Manager.java
trunk/src/net/sf/cherbot/ManagerDocumenter.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/TimeManager.java
Modified: trunk/src/net/sf/cherbot/CherBotSecurityManager.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBotSecurityManager.java 2007-02-10 21:22:37 UTC (rev 42)
+++ trunk/src/net/sf/cherbot/CherBotSecurityManager.java 2007-02-10 21:45:34 UTC (rev 43)
@@ -166,7 +166,7 @@
}
/**
- * Revoke permission to someoneon something
+ * Revoke permission to someoneon something.
* @param player whose permissions are to be revoked
* @param permission Permissions to revoke
*/
Modified: trunk/src/net/sf/cherbot/Crime.java
===================================================================
--- trunk/src/net/sf/cherbot/Crime.java 2007-02-10 21:22:37 UTC (rev 42)
+++ trunk/src/net/sf/cherbot/Crime.java 2007-02-10 21:45:34 UTC (rev 43)
@@ -7,6 +7,7 @@
package net.sf.cherbot;
/**
+ * Manager for Crimes.
* TODO
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
Modified: trunk/src/net/sf/cherbot/CrimeManager.java
===================================================================
--- trunk/src/net/sf/cherbot/CrimeManager.java 2007-02-10 21:22:37 UTC (rev 42)
+++ trunk/src/net/sf/cherbot/CrimeManager.java 2007-02-10 21:45:34 UTC (rev 43)
@@ -167,6 +167,7 @@
//
/**
+ * Create a new CrimeManager.
* @param cherBot reference to CherBot.
*/
public CrimeManager(final CherBot cherBot) {
Modified: trunk/src/net/sf/cherbot/GroupManager.java
===================================================================
--- trunk/src/net/sf/cherbot/GroupManager.java 2007-02-10 21:22:37 UTC (rev 42)
+++ trunk/src/net/sf/cherbot/GroupManager.java 2007-02-10 21:45:34 UTC (rev 43)
@@ -1103,6 +1103,7 @@
}
/**
+ * Deserialize a Group.
* Implementation for deserialization:
* Take care about newly added fields
* @param stream Stream to deserialize with
Modified: trunk/src/net/sf/cherbot/Manager.java
===================================================================
--- trunk/src/net/sf/cherbot/Manager.java 2007-02-10 21:22:37 UTC (rev 42)
+++ trunk/src/net/sf/cherbot/Manager.java 2007-02-10 21:45:34 UTC (rev 43)
@@ -235,7 +235,7 @@
}
/**
- * Returns the level of a player
+ * Returns the level of a player.
* @param player Player to get level of
* @return level of player or 0 if unknown
*/
@@ -1343,7 +1343,7 @@
} // @interface Description
/**
- * Annotatin to document the features of a module / Manager
+ * Annotation to document the features of a module / Manager.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
@Retention(RUNTIME)
Modified: trunk/src/net/sf/cherbot/ManagerDocumenter.java
===================================================================
--- trunk/src/net/sf/cherbot/ManagerDocumenter.java 2007-02-10 21:22:37 UTC (rev 42)
+++ trunk/src/net/sf/cherbot/ManagerDocumenter.java 2007-02-10 21:45:34 UTC (rev 43)
@@ -28,6 +28,7 @@
/**
* Main program.
* @param args command line arguments
+ * @throws Exception in case of errors.
*/
public static void main(final String... args) throws Exception {
final CherBot bot = new CherBot();
@@ -77,7 +78,7 @@
}
/**
- * Create a command element for a command
+ * Create a command element for a command.
* @param command Command to create element for
* @return element for Command
*/
Modified: trunk/src/net/sf/cherbot/NoobManager.java
===================================================================
--- trunk/src/net/sf/cherbot/NoobManager.java 2007-02-10 21:22:37 UTC (rev 42)
+++ trunk/src/net/sf/cherbot/NoobManager.java 2007-02-10 21:45:34 UTC (rev 43)
@@ -210,7 +210,7 @@
}
/**
- * Get the whereis on a specific topic
+ * Get the whereis on a specific topic.
* @param topic topic to get whereis on
*/
private void getWhereis(final String topic) {
@@ -233,7 +233,7 @@
}
/**
- * Get the whatis on a specific topic
+ * Get the whatis on a specific topic.
* @param topic topic to get whatis on
*/
private void getWhatis(final String topic) {
Modified: trunk/src/net/sf/cherbot/PlayerManager.java
===================================================================
--- trunk/src/net/sf/cherbot/PlayerManager.java 2007-02-10 21:22:37 UTC (rev 42)
+++ trunk/src/net/sf/cherbot/PlayerManager.java 2007-02-10 21:45:34 UTC (rev 43)
@@ -789,6 +789,7 @@
/**
* Create a LevelManager.
+ * @param cherBot CherBot instance to use.
*/
public PlayerManager(final CherBot cherBot) {
super(cherBot, "players", 2000);
Modified: trunk/src/net/sf/cherbot/PollManager.java
===================================================================
--- trunk/src/net/sf/cherbot/PollManager.java 2007-02-10 21:22:37 UTC (rev 42)
+++ trunk/src/net/sf/cherbot/PollManager.java 2007-02-10 21:45:34 UTC (rev 43)
@@ -262,7 +262,7 @@
}
/**
- * Get the minimum level for the creation of polls
+ * Get the minimum level for the creation of polls.
* @return minimum level for the creation of polls
*/
private int getMinLevel() {
@@ -554,6 +554,7 @@
/**
* Get the number of votes for a choice of a poll.
* @param choice index of to get number of votes for (1..num_choices)
+ * @return the votes for this poll.
*/
int getVotes(final int choice) {
if (choice > choices.size() || choice < 1) {
@@ -565,6 +566,7 @@
/**
* Get the number of botes for a choice of a poll.
* @param choice choice
+ * @return the votes for this choice.
*/
int getVotes(final String choice) {
return votes.get(choice)[0];
@@ -644,7 +646,7 @@
* @param out PrintWriter to write to
* @throws IOException in case of I/O problems
*/
- void writeTo(final PrintWriter out) throws EOFException, IOException {
+ void writeTo(final PrintWriter out) throws IOException {
out.println(number + ": " + getNumChoices() + ": " + state + ": " + player);
out.println(title);
out.println(description);
Modified: trunk/src/net/sf/cherbot/RodBabyManager.java
===================================================================
--- trunk/src/net/sf/cherbot/RodBabyManager.java 2007-02-10 21:22:37 UTC (rev 42)
+++ trunk/src/net/sf/cherbot/RodBabyManager.java 2007-02-10 21:45:34 UTC (rev 43)
@@ -114,6 +114,7 @@
/**
* Create a LevelManager.
+ * @param cherBot CherBot to use.
*/
public RodBabyManager(final CherBot cherBot) {
super(cherBot, "rodbabies");
Modified: trunk/src/net/sf/cherbot/RodBabyWannabeManager.java
===================================================================
--- trunk/src/net/sf/cherbot/RodBabyWannabeManager.java 2007-02-10 21:22:37 UTC (rev 42)
+++ trunk/src/net/sf/cherbot/RodBabyWannabeManager.java 2007-02-10 21:45:34 UTC (rev 43)
@@ -114,6 +114,7 @@
/**
* Create a LevelManager.
+ * @param cherBot CherBot to use.
*/
public RodBabyWannabeManager(final CherBot cherBot) {
super(cherBot, "rodbabywannabes");
Modified: trunk/src/net/sf/cherbot/SalesManager.java
===================================================================
--- trunk/src/net/sf/cherbot/SalesManager.java 2007-02-10 21:22:37 UTC (rev 42)
+++ trunk/src/net/sf/cherbot/SalesManager.java 2007-02-10 21:45:34 UTC (rev 43)
@@ -12,6 +12,7 @@
import java.util.regex.Matcher;
/**
+ * Manager for sales.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
@Manager.Description("Allows to place sales adds.")
Modified: trunk/src/net/sf/cherbot/TimeManager.java
===================================================================
--- trunk/src/net/sf/cherbot/TimeManager.java 2007-02-10 21:22:37 UTC (rev 42)
+++ trunk/src/net/sf/cherbot/TimeManager.java 2007-02-10 21:45:34 UTC (rev 43)
@@ -264,6 +264,7 @@
* Create a time by cloning another time.
* I've not implemented Cloneable because cloning normally is not required because normally instances are immuntable.
* But the one single instance used by the TimeManager is mutable, so that's the only usage of this constructor.
+ * @param o Other time for creating a clone.
*/
private Time(final Time o) {
this(o.year, o.month, o.day, o.hours, o.minutes);
@@ -339,7 +340,7 @@
* {@inheritDoc}
*/
@Override public int hashCode() {
- return (year << 24) ^ (month << 19) ^ (day << 13) ^ (hours << 7) ^ (minutes << 0);
+ return (year << 24) ^ (month << 19) ^ (day << 13) ^ (hours << 7) ^ (minutes);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-02-10 21:22:39
|
Revision: 42
http://svn.sourceforge.net/cherbot/?rev=42&view=rev
Author: christianhujer
Date: 2007-02-10 13:22:37 -0800 (Sat, 10 Feb 2007)
Log Message:
-----------
Tightened some code conventions.
Modified Paths:
--------------
trunk/cherbot.ipr
Modified: trunk/cherbot.ipr
===================================================================
--- trunk/cherbot.ipr 2007-02-10 21:21:38 UTC (rev 41)
+++ trunk/cherbot.ipr 2007-02-10 21:22:37 UTC (rev 42)
@@ -220,7 +220,6 @@
<option name="m_ignorePrimitives" value="false" />
</inspection_tool>
<inspection_tool class="NonFinalStaticVariableUsedInClassInitialization" level="WARNING" enabled="true" />
- <inspection_tool class="OverridableMethodCallInConstructor" level="WARNING" enabled="true" />
<inspection_tool class="OverriddenMethodCallInConstructor" level="WARNING" enabled="true" />
<inspection_tool class="StaticVariableInitialization" level="WARNING" enabled="true">
<option name="m_ignorePrimitives" value="false" />
@@ -395,7 +394,9 @@
<inspection_tool class="RuntimeExec" level="WARNING" enabled="true" />
<inspection_tool class="SystemExit" level="WARNING" enabled="true" />
<inspection_tool class="SystemGetenv" level="WARNING" enabled="true" />
- <inspection_tool class="HardcodedFileSeparators" level="WARNING" enabled="true" />
+ <inspection_tool class="HardcodedFileSeparators" level="WARNING" enabled="true">
+ <option name="m_recognizeExampleMediaType" value="false" />
+ </inspection_tool>
<inspection_tool class="NativeMethods" level="WARNING" enabled="true" />
<inspection_tool class="UseOfAWTPeerClass" level="WARNING" enabled="true" />
<inspection_tool class="UseOfJDBCDriverClass" level="WARNING" enabled="true" />
@@ -426,7 +427,9 @@
<inspection_tool class="ReadObjectInitialization" level="WARNING" enabled="true" />
<inspection_tool class="NonSerializableWithSerializationMethods" level="WARNING" enabled="true" />
<inspection_tool class="NonSerializableWithSerialVersionUIDField" level="WARNING" enabled="true" />
- <inspection_tool class="NonSerializableFieldInSerializableClass" level="WARNING" enabled="true" />
+ <inspection_tool class="NonSerializableFieldInSerializableClass" level="WARNING" enabled="true">
+ <option name="ignoreSerializableDueToInheritance" value="true" />
+ </inspection_tool>
<inspection_tool class="NonSerializableObjectBoundToHttpSession" level="WARNING" enabled="true" />
<inspection_tool class="NonSerializableObjectPassedToObjectStream" level="WARNING" enabled="true" />
<inspection_tool class="ReadObjectAndWriteObjectPrivate" level="WARNING" enabled="true" />
@@ -842,7 +845,7 @@
<module fileurl="file://$PROJECT_DIR$/cherbot.iml" filepath="$PROJECT_DIR$/cherbot.iml" />
</modules>
</component>
- <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="1.5" project-jdk-type="JavaSDK">
+ <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/ideaclasses" />
</component>
<component name="ProjectRunConfigurationManager" />
@@ -1044,6 +1047,23 @@
<option name="useAlternate" value="false" />
</LanguageOptions>
</component>
+ <component name="ideadoc.IdeaDocConfigurationGUI">
+ <doccer class="nl.piraya.ideadoc.doccer.DoccerForOverridingMethod" enabled="true">
+ <template>/**$s${@inheritDoc}$s$*/</template>
+ </doccer>
+ <doccer class="nl.piraya.ideadoc.doccer.DoccerForGetter" enabled="true">
+ <template>/**$n$$s$*$s$Getter$s$for$s$property$s$'${PROPERTY_NAME}'.$n$$s$*$n$$s$*$s$@return$s$Value$s$for$s$property$s$'${PROPERTY_NAME}'.$n$$s$*/</template>
+ </doccer>
+ <doccer class="nl.piraya.ideadoc.doccer.DoccerForSetter" enabled="true">
+ <template>/**$n$$s$*$s$Setter$s$for$s$property$s$'${PROPERTY_NAME}'.$n$$s$*$n$$s$*$s$@param$s$${PARAM_NAME}$s$Value$s$to$s$set$s$for$s$property$s$'${PROPERTY_NAME}'.$n$$s$*/</template>
+ </doccer>
+ <doccer class="nl.piraya.ideadoc.doccer.DoccerForDefaultConstructor" enabled="true">
+ <template>/**$s$Constructs$s$a$s$new$s$${CLASS_NAME}.$s$*/</template>
+ </doccer>
+ <doccer class="nl.piraya.ideadoc.doccer.DoccerForPrivateDefaultConstructor" enabled="true">
+ <template>/**$s$Do$s$not$s$instantiate$s$${CLASS_NAME}.$s$*/</template>
+ </doccer>
+ </component>
<component name="libraryTable">
<library name="junit-4.1">
<CLASSES>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-02-10 21:21:40
|
Revision: 41
http://svn.sourceforge.net/cherbot/?rev=41&view=rev
Author: christianhujer
Date: 2007-02-10 13:21:38 -0800 (Sat, 10 Feb 2007)
Log Message:
-----------
Changed enum constant names to match code convention.
Fixed some code convention errors.
Modified Paths:
--------------
trunk/src/net/sf/cherbot/CherBot.java
trunk/src/net/sf/cherbot/CommType.java
Modified: trunk/src/net/sf/cherbot/CherBot.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBot.java 2006-11-25 18:29:45 UTC (rev 40)
+++ trunk/src/net/sf/cherbot/CherBot.java 2007-02-10 21:21:38 UTC (rev 41)
@@ -270,7 +270,7 @@
}
/**
- * Tell
+ * Tell.
* @param p Player name
* @param s String to tell
*/
@@ -290,8 +290,9 @@
}
/**
- * Reply
+ * Reply.
* @param s String to tell
+ * @throws IOException in case of I/O problems.
*/
public void reply(final String s) throws IOException {
final StringBuilder sb = new StringBuilder();
@@ -396,7 +397,7 @@
if (username.equals(who)) {
return;
} // avoid loop dispatch!
- if (ct == CommType.shout) {
+ if (ct == CommType.SHOUT) {
final Pattern p = Pattern.compile(username + "(?:(?:,|:)? *)(.*)");
final Matcher matcher = p.matcher(msg);
if (matcher.matches()) {
Modified: trunk/src/net/sf/cherbot/CommType.java
===================================================================
--- trunk/src/net/sf/cherbot/CommType.java 2006-11-25 18:29:45 UTC (rev 40)
+++ trunk/src/net/sf/cherbot/CommType.java 2007-02-10 21:21:38 UTC (rev 41)
@@ -19,22 +19,29 @@
public enum CommType {
/**
- * SAY
- */say("(\\S+) says: (.*)"),
+ * SAY.
+ */
+ SAY("(\\S+) says: (.*)"),
+
/**
- * SHOUT
- */shout("(\\S+) shouts: (.*)"),
+ * SHOUT.
+ */
+ SHOUT("(\\S+) shouts: (.*)"),
+
/**
- * TELL
- */tell("(\\S+) tells you: (.*)"),
+ * TELL.
+ */
+ TELL("(\\S+) tells you: (.*)"),
+
/**
- * REPLY
- */reply("(\\S+) replies you: (.*)");
+ * REPLY.
+ */
+ REPLY("(\\S+) replies you: (.*)");
/**
* All Communicationtypes.
*/
- public static final Set<CommType> all = Collections.unmodifiableSet(EnumSet.allOf(CommType.class));
+ public static final Set<CommType> ALL = Collections.unmodifiableSet(EnumSet.allOf(CommType.class));
/**
* Regex pattern to match.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-11-25 18:29:55
|
Revision: 40
http://svn.sourceforge.net/cherbot/?rev=40&view=rev
Author: christianhujer
Date: 2006-11-25 10:29:45 -0800 (Sat, 25 Nov 2006)
Log Message:
-----------
Added ohloh link.
Modified Paths:
--------------
trunk/src/doc/sitestyle.css
trunk/src/doc/transform.xslt
Modified: trunk/src/doc/sitestyle.css
===================================================================
--- trunk/src/doc/sitestyle.css 2006-10-30 09:03:48 UTC (rev 39)
+++ trunk/src/doc/sitestyle.css 2006-11-25 18:29:45 UTC (rev 40)
@@ -88,8 +88,6 @@
}
img.now {
- width:88px;
- height:31px;
margin:1px;
}
Modified: trunk/src/doc/transform.xslt
===================================================================
--- trunk/src/doc/transform.xslt 2006-10-30 09:03:48 UTC (rev 39)
+++ trunk/src/doc/transform.xslt 2006-11-25 18:29:45 UTC (rev 40)
@@ -64,6 +64,7 @@
<a href="http://freshmeat.net/projects/cherbot/"><img src="http://images.freshmeat.net/img/link_button_4.gif" width="88" height="31" alt="freshmeat.net" class="now" /></a>
<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML 1.1" height="31" width="88" class="now" /></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="http://jigsaw.w3.org/css-validator/images/vcss" width="88" height="31" alt="Valid CSS!" class="now" /></a>
+ <a href="http://ohloh.net/projects/3423;badge_setup"><img src="http://ohloh.net/projects/3423.gif;badge" width="100" height="16" alt="Ohloh Metrics" class="now" /></a>
<!--<a href="http://www.jetbrains.com/idea/"><img src="http://www.jetbrains.com/idea/opensource/img/banners/idea88x31_blue.gif" alt="The best Java IDE" width="88" height="31" /></a>-->
Feedback: <a href="mailto:ch...@ri...">webmaster</a>
<xsl:if test="/html:html/html:head/html:meta[@name='Date']">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-10-30 09:04:22
|
Revision: 39
http://svn.sourceforge.net/cherbot/?rev=39&view=rev
Author: christianhujer
Date: 2006-10-30 01:03:48 -0800 (Mon, 30 Oct 2006)
Log Message:
-----------
Added typical project documentation files.
Added Paths:
-----------
trunk/CREDITS
trunk/FAQ
trunk/INSTALL
trunk/LICENSE
trunk/NEWS
trunk/README
Removed Paths:
-------------
trunk/README.txt
Added: trunk/CREDITS
===================================================================
--- trunk/CREDITS (rev 0)
+++ trunk/CREDITS 2006-10-30 09:03:48 UTC (rev 39)
@@ -0,0 +1,9 @@
+The following people have contributed directly to CherBot:
+
+* Christian Hujer <ch...@ri...>
+ Inventor, creator, maintainer
+
+
+CherBot wouldn't exist without the following projects:
+
+* Daimonin, an MMORPG, that has inspired Cher to create CherBot.
Property changes on: trunk/CREDITS
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ LF
Added: trunk/FAQ
===================================================================
--- trunk/FAQ (rev 0)
+++ trunk/FAQ 2006-10-30 09:03:48 UTC (rev 39)
@@ -0,0 +1,4 @@
+FAQ
+---
+
+No faq yet.
Property changes on: trunk/FAQ
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ LF
Added: trunk/INSTALL
===================================================================
--- trunk/INSTALL (rev 0)
+++ trunk/INSTALL 2006-10-30 09:03:48 UTC (rev 39)
@@ -0,0 +1,14 @@
+BUILDING / INSTALLING CHERBOT
+-----------------------------
+
+
+To build CherBot, you need Java 5.0 and Ant 1.6.5.
+
+
+To build CherBot, just run ant in the project's root directory or specifying the
+build.xml in the project's root directory. To find out, what other options
+you have for building CherBot, try "ant -projecthelp".
+
+
+To run CherBot, run the .jar file that was created as a result of the build
+process. Run: java -jar CherBot.jar
Property changes on: trunk/INSTALL
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ LF
Added: trunk/LICENSE
===================================================================
--- trunk/LICENSE (rev 0)
+++ trunk/LICENSE 2006-10-30 09:03:48 UTC (rev 39)
@@ -0,0 +1,9 @@
+CHERBOT LICENSE INFORMATION
+---------------------------
+
+CherBot is licensed under GPL. See file COPYING.
+
+CherBot uses some third part libraries, especially for building. These
+libraries are contained in the lib/ directory and have their own licenses. See
+the corresponding LICENSE-*-files in the lib/ directory for the licenses of
+third party libraries.
Property changes on: trunk/LICENSE
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ LF
Added: trunk/NEWS
===================================================================
--- trunk/NEWS (rev 0)
+++ trunk/NEWS 2006-10-30 09:03:48 UTC (rev 39)
@@ -0,0 +1,5 @@
+NEWS
+----
+
+2006-10-27
+ CherBot has become a project hosted on SourceForge.
Property changes on: trunk/NEWS
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ LF
Added: trunk/README
===================================================================
--- trunk/README (rev 0)
+++ trunk/README 2006-10-30 09:03:48 UTC (rev 39)
@@ -0,0 +1,128 @@
+CHERBOT README
+--------------
+
+This file contains some important information about CherBot. You should read it
+first.
+
+
+TABLE OF CONTENTS
+* project description
+* project website
+* system requirements
+* file structure
+* build / installation (see file INSTALL)
+* maintainers / credits (see file CREDITS)
+* project news (see file NEWS)
+* mailing lists
+* license information (see file LICENSE)
+
+
+PROJECT DESCRIPTION
+
+CherBot is an information bot for Daimonin which probably would also work pretty
+well with Angelion and to less extent with Crossfire. CherBot keeps track of
+which players collect which items, who's been online, determines a level
+ranking, provides a mail system for mailing offline players, manages clans and
+more.
+
+The network code has been temporarily removed because it awaits approval of the
+daimonin server developers.
+
+
+PROJECT WEBSITE
+
+Project homepage: http://cherbot.sourceforge.net/
+Project website: http://sourceforge.net/projects/cherbot/
+
+
+SYSTEM REQUIREMENTS
+
+Java 5.0
+ Previous versions of Java will not work. CherBot uses Generics, autoboxing,
+ static imports, foreach loops, assertions and varargs quite a lot.
+
+Ant 1.6.5
+ Previous versions of Ant might work but are not tested.
+
+
+FILE STRUCTURE
+
+build.xml
+ The build file to build the project with Ant.
+
+COPYING
+ CherBot license conditions. Note: applies to CherBot only, not third party
+ libraries.
+
+CREDITS
+ List of project contributors.
+
+dest/
+ The directory containing generated files.
+
+developer.proprties
+ Optional file for changing default settings of the Ant build. You won't
+ need to tweak this file for normal building. But if you want to set or
+ override properties for build.xml, this is the place to put them.
+
+dist/
+ Generated directory containing distribution archives.
+
+lib/
+ Directory containing third part libraries used to build CherBot. Please note
+ that these third party libraries have their own license conditions. The
+ licenses of the third party libraries are included in the lib/ directory.
+
+LICENSE
+ File with license information.
+
+project.properties
+ File with automatically changed settings for Ant.
+
+src/
+ Source files.
+
+src/net/ (net)
+ Core CherBot sources.
+
+src/doc/
+ Documentation source files (website).
+
+src/test/ (test)
+ Unit test suite for automated unit testing of CherBot.
+
+tools/
+ Small sometimes CherBot-based programs for use by CherBot developers.
+
+
+BUILD / INSTALLATION
+
+See the file INSTALL.
+
+
+MAINTAINERS / CREDITS
+
+See the file CREDITS
+
+
+PROJECT NEWS
+
+See the file NEWS
+
+
+MAILING LISTS
+
+CherBot mailing lists are the usual sourceforge hosted sourceforge project
+mailing lists. The current mailing lists are:
+* che...@li...
+ News for CherBot users and developers (Low traffic, read only)
+* che...@li...
+ CherBot developer talk list
+* che...@li...
+ cvs commit digest list (currently unused, and probably being replaced
+ by a corresponding svn commit digest list soon)
+
+
+LICENSE INFORMATION
+
+See the file LICENSE
Property changes on: trunk/README
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ LF
Deleted: trunk/README.txt
===================================================================
--- trunk/README.txt 2006-10-30 09:00:29 UTC (rev 38)
+++ trunk/README.txt 2006-10-30 09:03:48 UTC (rev 39)
@@ -1,4 +0,0 @@
-CherBot currently is not compilable.
-We're working on this problem.
-The source code currently reflects CherBot V1.
-The network code has been temporarily removed because it awaits approval of the daimonin server developers.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-10-30 09:00:55
|
Revision: 38
http://svn.sourceforge.net/cherbot/?rev=38&view=rev
Author: christianhujer
Date: 2006-10-30 01:00:29 -0800 (Mon, 30 Oct 2006)
Log Message:
-----------
Declared nullability on some classes.
Modified Paths:
--------------
trunk/src/net/sf/cherbot/BlackListManager.java
trunk/src/net/sf/cherbot/Manager.java
Modified: trunk/src/net/sf/cherbot/BlackListManager.java
===================================================================
--- trunk/src/net/sf/cherbot/BlackListManager.java 2006-10-29 23:11:41 UTC (rev 37)
+++ trunk/src/net/sf/cherbot/BlackListManager.java 2006-10-30 09:00:29 UTC (rev 38)
@@ -8,6 +8,7 @@
import java.util.SortedSet;
import java.util.TreeSet;
+import org.jetbrains.annotations.NotNull;
/**
* Manages a black list of users that may not use Cherbot.
@@ -55,7 +56,7 @@
* Create the BlackListManager.
* @param cherbot CherBot
*/
- public BlackListManager(final CherBot cherbot) {
+ public BlackListManager(@NotNull final CherBot cherbot) {
super(cherbot, "blacklist");
}
@@ -78,7 +79,7 @@
* Puts a player to the blacklist.
* @param player Player to blacklist
*/
- private void addBlacklist(final String player) {
+ private void addBlacklist(@NotNull final String player) {
checkPermission(PERM_BLACKLIST);
if (blacklist.add(player)) {
answer("Added " + player + " to the blacklist.");
@@ -92,7 +93,7 @@
* Removes a player from the blacklist.
* @param player Player to remove
*/
- private void removeBlacklist(final String player) {
+ private void removeBlacklist(@NotNull final String player) {
checkPermission(PERM_BLACKLIST);
if (blacklist.remove(player)) {
answer("Removed " + player + " from the blacklist.");
@@ -107,7 +108,7 @@
* @param player Player to check
* @return <code>true</code> if <var>player</var> is blacklisted, otherwise <code>false</code>.
*/
- public boolean isBlacklisted(final String player) {
+ public boolean isBlacklisted(@NotNull final String player) {
return blacklist.contains(player);
}
Modified: trunk/src/net/sf/cherbot/Manager.java
===================================================================
--- trunk/src/net/sf/cherbot/Manager.java 2006-10-29 23:11:41 UTC (rev 37)
+++ trunk/src/net/sf/cherbot/Manager.java 2006-10-30 09:00:29 UTC (rev 38)
@@ -27,6 +27,8 @@
import java.util.NoSuchElementException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* Base class for managers.
@@ -109,7 +111,7 @@
* @param cherBot CherBot to create Manager for.
* @param topic Topic name to use
*/
- protected Manager(final CherBot cherBot, final String topic) {
+ protected Manager(@NotNull final CherBot cherBot, @NotNull final String topic) {
this(cherBot, topic, 0);
}
@@ -119,7 +121,7 @@
* @param topic Topic name to use
* @param delay Delay to use for notifications
*/
- protected Manager(final CherBot cherBot, final String topic, final int delay) {
+ protected Manager(@NotNull final CherBot cherBot, @NotNull final String topic, @NotNull final int delay) {
this.cherBot = cherBot;
this.topic = topic;
this.delay = delay;
@@ -138,7 +140,7 @@
* Add a command.
* @param command Command to add
*/
- private void addCommand(final Command command) {
+ private void addCommand(@NotNull final Command command) {
commands.add(command);
cherBot.addCommand(command);
}
@@ -170,7 +172,7 @@
* @param txt message to check
* @throws SmutException in case smut was found
*/
- public void checkSmut(final String txt) throws SmutException {
+ public void checkSmut(@NotNull final String txt) throws SmutException {
final Manager smutManager = cherBot.getManager("smut");
assert smutManager != this : "A Manager for \"smut\" must override Manager.checkSmut(String)!";
if (smutManager == this) {
@@ -188,7 +190,7 @@
* @return player name
* @throws NoSuchPlayerException in case CherBot doesn't know that player
*/
- protected String player(final String player) {
+ @NotNull protected String player(@NotNull final String player) {
final Manager playerManager = cherBot.getManager("players");
if (playerManager == null) {
return player;
@@ -206,7 +208,7 @@
* If the bot does not have a Manager for that topic, this method simply returns <code>null</code>.
* @return current time
*/
- protected TimeManager.Time getCurrentTime() {
+ @Nullable protected TimeManager.Time getCurrentTime() {
final Manager timeManager = cherBot.getManager("time");
if (timeManager == null) {
return null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-10-29 23:11:54
|
Revision: 37
http://svn.sourceforge.net/cherbot/?rev=37&view=rev
Author: christianhujer
Date: 2006-10-29 15:11:41 -0800 (Sun, 29 Oct 2006)
Log Message:
-----------
Added annotations.jar to idea project files.
Modified Paths:
--------------
trunk/cherbot.iml
trunk/cherbot.ipr
Modified: trunk/cherbot.iml
===================================================================
--- trunk/cherbot.iml 2006-10-29 23:10:43 UTC (rev 36)
+++ trunk/cherbot.iml 2006-10-29 23:11:41 UTC (rev 37)
@@ -10,6 +10,7 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="junit-4.1" level="project" />
+ <orderEntry type="library" name="annotations" level="project" />
<orderEntryProperties />
</component>
<component name="copyright">
Modified: trunk/cherbot.ipr
===================================================================
--- trunk/cherbot.ipr 2006-10-29 23:10:43 UTC (rev 36)
+++ trunk/cherbot.ipr 2006-10-29 23:11:41 UTC (rev 37)
@@ -1052,6 +1052,13 @@
<JAVADOC />
<SOURCES />
</library>
+ <library name="annotations">
+ <CLASSES>
+ <root url="jar://$PROJECT_DIR$/lib/annotations.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
</component>
<component name="uidesigner-configuration">
<option name="INSTRUMENT_CLASSES" value="true" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-10-29 23:11:16
|
Revision: 36
http://svn.sourceforge.net/cherbot/?rev=36&view=rev
Author: christianhujer
Date: 2006-10-29 15:10:43 -0800 (Sun, 29 Oct 2006)
Log Message:
-----------
Added annotations.jar to build.
Modified Paths:
--------------
trunk/build.xml
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2006-10-29 23:09:08 UTC (rev 35)
+++ trunk/build.xml 2006-10-29 23:10:43 UTC (rev 36)
@@ -35,6 +35,7 @@
encoding = "utf-8"
>
<classpath>
+ <pathelement location="lib/annotations.jar" />
<pathelement location="lib/junit-4.1.jar" />
</classpath>
<compilerarg line="-Xlint:all"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-10-29 23:09:37
|
Revision: 35
http://svn.sourceforge.net/cherbot/?rev=35&view=rev
Author: christianhujer
Date: 2006-10-29 15:09:08 -0800 (Sun, 29 Oct 2006)
Log Message:
-----------
Added annotations jar.
Added Paths:
-----------
trunk/lib/annotations.jar
Added: trunk/lib/annotations.jar
===================================================================
(Binary files differ)
Property changes on: trunk/lib/annotations.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-10-29 15:23:39
|
Revision: 34
http://svn.sourceforge.net/cherbot/?rev=34&view=rev
Author: christianhujer
Date: 2006-10-29 07:23:18 -0800 (Sun, 29 Oct 2006)
Log Message:
-----------
Reformatted code.
Modified Paths:
--------------
trunk/src/net/sf/cherbot/CrimeManager.java
trunk/src/net/sf/cherbot/DummyManagerProxy.java
trunk/src/net/sf/cherbot/GroupManager.java
trunk/src/net/sf/cherbot/MailManager.java
Modified: trunk/src/net/sf/cherbot/CrimeManager.java
===================================================================
--- trunk/src/net/sf/cherbot/CrimeManager.java 2006-10-29 14:10:21 UTC (rev 33)
+++ trunk/src/net/sf/cherbot/CrimeManager.java 2006-10-29 15:23:18 UTC (rev 34)
@@ -165,6 +165,7 @@
// private Set<String> criminals = new TreeSet<String>();
//
+
/**
* @param cherBot reference to CherBot.
*/
Modified: trunk/src/net/sf/cherbot/DummyManagerProxy.java
===================================================================
--- trunk/src/net/sf/cherbot/DummyManagerProxy.java 2006-10-29 14:10:21 UTC (rev 33)
+++ trunk/src/net/sf/cherbot/DummyManagerProxy.java 2006-10-29 15:23:18 UTC (rev 34)
@@ -21,7 +21,7 @@
/**
* Create a DummyManager.
- * @param cherBot CherBot to create DummyManager for
+ * @param cherBot CherBot to create DummyManager for
* @param managers Managers to register
*/
public DummyManagerProxy(final CherBot cherBot, final Manager... managers) {
Modified: trunk/src/net/sf/cherbot/GroupManager.java
===================================================================
--- trunk/src/net/sf/cherbot/GroupManager.java 2006-10-29 14:10:21 UTC (rev 33)
+++ trunk/src/net/sf/cherbot/GroupManager.java 2006-10-29 15:23:18 UTC (rev 34)
@@ -1106,7 +1106,7 @@
* Implementation for deserialization:
* Take care about newly added fields
* @param stream Stream to deserialize with
- * @throws IOException in case of I/O problems during deserialization
+ * @throws IOException in case of I/O problems during deserialization
* @throws ClassNotFoundException in case a class required for deserialization was not found
*/
private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
Modified: trunk/src/net/sf/cherbot/MailManager.java
===================================================================
--- trunk/src/net/sf/cherbot/MailManager.java 2006-10-29 14:10:21 UTC (rev 33)
+++ trunk/src/net/sf/cherbot/MailManager.java 2006-10-29 15:23:18 UTC (rev 34)
@@ -317,8 +317,8 @@
/**
* Gets a mail.
* @param n number of mail to get
+ * @return mail number <var>n</var> for the actor.
* @throws CherBotException if no such mail
- * @return mail number <var>n</var> for the actor.
*/
private Mail getMail(final int n) {
try {
@@ -365,8 +365,8 @@
/**
* Send mail.
* @param from Sender
- * @param to Receiver
- * @param msg Message body
+ * @param to Receiver
+ * @param msg Message body
*/
@Override public void mail(final String from, final String to, final String msg) {
new Mail(from, to, msg);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-10-29 14:10:47
|
Revision: 33
http://svn.sourceforge.net/cherbot/?rev=33&view=rev
Author: christianhujer
Date: 2006-10-29 06:10:21 -0800 (Sun, 29 Oct 2006)
Log Message:
-----------
Declared foreach loop variables final.
Modified Paths:
--------------
trunk/src/net/sf/cherbot/CherBot.java
trunk/src/net/sf/cherbot/CherBotSecurityManager.java
trunk/src/net/sf/cherbot/CollectionsManager.java
trunk/src/net/sf/cherbot/CrimeManager.java
trunk/src/net/sf/cherbot/DeathsManager.java
trunk/src/net/sf/cherbot/EmotesManager.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/MailManager.java
trunk/src/net/sf/cherbot/Manager.java
trunk/src/net/sf/cherbot/ManagerDocumenter.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/SalesManager.java
Modified: trunk/src/net/sf/cherbot/CherBot.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBot.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/CherBot.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -306,7 +306,7 @@
*/
public void say(final String s) {
final StringBuilder sb = new StringBuilder();
- for (String line : lineSplit(s)) {
+ for (final String line : lineSplit(s)) {
sb.setLength(0);
}
}
@@ -468,7 +468,7 @@
if (username.equals(who)) {
return;
} // avoid lamenting myself
- for (Manager manager : managers) {
+ for (final Manager manager : managers) {
manager.died(who, killer, with);
}
}
@@ -584,7 +584,7 @@
@Examples({ "List modules!", "Show modules!" })
@Override public void performImpl() {
final StringBuilder mods = new StringBuilder();
- for (Manager manager : managers) {
+ for (final Manager manager : managers) {
if (mods.length() > 0) {
mods.append(", ");
} else {
@@ -604,7 +604,7 @@
@Examples({ "List commands!", "Show commands!" })
@Override public void performImpl() {
final StringBuilder sb = new StringBuilder();
- for (Manager manager : managers) {
+ for (final Manager manager : managers) {
if (sb.length() == 0) {
sb.append("Loaded modules: ");
} else {
@@ -622,10 +622,10 @@
@Override public void performImpl() {
final String topic = matcher.group(4);
final StringBuilder sb = new StringBuilder();
- for (Manager manager : managers) {
+ for (final Manager manager : managers) {
if (topic.equals(manager.getTopic())) {
sb.append("Commands for module ").append(topic).append('\n');
- for (Command command : manager.commands()) {
+ for (final Command command : manager.commands()) {
sb.append(command.getPattern()).append('\n');
}
answer(sb.toString());
@@ -647,9 +647,9 @@
@Examples({ "Really list all commands!", "Really show me all commands!" })
@Override public void performImpl() {
final StringBuilder sb = new StringBuilder();
- for (Manager manager : managers) {
+ for (final Manager manager : managers) {
sb.append(manager.getTopic()).append('\n').append(manager.getTopic().replaceAll(".", "-")).append('\n');
- for (Command command : manager.commands()) {
+ for (final Command command : manager.commands()) {
sb.append(command.getPattern()).append('\n');
}
}
@@ -663,7 +663,7 @@
if (topic.equals("usage")) {
answer("Usage: tell me a command. You may also use shout or say but I will nearly always respond in tell. I don't want to bother other players. Use good, clear, correct, complete English sentences, that will work best. Tell me 'help commands' to find out what I understand.");
} else {
- for (Manager manager : managers) {
+ for (final Manager manager : managers) {
if (topic.equalsIgnoreCase(manager.getTopic())) {
manager.help();
}
@@ -737,7 +737,7 @@
*/
@Override public void help() {
final StringBuilder topics = new StringBuilder();
- for (Manager manager : managers) {
+ for (final Manager manager : managers) {
if (topics.length() > 0) {
topics.append(", ");
}
@@ -777,7 +777,7 @@
{ // IO Modules
new IOModule() {
@Override public void save() {
- for (Manager manager : managers) {
+ for (final Manager manager : managers) {
if (manager != InternalManager.this) {
try {
manager.save();
@@ -790,7 +790,7 @@
}
@Override public void load() {
- for (Manager manager : managers) {
+ for (final Manager manager : managers) {
if (manager != InternalManager.this) {
try {
manager.load();
Modified: trunk/src/net/sf/cherbot/CherBotSecurityManager.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBotSecurityManager.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/CherBotSecurityManager.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -120,7 +120,7 @@
@Override public void performImpl() {
final SortedSet<String> players = new TreeSet<String>(nullStringComparator);
players.addAll(permissions.keySet());
- for (String player : players) {
+ for (final String player : players) {
list(player);
}
}
@@ -283,7 +283,7 @@
//PrintWriter out = null;
//try {
// out = new PrintWriter(new OutputStreamWriter(new FileOutputStream("security.txt")));
- // for (String player : permissions.keySet()) {
+ // for (final String player : permissions.keySet()) {
// if (player != null) {
// out.append(player);
// }
Modified: trunk/src/net/sf/cherbot/CollectionsManager.java
===================================================================
--- trunk/src/net/sf/cherbot/CollectionsManager.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/CollectionsManager.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -264,7 +264,7 @@
* Notifies all registered listeners of what the entering person collects.
*/
@Override public void entered(final String player) {
- for (String listener : listeners) {
+ for (final String listener : listeners) {
if (!player.equals(listener) && isLoggedIn(listener)) {
tellCollectablesFor(listener, player);
}
@@ -320,7 +320,7 @@
if (!isActor(collector)) {
checkPermission(PERM_COLLECT, "You are not allowed to edit somebody elses collections list.");
}
- for (String collectable : collectables) {
+ for (final String collectable : collectables) {
if (collectable.length() > 0 && collections.add(new Entry(collector, collectable))) {
answer("I now know that " + (collector.equals(getActor()) ? "you collect " : collector + " collects ") + collectable + ".");
} else {
@@ -338,7 +338,7 @@
if (!isActor(collector)) {
checkPermission(PERM_COLLECT, "You are not allowed to edit somebody elses collections list.");
}
- for (String collectable : collectables) {
+ for (final String collectable : collectables) {
if (collections.remove(new Entry(collector, collectable))) {
answer("I now know that " + (collector.equals(getActor()) ? "you don't" : collector + " doesn't") + " collect " + collectable + " anymore.");
} else {
@@ -354,7 +354,7 @@
*/
private void tellCollectablesFor(final String player, final String collector) {
final SortedSet<String> items = new TreeSet<String>();
- for (Entry e : collections) {
+ for (final Entry e : collections) {
if (e.collector.equals(collector)) {
items.add(e.collectable);
}
@@ -376,7 +376,7 @@
*/
private void listCollectablesFor(final String collector) {
final SortedSet<String> items = new TreeSet<String>();
- for (Entry e : collections) {
+ for (final Entry e : collections) {
if (e.collector.equals(collector)) {
items.add(e.collectable);
}
@@ -402,7 +402,7 @@
*/
private void listCollectorsFor(final String collectable) {
final Map<String, SortedSet<String>> col = new HashMap<String, SortedSet<String>>();
- for (Entry e : collections) {
+ for (final Entry e : collections) {
if (e.collectable.contains(collectable) || collectable.contains(e.collectable)) {
if (!col.containsKey(e.collector)) {
col.put(e.collector, new TreeSet<String>());
@@ -416,7 +416,7 @@
sb.append(collectable).append(" is/are collected by: ");
sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
int i = 0;
- for (String collector : new TreeSet<String>(col.keySet())) {
+ for (final String collector : new TreeSet<String>(col.keySet())) {
sb.append(collector).append(" (");
concat(sb, col.get(collector));
sb.append(')');
@@ -440,7 +440,7 @@
*/
private void listOnlineCollectorsFor(final String collectable) {
final Map<String, SortedSet<String>> col = new HashMap<String, SortedSet<String>>();
- for (Entry e : collections) {
+ for (final Entry e : collections) {
if (e.collectable.contains(collectable) || collectable.contains(e.collectable)) {
if (isLoggedIn(e.collector)) {
if (!col.containsKey(e.collector)) {
@@ -456,7 +456,7 @@
sb.append(collectable).append(" is/are collected by: ");
sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
int i = 0;
- for (String collector : new TreeSet<String>(col.keySet())) {
+ for (final String collector : new TreeSet<String>(col.keySet())) {
sb.append(collector).append(" (");
concat(sb, col.get(collector));
sb.append(')');
@@ -479,7 +479,7 @@
*/
private void listCollectors() {
final SortedSet<String> players = new TreeSet<String>();
- for (Entry e : collections) {
+ for (final Entry e : collections) {
players.add(e.collector);
}
if (players.size() > 0) {
@@ -498,7 +498,7 @@
*/
private void listOnlineCollectors() {
final SortedSet<String> players = new TreeSet<String>();
- for (Entry e : collections) {
+ for (final Entry e : collections) {
final String collector = e.collector;
if (isLoggedIn(collector)) {
players.add(collector);
@@ -520,7 +520,7 @@
*/
private void listCollectables() {
final SortedSet<String> items = new TreeSet<String>();
- for (Entry e : collections) {
+ for (final Entry e : collections) {
items.add(e.collectable);
}
if (items.size() > 0) {
@@ -557,7 +557,7 @@
{ // IO Modules
new RegexIOModule("collections.txt", "(.*?): (.*)") {
@Override protected void saveImpl() throws IOException {
- for (Entry collection : collections) {
+ for (final Entry collection : collections) {
println(collection.collector + ": " + collection.collectable);
}
}
Modified: trunk/src/net/sf/cherbot/CrimeManager.java
===================================================================
--- trunk/src/net/sf/cherbot/CrimeManager.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/CrimeManager.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -191,7 +191,7 @@
*/
@Override public void entered(final String player) {
final Set<String> cs = new TreeSet<String>();
- for (Crime crime : crimes.keySet()) {
+ for (final Crime crime : crimes.keySet()) {
if (crime.criminal.equals(player)) {
cs.add(crime.crimetype);
}
@@ -210,12 +210,12 @@
*/
private void listCriminals() {
final Set<String> criminals = new TreeSet<String>();
- for (Crime crime : crimes.keySet()) {
+ for (final Crime crime : crimes.keySet()) {
criminals.add(crime.criminal);
}
if (criminals.size() > 0) {
final StringBuilder sb = new StringBuilder();
- for (String criminal : criminals) {
+ for (final String criminal : criminals) {
if (sb.length() > 0) {
sb.append(", ");
}
@@ -233,7 +233,7 @@
*/
private void listCriminalsOnline() {
final Set<String> criminals = new TreeSet<String>();
- for (Crime crime : crimes.keySet()) {
+ for (final Crime crime : crimes.keySet()) {
final String criminal = crime.criminal;
if (isLoggedIn(criminal)) {
criminals.add(criminal);
@@ -241,7 +241,7 @@
}
if (criminals.size() > 0) {
final StringBuilder sb = new StringBuilder();
- for (String criminal : criminals) {
+ for (final String criminal : criminals) {
if (sb.length() > 0) {
sb.append(", ");
}
@@ -259,7 +259,7 @@
*/
private void listCrimes() {
final StringBuilder sb = new StringBuilder();
- for (Crime crime : crimes.keySet()) {
+ for (final Crime crime : crimes.keySet()) {
sb.append(crime.criminal).append(": ").append(crime.crimetype).append(" (reported by ").append(crime.reporter).append(", ").append(crimes.get(crime)[0]).append(" times)\n");
}
answer(sb.toString());
@@ -278,7 +278,7 @@
*/
private void listCrimesOf(final String criminal) {
final Set<Crime> cs = new HashSet<Crime>();
- for (Crime crime : crimes.keySet()) {
+ for (final Crime crime : crimes.keySet()) {
if (crime.criminal.equals(criminal)) {
cs.add(crime);
}
@@ -287,7 +287,7 @@
answer("I don't know of any crimes " + criminal + " could have committed.");
} else {
final StringBuilder sb = new StringBuilder();
- for (Crime crime : cs) {
+ for (final Crime crime : cs) {
if (sb.length() == 0) {
sb.append(criminal).append(" committed ");
} else {
@@ -354,7 +354,7 @@
private void listCrimeTypes() {
final StringBuilder sb = new StringBuilder();
- for (String crimetype : crimeTypes) {
+ for (final String crimetype : crimeTypes) {
if (sb.length() == 0) {
sb.append("The following actions are considered crimes: ");
} else {
@@ -376,7 +376,7 @@
}
@Override protected void saveImpl() throws IOException {
- for (Crime crime : crimes.keySet()) {
+ for (final Crime crime : crimes.keySet()) {
println(crime.criminal + ": " + crime.reporter + ": " + crimes.get(crime)[0] + ": " + crime.crimetype);
}
}
Modified: trunk/src/net/sf/cherbot/DeathsManager.java
===================================================================
--- trunk/src/net/sf/cherbot/DeathsManager.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/DeathsManager.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -129,7 +129,7 @@
} else {
int max = 0;
final Set<String> players = new TreeSet<String>();
- for (String player : deaths.keySet()) {
+ for (final String player : deaths.keySet()) {
final int n = deaths.get(player)[0];
if (n > max) {
players.clear();
Modified: trunk/src/net/sf/cherbot/EmotesManager.java
===================================================================
--- trunk/src/net/sf/cherbot/EmotesManager.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/EmotesManager.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -220,7 +220,7 @@
*/
public EmotesManager(final CherBot cherBot) {
super(cherBot, "emotes");
- for (String pat : patternTexts) {
+ for (final String pat : patternTexts) {
patterns.add(Pattern.compile(pat));
}
}
@@ -493,7 +493,7 @@
*/
private int countLikes() {
int likes = 0;
- for (String player : attitude.keySet()) {
+ for (final String player : attitude.keySet()) {
if (attitude.get(player)[0] > 0) {
likes++;
}
@@ -507,7 +507,7 @@
*/
private int countDislikes() {
int dislikes = 0;
- for (String player : attitude.keySet()) {
+ for (final String player : attitude.keySet()) {
if (attitude.get(player)[0] < 0) {
dislikes++;
}
Modified: trunk/src/net/sf/cherbot/ExampleTester.java
===================================================================
--- trunk/src/net/sf/cherbot/ExampleTester.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/ExampleTester.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -33,7 +33,7 @@
*/
public static TestSuite createSuite(final CherBot cherbot) {
final TestSuite suite = new ExampleTester();
- for (Manager manager : cherbot.managers()) {
+ for (final Manager manager : cherbot.managers()) {
suite.addTest(createSuite(manager));
}
return suite;
@@ -46,7 +46,7 @@
*/
public static TestSuite createSuite(final Manager manager) {
final TestSuite suite = new TestSuite(manager.getTopic());
- for (Manager.Command command : manager.commands()) {
+ for (final Manager.Command command : manager.commands()) {
suite.addTest(createSuite(command));
}
return suite;
@@ -64,7 +64,7 @@
final Class<? extends Manager.Command> clazz = command.getClass();
final Method method = clazz.getDeclaredMethod("performImpl");
if (method.isAnnotationPresent(Manager.Examples.class)) {
- for (String example : method.getAnnotation(Manager.Examples.class).value()) {
+ for (final String example : method.getAnnotation(Manager.Examples.class).value()) {
suite.addTest(new ExampleTestCase(pattern, example));
}
} else {
Modified: trunk/src/net/sf/cherbot/GreetingsManager.java
===================================================================
--- trunk/src/net/sf/cherbot/GreetingsManager.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/GreetingsManager.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -68,7 +68,7 @@
@Examples({ "Show all greetings.", "Tell me all greetings." })
@Override public void performImpl() {
checkPermission(PERM_LIST_GREETINGS);
- for (String player : new TreeSet<String>(greetings.keySet())) {
+ for (final String player : new TreeSet<String>(greetings.keySet())) {
answer(player + ": " + greetings.get(player));
}
}
Modified: trunk/src/net/sf/cherbot/GroupManager.java
===================================================================
--- trunk/src/net/sf/cherbot/GroupManager.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/GroupManager.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -708,7 +708,7 @@
throw new SecurityException("This group is invisible and you don't have the required permissions to list this group's allies.");
}
final SortedSet<String> gs = new TreeSet<String>();
- for (Group g : allies) {
+ for (final Group g : allies) {
if (g.allies.contains(this)) {
gs.add(g.name);
}
@@ -819,7 +819,7 @@
final SortedSet<String> ms = new TreeSet<String>(memberRankComparator);
ms.addAll(members.keySet());
State state = null;
- for (String member : ms) {
+ for (final String member : ms) {
final State newState = members.get(member).getState();
if (newState != state) {
state = newState;
@@ -840,14 +840,14 @@
throw new SecurityException("This group is invisible and you don't have the required permissions to list this group's members.");
}
final SortedSet<String> online = new TreeSet<String>(memberRankComparator);
- for (String member : new TreeSet<String>(members.keySet())) {
+ for (final String member : new TreeSet<String>(members.keySet())) {
if (manager.isLoggedIn(member)) {
online.add(member);
}
}
if (online.size() != 0) {
final StringBuilder sb = new StringBuilder("Online members of ").append(name).append(':');
- for (String member : online) {
+ for (final String member : online) {
sb.append('\n').append(members.get(member));
}
manager.answer(sb);
@@ -1378,7 +1378,7 @@
final ObjectInputStream in = new ObjectInputStream(new FileInputStream("groups.dat"));
try {
groups = (Map<String, Group>) in.readObject();
- for (Map.Entry<String, Group> entry : groups.entrySet()) {
+ for (final Map.Entry<String, Group> entry : groups.entrySet()) {
entry.getValue().manager = this;
}
} finally {
Modified: trunk/src/net/sf/cherbot/MailManager.java
===================================================================
--- trunk/src/net/sf/cherbot/MailManager.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/MailManager.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -278,7 +278,7 @@
tell(player, "You have mail.");
}
if (player.equals(getCherBot().getUsername())) {
- for (String to : mails.keySet()) {
+ for (final String to : mails.keySet()) {
if (isLoggedIn(to)) {
tell(to, "You have mail. Use \"/tell Cherbot read mail\" to read it.");
}
@@ -296,7 +296,7 @@
if (ms == null) {
return false;
}
- for (Mail mail : ms) {
+ for (final Mail mail : ms) {
if (!mail.read) {
return true;
}
@@ -386,8 +386,8 @@
}
@Override protected void saveImpl() {
- for (String to : mails.keySet()) {
- for (Mail mail : mails.get(to)) {
+ for (final String to : mails.keySet()) {
+ for (final Mail mail : mails.get(to)) {
println(mail.from + ": " + mail.to + ": " + mail.ts + ": " + mail.msg + ": " + mail.read);
}
}
Modified: trunk/src/net/sf/cherbot/Manager.java
===================================================================
--- trunk/src/net/sf/cherbot/Manager.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/Manager.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -310,7 +310,7 @@
*/
public void load() throws Exception {
Exception ex = null;
- for (IOModule iomodule : iomodules) {
+ for (final IOModule iomodule : iomodules) {
try {
iomodule.load();
} catch (final Exception e) {
@@ -331,7 +331,7 @@
*/
public void save() throws Exception {
Exception ex = null;
- for (IOModule iomodule : iomodules) {
+ for (final IOModule iomodule : iomodules) {
try {
iomodule.save();
} catch (final Exception e) {
@@ -1281,7 +1281,7 @@
* {@inheritDoc}
*/
@Override protected final void saveImpl() {
- for (String key : map.keySet()) {
+ for (final String key : map.keySet()) {
println(key + ": " + conv.toString(map.get(key)));
}
}
Modified: trunk/src/net/sf/cherbot/ManagerDocumenter.java
===================================================================
--- trunk/src/net/sf/cherbot/ManagerDocumenter.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/ManagerDocumenter.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -43,7 +43,7 @@
doc = db.newDocument();
final Element root = doc.createElement("managers");
doc.appendChild(root);
- for (Manager manager : bot.managers()) {
+ for (final Manager manager : bot.managers()) {
root.appendChild(createElement(manager));
}
ls.createLSSerializer().writeToURI(doc, args[0]);
@@ -64,13 +64,13 @@
System.err.println("No description on " + clazz);
}
if (clazz.isAnnotationPresent(Manager.Features.class)) {
- for (String feature : clazz.getAnnotation(Manager.Features.class).value()) {
+ for (final String feature : clazz.getAnnotation(Manager.Features.class).value()) {
ret.appendChild(createTextElement("feature", feature));
}
} else {
System.err.println("No feature list on " + clazz);
}
- for (Manager.Command command : manager.commands()) {
+ for (final Manager.Command command : manager.commands()) {
ret.appendChild(createElement(command));
}
return ret;
@@ -93,7 +93,7 @@
System.err.println("No description on " + method);
}
if (method.isAnnotationPresent(Manager.Examples.class)) {
- for (String example : method.getAnnotation(Manager.Examples.class).value()) {
+ for (final String example : method.getAnnotation(Manager.Examples.class).value()) {
ret.appendChild(createTextElement("example", example));
}
} else {
Modified: trunk/src/net/sf/cherbot/NoobManager.java
===================================================================
--- trunk/src/net/sf/cherbot/NoobManager.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/NoobManager.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -149,7 +149,7 @@
*/
private void listHowtos() {
final StringBuilder sb = new StringBuilder();
- for (Pattern howto : howtos.keySet()) {
+ for (final Pattern howto : howtos.keySet()) {
if (sb.length() == 0) {
sb.append("I know the following howtos:\n");
} else {
@@ -166,7 +166,7 @@
*/
private void listWhatiss() {
final StringBuilder sb = new StringBuilder();
- for (Pattern whatis : whatiss.keySet()) {
+ for (final Pattern whatis : whatiss.keySet()) {
if (sb.length() == 0) {
sb.append("I know the following whatis:\n");
} else {
@@ -183,7 +183,7 @@
*/
private void listWhereiss() {
final StringBuilder sb = new StringBuilder();
- for (Pattern whereis : whereiss.keySet()) {
+ for (final Pattern whereis : whereiss.keySet()) {
if (sb.length() == 0) {
sb.append("I know the following whereis:\n");
} else {
@@ -200,7 +200,7 @@
* @param topic topic to get howto on
*/
private void getHowto(final String topic) {
- for (Pattern pattern : howtos.keySet()) {
+ for (final Pattern pattern : howtos.keySet()) {
if (pattern.matcher(topic).matches()) {
answer(howtos.get(pattern));
return;
@@ -214,7 +214,7 @@
* @param topic topic to get whereis on
*/
private void getWhereis(final String topic) {
- for (Pattern pattern : whereiss.keySet()) {
+ for (final Pattern pattern : whereiss.keySet()) {
if (pattern.matcher(topic).matches()) {
answer(whereiss.get(pattern));
return;
@@ -237,7 +237,7 @@
* @param topic topic to get whatis on
*/
private void getWhatis(final String topic) {
- for (Pattern pattern : whatiss.keySet()) {
+ for (final Pattern pattern : whatiss.keySet()) {
if (pattern.matcher(topic).matches()) {
answer(whatiss.get(pattern));
return;
@@ -271,7 +271,7 @@
}
@Override protected void saveImpl() {
- for (Pattern topic : howtos.keySet()) {
+ for (final Pattern topic : howtos.keySet()) {
println(topic.pattern() + ": " + howtos.get(topic));
}
}
@@ -285,7 +285,7 @@
}
@Override protected void saveImpl() {
- for (Pattern topic : whereiss.keySet()) {
+ for (final Pattern topic : whereiss.keySet()) {
println(topic.pattern() + ": " + whereiss.get(topic));
}
}
@@ -299,7 +299,7 @@
}
@Override protected void saveImpl() {
- for (Pattern topic : whatiss.keySet()) {
+ for (final Pattern topic : whatiss.keySet()) {
println(topic.pattern() + ": " + whatiss.get(topic));
}
}
Modified: trunk/src/net/sf/cherbot/PlayerManager.java
===================================================================
--- trunk/src/net/sf/cherbot/PlayerManager.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/PlayerManager.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -257,7 +257,7 @@
@Examples({ "Show me all gratulations.", "List all gratulations." })
@Override public void performImpl() {
checkPermission(PERM_LIST_GRATULATION);
- for (String player : new TreeSet<String>(gratulations.keySet())) {
+ for (final String player : new TreeSet<String>(gratulations.keySet())) {
answer(player + ": " + gratulations.get(player));
}
}
@@ -508,13 +508,13 @@
try {
final int level = new TreeSet<Integer>(levels.values()).last(); // get highest level
final SortedSet<String> highestPlayers = new TreeSet<String>();
- for (Map.Entry<String, Integer> entry : levels.entrySet()) {
+ for (final Map.Entry<String, Integer> entry : levels.entrySet()) {
if (entry.getValue() == level) {
highestPlayers.add(entry.getKey());
}
}
final StringBuilder sb = new StringBuilder();
- for (String player : highestPlayers) {
+ for (final String player : highestPlayers) {
if (sb.length() > 0) {
sb.append(", ");
}
@@ -697,7 +697,7 @@
}
playerAliases.add(alias);
}
- for (String name : new TreeSet<String>(reverseMap.keySet())) {
+ for (final String name : new TreeSet<String>(reverseMap.keySet())) {
sb.append('\n').append(name).append(": ");
concat(sb, reverseMap.get(name));
}
@@ -710,7 +710,7 @@
private void listPlayers() {
checkPermission(PERM_LIST_PLAYERS);
final StringBuilder sb = new StringBuilder();
- for (String player : new TreeSet<String>(players)) {
+ for (final String player : new TreeSet<String>(players)) {
sb
.append(sb.length() == 0 ? "I know the following players: " : ", ")
.append(player);
@@ -759,7 +759,7 @@
int end = wantedEnd;
final List<String> pl = new ArrayList<String>();
final List<String> pl2 = new ArrayList<String>();
- for (String player : players) {
+ for (final String player : players) {
if (levels.get(player) > lvl) {
pl.add(player);
}
Modified: trunk/src/net/sf/cherbot/PollManager.java
===================================================================
--- trunk/src/net/sf/cherbot/PollManager.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/PollManager.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -167,7 +167,7 @@
*/
private Poll getPoll(final int n) {
// TODO: implement a binary search for the poll
- for (Poll poll : polls) {
+ for (final Poll poll : polls) {
if (poll.getNumber() == n) {
return poll;
}
@@ -203,7 +203,7 @@
*/
private void listPolls(final PollState state, final String nopoll) {
final StringBuilder sb = new StringBuilder();
- for (Poll poll : polls) {
+ for (final Poll poll : polls) {
if (poll.getState() == state) {
sb.append(poll.getNumber()).append(": ").append(poll.getTitle()).append(" (").append(poll.getPlayer()).append(")\n");
}
@@ -226,7 +226,7 @@
.append(p.getTitle()).append('\n')
.append(p.getDescription()).append('\n');
int i = 0;
- for (String choice : p.getChoices()) {
+ for (final String choice : p.getChoices()) {
sb.append(++i).append(": ").append(choice);
if (p.getState() != PollState.PREPARATION) {
sb.append(" (").append(p.getVotes(choice)).append(" votes)");
@@ -653,7 +653,7 @@
out.print(" ");
}
out.println();
- for (String choice : choices) {
+ for (final String choice : choices) {
out.println(choice + ": " + votes.get(choice)[0]);
}
}
Modified: trunk/src/net/sf/cherbot/SalesManager.java
===================================================================
--- trunk/src/net/sf/cherbot/SalesManager.java 2006-10-29 14:02:55 UTC (rev 32)
+++ trunk/src/net/sf/cherbot/SalesManager.java 2006-10-29 14:10:21 UTC (rev 33)
@@ -162,7 +162,7 @@
if (!isActor(seller)) {
checkPermission(PERM_SELL);
}
- for (String ware : split(wares)) {
+ for (final String ware : split(wares)) {
if (sales.remove(new Entry(seller, ware))) {
answer("I now know that " + seller + " doesn't sell " + ware + " anymore.");
} else {
@@ -180,7 +180,7 @@
if (!isActor(seller)) {
checkPermission(PERM_SELL);
}
- for (String ware : split(wares)) {
+ for (final String ware : split(wares)) {
if (ware.length() > 0 && sales.add(new Entry(seller, ware))) {
answer("I now know that " + seller + " sells " + ware + '.');
} else {
@@ -195,7 +195,7 @@
*/
private void listWares(final String seller) {
final Set<String> wares = new TreeSet<String>();
- for (Entry sale : sales) {
+ for (final Entry sale : sales) {
if (sale.seller.equals(seller)) {
wares.add(sale.ware);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-10-29 14:03:13
|
Revision: 32
http://svn.sourceforge.net/cherbot/?rev=32&view=rev
Author: christianhujer
Date: 2006-10-29 06:02:55 -0800 (Sun, 29 Oct 2006)
Log Message:
-----------
Declared exception variables final, improved some I/O code.
Modified Paths:
--------------
trunk/src/net/sf/cherbot/CherBot.java
trunk/src/net/sf/cherbot/CherBotSecurityManager.java
trunk/src/net/sf/cherbot/EmotesManager.java
trunk/src/net/sf/cherbot/ExampleTester.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/NoobManager.java
trunk/src/net/sf/cherbot/PlayerManager.java
trunk/src/net/sf/cherbot/PollManager.java
trunk/src/net/sf/cherbot/TimeManager.java
Modified: trunk/src/net/sf/cherbot/CherBot.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBot.java 2006-10-29 13:49:33 UTC (rev 31)
+++ trunk/src/net/sf/cherbot/CherBot.java 2006-10-29 14:02:55 UTC (rev 32)
@@ -378,7 +378,7 @@
private static void switchColor(final int n) {
try {
System.out.print(colors[n]);
- } catch (ArrayIndexOutOfBoundsException e) {
+ } catch (final ArrayIndexOutOfBoundsException e) {
System.err.println("Unknown color number: " + n);
}
}
@@ -440,9 +440,9 @@
break;
}
}
- } catch (CherBotException e) {
+ } catch (final CherBotException e) {
answer("I can't: " + e.getMessage());
- } catch (SecurityException e) {
+ } catch (final SecurityException e) {
answer("I don't want to: " + e.getMessage());
}
}
@@ -515,7 +515,7 @@
try {
save();
answer("Saved all modules.");
- } catch (Exception e) {
+ } catch (final Exception e) {
answer("Save failed: " + e);
}
}
@@ -529,9 +529,9 @@
try {
managerMap.get(module).save();
answer("Saved module " + module + '.');
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
answer("No such module.");
- } catch (Exception e) {
+ } catch (final Exception e) {
answer("Error while saving module " + module + ": " + e);
}
}
@@ -544,7 +544,7 @@
try {
load();
answer("Loaded.");
- } catch (Exception e) {
+ } catch (final Exception e) {
answer("Save failed: " + e);
}
}
@@ -558,9 +558,9 @@
try {
managerMap.get(module).load();
answer("Loaded module " + module + '.');
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
answer("No such module.");
- } catch (Exception e) {
+ } catch (final Exception e) {
answer("Error while loading module " + module + ": " + e);
}
}
@@ -758,22 +758,19 @@
* 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')) {
- ;
- }
- answer(sb.toString());
- } catch (IOException e) {
- answer("No news available.");
- } finally {
+ final BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("news.txt")));
try {
+ final StringBuilder sb = new StringBuilder();
+ for (String line; (line = in.readLine()) != null; sb.append(line).append('\n')) {
+ ;
+ }
+ answer(sb.toString());
+ } finally {
in.close();
- } catch (Exception e) { /* ignore */ } finally {
- in = null;
}
+ } catch (final IOException e) {
+ answer("No news available.");
}
}
@@ -784,7 +781,7 @@
if (manager != InternalManager.this) {
try {
manager.save();
- } catch (Exception e) {
+ } catch (final Exception e) {
System.err.println("Error while saving data from module " + manager.getTopic() + ": " + e);
e.printStackTrace();
}
@@ -797,7 +794,7 @@
if (manager != InternalManager.this) {
try {
manager.load();
- } catch (Exception e) {
+ } catch (final Exception e) {
System.err.println("Error while loading data for module " + manager.getTopic() + ": " + e);
e.printStackTrace();
}
Modified: trunk/src/net/sf/cherbot/CherBotSecurityManager.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBotSecurityManager.java 2006-10-29 13:49:33 UTC (rev 31)
+++ trunk/src/net/sf/cherbot/CherBotSecurityManager.java 2006-10-29 14:02:55 UTC (rev 32)
@@ -256,9 +256,9 @@
// for (String line; (line = in.readLine) != null;) {
// // TODO
// }
- //} catch (IOException e) {
+ //} catch (final IOException e) {
// System.err.println(e);
- //} finally { try { in.close(); } catch (Exception e) { /* ignore */ } finally { in = null; }
+ //} finally { try { in.close(); } catch (final Exception e) { /* ignore */ } finally { in = null; }
// Binary interface:
try {
@@ -294,9 +294,9 @@
// }
// out.println();
// }
- //} catch (IOException e) {
+ //} catch (final IOException e) {
// System.err.println(e);
- //} finally { try { out.close(); } catch (Exception e) { /* ignore */ } finally { in = null; }
+ //} finally { try { out.close(); } catch (final Exception e) { /* ignore */ } finally { in = null; }
// Binary interface:
final ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("security.dat"));
Modified: trunk/src/net/sf/cherbot/EmotesManager.java
===================================================================
--- trunk/src/net/sf/cherbot/EmotesManager.java 2006-10-29 13:49:33 UTC (rev 31)
+++ trunk/src/net/sf/cherbot/EmotesManager.java 2006-10-29 14:02:55 UTC (rev 32)
@@ -563,7 +563,7 @@
int ranking;
try {
ranking = attitude.get(player)[0];
- } catch (Exception e) {
+ } catch (final Exception e) {
ranking = 0;
}
assert!(isLoved && isHated); // Not the best place, but if here it's only needed once.
Modified: trunk/src/net/sf/cherbot/ExampleTester.java
===================================================================
--- trunk/src/net/sf/cherbot/ExampleTester.java 2006-10-29 13:49:33 UTC (rev 31)
+++ trunk/src/net/sf/cherbot/ExampleTester.java 2006-10-29 14:02:55 UTC (rev 32)
@@ -70,7 +70,7 @@
} else {
System.err.println("No examples on " + method);
}
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
assert false;
}
return suite;
Modified: trunk/src/net/sf/cherbot/MailManager.java
===================================================================
--- trunk/src/net/sf/cherbot/MailManager.java 2006-10-29 13:49:33 UTC (rev 31)
+++ trunk/src/net/sf/cherbot/MailManager.java 2006-10-29 14:02:55 UTC (rev 32)
@@ -323,7 +323,7 @@
private Mail getMail(final int n) {
try {
return mails.get(getActor()).get(n - 1);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new CherBotException("No such mail: " + n);
}
}
Modified: trunk/src/net/sf/cherbot/Manager.java
===================================================================
--- trunk/src/net/sf/cherbot/Manager.java 2006-10-29 13:49:33 UTC (rev 31)
+++ trunk/src/net/sf/cherbot/Manager.java 2006-10-29 14:02:55 UTC (rev 32)
@@ -313,7 +313,7 @@
for (IOModule iomodule : iomodules) {
try {
iomodule.load();
- } catch (Exception e) {
+ } catch (final Exception e) {
if (ex == null) {
ex = e;
}
@@ -334,7 +334,7 @@
for (IOModule iomodule : iomodules) {
try {
iomodule.save();
- } catch (Exception e) {
+ } catch (final Exception e) {
if (ex == null) {
ex = e;
}
@@ -579,7 +579,7 @@
parent = clazz;
try {
return (String) clazz.getField("C_" + name).get(null);
- } catch (Exception e) {
+ } catch (final Exception e) {
ex = e;
}
clazz = clazz.getEnclosingClass();
@@ -754,7 +754,7 @@
} finally {
try {
reader.close();
- } catch (Exception e) { /* ignore */ } finally {
+ } catch (final Exception e) { /* ignore */ } finally {
reader = null;
}
}
@@ -770,7 +770,7 @@
} finally {
try {
writer.close();
- } catch (Exception e) { /* ignore */ } finally {
+ } catch (final Exception e) { /* ignore */ } finally {
writer = null;
}
}
@@ -856,7 +856,7 @@
ReadIterator() {
try {
line = readLine();
- } catch (IOException e) {
+ } catch (final IOException e) {
this.e = e;
}
}
@@ -883,7 +883,7 @@
} finally {
try {
line = readLine();
- } catch (IOException e) {
+ } catch (final IOException e) {
line = null;
this.e = e;
}
@@ -979,7 +979,7 @@
MatcherIterator() {
try {
line = reader().readLine();
- } catch (IOException e) {
+ } catch (final IOException e) {
this.e = e;
}
}
Modified: trunk/src/net/sf/cherbot/ManagerDocumenter.java
===================================================================
--- trunk/src/net/sf/cherbot/ManagerDocumenter.java 2006-10-29 13:49:33 UTC (rev 31)
+++ trunk/src/net/sf/cherbot/ManagerDocumenter.java 2006-10-29 14:02:55 UTC (rev 32)
@@ -99,7 +99,7 @@
} else {
System.err.println("No examples on " + method);
}
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
assert false;
}
return ret;
Modified: trunk/src/net/sf/cherbot/NoobManager.java
===================================================================
--- trunk/src/net/sf/cherbot/NoobManager.java 2006-10-29 13:49:33 UTC (rev 31)
+++ trunk/src/net/sf/cherbot/NoobManager.java 2006-10-29 14:02:55 UTC (rev 32)
@@ -227,7 +227,7 @@
} else {
answer("I don't know where players are. They usually don't tell me. And if they would, that information would be out of date too soon.");
}
- } catch (NoSuchPlayerException e) {
+ } catch (final NoSuchPlayerException e) {
answer("I don't know where " + topic + " is.");
}
}
@@ -256,7 +256,7 @@
try {
howtos.put(Pattern.compile(topic), text);
answer("Howto on " + topic + " successfully added.");
- } catch (PatternSyntaxException e) {
+ } catch (final PatternSyntaxException e) {
answer("I do not understand that regular expression: " + e.getMessage());
}
}
Modified: trunk/src/net/sf/cherbot/PlayerManager.java
===================================================================
--- trunk/src/net/sf/cherbot/PlayerManager.java 2006-10-29 13:49:33 UTC (rev 31)
+++ trunk/src/net/sf/cherbot/PlayerManager.java 2006-10-29 14:02:55 UTC (rev 32)
@@ -299,7 +299,7 @@
int end = 0;
try {
end = parseInt(gr(2));
- } catch (Exception e) { /* ignore */ }
+ } catch (final Exception e) { /* ignore */ }
if (end < start) {
end = start + 9;
}
@@ -456,7 +456,7 @@
@Override public int getLevel(final String player) {
try {
return levels.get(player);
- } catch (Exception e) {
+ } catch (final Exception e) {
return 0;
}
}
@@ -476,7 +476,7 @@
try {
final long ls = lastSeen.get(player);
answer("I've last seen " + player + " at: " + dateFormat.format(new Date(ls)) + "\nMy current time is: " + dateFormat.format(new Date()));
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
answer("I don't know when " + player + " was last online.");
}
}
@@ -523,7 +523,7 @@
sb.append(highestPlayers.size() > 1 ? " all have " : " has ");
sb.append("level ").append(Integer.toString(level)).append('.');
answer(sb.toString());
- } catch (NoSuchElementException e) {
+ } catch (final NoSuchElementException e) {
answer("I don't know any levels yet.");
}
}
@@ -630,7 +630,7 @@
try {
final int level = levels.get(player);
answer(player + " is level " + level + '.');
- } catch (Exception e) {
+ } catch (final Exception e) {
answer("I don't know the level of player " + player + '.');
}
}
Modified: trunk/src/net/sf/cherbot/PollManager.java
===================================================================
--- trunk/src/net/sf/cherbot/PollManager.java 2006-10-29 13:49:33 UTC (rev 31)
+++ trunk/src/net/sf/cherbot/PollManager.java 2006-10-29 14:02:55 UTC (rev 32)
@@ -246,7 +246,7 @@
Poll poll;
try {
poll = new Poll(polls.get(polls.size() - 1).getNumber() + 1);
- } catch (Exception e) { // first poll
+ } catch (final Exception e) { // first poll
poll = new Poll(1);
}
polls.add(poll);
@@ -508,7 +508,7 @@
try {
choices.remove(choice);
answer("Choice removed.");
- } catch (IndexOutOfBoundsException e) {
+ } catch (final IndexOutOfBoundsException e) {
throw new CherBotException("No such choice on poll #" + number + ": " + choice + '.');
}
}
@@ -634,7 +634,7 @@
choices.add(choice);
votes.put(choice, new int[] { parseInt(matcher.group(2)) });
}
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
throw new EOFException();
}
}
Modified: trunk/src/net/sf/cherbot/TimeManager.java
===================================================================
--- trunk/src/net/sf/cherbot/TimeManager.java 2006-10-29 13:49:33 UTC (rev 31)
+++ trunk/src/net/sf/cherbot/TimeManager.java 2006-10-29 14:02:55 UTC (rev 32)
@@ -330,7 +330,7 @@
try {
Time t = (Time) obj;
return compareTo(t) == 0;
- } catch (Exception e) {
+ } catch (final Exception e) {
return false;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-10-29 13:50:05
|
Revision: 31
http://svn.sourceforge.net/cherbot/?rev=31&view=rev
Author: christianhujer
Date: 2006-10-29 05:49:33 -0800 (Sun, 29 Oct 2006)
Log Message:
-----------
Some code cleanup. Removed several warnings.
Modified Paths:
--------------
trunk/src/net/sf/cherbot/BlackListManager.java
trunk/src/net/sf/cherbot/CherBotLogger.java
trunk/src/net/sf/cherbot/CherBotSecurityManager.java
trunk/src/net/sf/cherbot/CollectionsManager.java
trunk/src/net/sf/cherbot/Crime.java
trunk/src/net/sf/cherbot/CrimeManager.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/GroupManager.java
trunk/src/net/sf/cherbot/MailManager.java
trunk/src/net/sf/cherbot/Manager.java
trunk/src/net/sf/cherbot/PlayerManager.java
trunk/src/net/sf/cherbot/PollManager.java
trunk/src/net/sf/cherbot/SalesManager.java
trunk/src/net/sf/cherbot/SmutManager.java
Modified: trunk/src/net/sf/cherbot/BlackListManager.java
===================================================================
--- trunk/src/net/sf/cherbot/BlackListManager.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/BlackListManager.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -105,6 +105,7 @@
/**
* Checks wether a player is blacklisted.
* @param player Player to check
+ * @return <code>true</code> if <var>player</var> is blacklisted, otherwise <code>false</code>.
*/
public boolean isBlacklisted(final String player) {
return blacklist.contains(player);
@@ -112,6 +113,7 @@
/**
* Checks wether the actor is blacklisted.
+ * @return <code>true</code> if the actor is blacklisted, otherwise <code>false</code>.
*/
public boolean isBlacklisted() {
return blacklist.contains(getActor());
Modified: trunk/src/net/sf/cherbot/CherBotLogger.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBotLogger.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/CherBotLogger.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -23,6 +23,7 @@
/**
* Create a logger.
+ * @throws IOException in case of I/O problems during logger creation.
*/
@SuppressWarnings({ "IOResourceOpenedButNotSafelyClosed" })
public CherBotLogger() throws IOException {
Modified: trunk/src/net/sf/cherbot/CherBotSecurityManager.java
===================================================================
--- trunk/src/net/sf/cherbot/CherBotSecurityManager.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/CherBotSecurityManager.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -129,6 +129,7 @@
/**
* Create the SecurityManager.
+ * @param cherBot reference to CherBot instance.
*/
public CherBotSecurityManager(final CherBot cherBot) {
super(cherBot, "security");
@@ -260,20 +261,17 @@
//} finally { try { in.close(); } catch (Exception e) { /* ignore */ } finally { in = null; }
// Binary interface:
- ObjectInputStream in = null;
try {
- in = new ObjectInputStream(new FileInputStream("security.dat"));
- permissions = (Map<String, Permissions>) in.readObject();
- } catch (ClassNotFoundException e) {
- final IOException ioe = new IOException("Error with file \"security.dat\":");
- ioe.initCause(e);
- throw ioe;
- } finally {
+ final ObjectInputStream in = new ObjectInputStream(new FileInputStream("security.dat"));
try {
+ permissions = (Map<String, Permissions>) in.readObject();
+ } finally {
in.close();
- } catch (Exception e) { /* ignore */ } finally {
- in = null;
}
+ } catch (final ClassNotFoundException e) {
+ final IOException ioe = new IOException("Error with file \"security.dat\":");
+ ioe.initCause(e);
+ throw ioe;
}
}
@@ -301,16 +299,11 @@
//} finally { try { out.close(); } catch (Exception e) { /* ignore */ } finally { in = null; }
// Binary interface:
- ObjectOutputStream out = null;
+ final ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("security.dat"));
try {
- out = new ObjectOutputStream(new FileOutputStream("security.dat"));
out.writeObject(permissions);
} finally {
- try {
- out.close();
- } catch (Exception e) { /* ignore */ } finally {
- out = null;
- }
+ out.close();
}
}
Modified: trunk/src/net/sf/cherbot/CollectionsManager.java
===================================================================
--- trunk/src/net/sf/cherbot/CollectionsManager.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/CollectionsManager.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -80,10 +80,10 @@
/**
* {@inheritDoc}
*/
- public int compareTo(final Entry e) {
- int ret = collector.compareTo(e.collector);
+ public int compareTo(final Entry o) {
+ int ret = collector.compareTo(o.collector);
if (ret == 0) {
- ret = collectable.compareTo(e.collectable);
+ ret = collectable.compareTo(o.collectable);
}
return ret;
}
Modified: trunk/src/net/sf/cherbot/Crime.java
===================================================================
--- trunk/src/net/sf/cherbot/Crime.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/Crime.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -24,15 +24,15 @@
this.crimetype = crimetype;
}
- public boolean equals(final Object o) {
- if (o == null || !(o instanceof Crime)) {
+ @Override public boolean equals(final Object obj) {
+ if (obj == null || !(obj instanceof Crime)) {
return false;
}
- Crime c = (Crime) o;
+ Crime c = (Crime) obj;
return c.criminal.equals(criminal) && c.crimetype.equals(crimetype);
}
- public int hashCode() {
+ @Override public int hashCode() {
return criminal.hashCode() ^ crimetype.hashCode();
}
Modified: trunk/src/net/sf/cherbot/CrimeManager.java
===================================================================
--- trunk/src/net/sf/cherbot/CrimeManager.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/CrimeManager.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -166,7 +166,7 @@
//
/**
- * ...
+ * @param cherBot reference to CherBot.
*/
public CrimeManager(final CherBot cherBot) {
super(cherBot, "crimes");
Modified: trunk/src/net/sf/cherbot/DummyManagerProxy.java
===================================================================
--- trunk/src/net/sf/cherbot/DummyManagerProxy.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/DummyManagerProxy.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -22,6 +22,7 @@
/**
* Create a DummyManager.
* @param cherBot CherBot to create DummyManager for
+ * @param managers Managers to register
*/
public DummyManagerProxy(final CherBot cherBot, final Manager... managers) {
super(cherBot, "dummy");
Modified: trunk/src/net/sf/cherbot/EmotesManager.java
===================================================================
--- trunk/src/net/sf/cherbot/EmotesManager.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/EmotesManager.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -215,14 +215,9 @@
} // Commands
/**
- * The current matcher. Create an EmotesManager.
+ * Create an EmotesManager.
* @param cherBot CherBot
- * Create an EmotesManager.
- * @param cherBot CherBot
*/
- /** Create an EmotesManager.
- * @param cherBot CherBot
- */
public EmotesManager(final CherBot cherBot) {
super(cherBot, "emotes");
for (String pat : patternTexts) {
Modified: trunk/src/net/sf/cherbot/ExampleTestCase.java
===================================================================
--- trunk/src/net/sf/cherbot/ExampleTestCase.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/ExampleTestCase.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -53,15 +53,17 @@
/**
* {@inheritDoc}
*/
- @Override public void setUp() {
+ @Override public void setUp() throws Exception {
+ super.setUp();
pat = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);
}
/**
* {@inheritDoc}
*/
- @Override public void tearDown() {
+ @Override public void tearDown() throws Exception {
pat = null;
+ super.tearDown();
}
/**
Modified: trunk/src/net/sf/cherbot/ExampleTester.java
===================================================================
--- trunk/src/net/sf/cherbot/ExampleTester.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/ExampleTester.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -29,6 +29,7 @@
/**
* Create a TestSuite for Cherbot.
* @param cherbot CherBot to create TestSuite for
+ * @return TestSuite for CherBot
*/
public static TestSuite createSuite(final CherBot cherbot) {
final TestSuite suite = new ExampleTester();
Modified: trunk/src/net/sf/cherbot/GroupManager.java
===================================================================
--- trunk/src/net/sf/cherbot/GroupManager.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/GroupManager.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -386,44 +386,43 @@
* List the groups for the Wiki.
*/
private void listGroupsForWiki() {
- PrintWriter out = null;
try {
- out = new PrintWriter("groupsForWiki.wiki", "iso-8859-1");
- out
- .append("This list is Cherbot's list of clans found on damn.\n\n")
- .append("If you want to found a clan yourself, read the Clan forum sticky [Clan registry (\"How do I start my own clan?\")|http://www.daimonin.net/index.php?name=PNphpBB2&file=viewtopic&t=665]\n\n")
- .append("|__Name__|__Size__|__Founder__\n")
- ;
- for (final String name : new TreeSet<String>(groups.keySet())) {
- final Group group = groups.get(name);
- if (group.isVisible()) {
- out
- .append('|')
- .append(wikiFix(group.name))
- .append('|')
- .append(Integer.toString(group.getMemberCount()))
- .append('|')
- .append(wikiFix(group.founder))
- .append('\n')
- ;
- }
- }
- out.append("\nNote: The list taken from Cherbot. Please do not modify this page since it is auto-generated. Your changes are likely to be overwritten with the next clan update. For complaints, send a pm to Cheristheus.\n");
- } catch (IOException e) {
- answer(e.toString());
- } finally {
+ final PrintWriter out = new PrintWriter("groupsForWiki.wiki", "iso-8859-1");
try {
+ out
+ .append("This list is Cherbot's list of clans found on damn.\n\n")
+ .append("If you want to found a clan yourself, read the Clan forum sticky [Clan registry (\"How do I start my own clan?\")|http://www.daimonin.net/index.php?name=PNphpBB2&file=viewtopic&t=665]\n\n")
+ .append("|__Name__|__Size__|__Founder__\n")
+ ;
+ for (final String name : new TreeSet<String>(groups.keySet())) {
+ final Group group = groups.get(name);
+ if (group.isVisible()) {
+ out
+ .append('|')
+ .append(escapeForWiki(group.name))
+ .append('|')
+ .append(Integer.toString(group.getMemberCount()))
+ .append('|')
+ .append(escapeForWiki(group.founder))
+ .append('\n')
+ ;
+ }
+ }
+ out.append("\nNote: The list taken from Cherbot. Please do not modify this page since it is auto-generated. Your changes are likely to be overwritten with the next clan update. For complaints, send a pm to Cheristheus.\n");
+ } finally {
out.close();
- } catch (Exception e) { /* ignore */ } finally {
- out = null;
}
+ } catch (final IOException e) {
+ answer(e.toString());
}
}
/**
- * Fix a String for the Wiki.
+ * Escape a String for the Wiki.
+ * @param s String to escape
+ * @return String escaped for Wiki
*/
- private static String wikiFix(final String s) {
+ private static String escapeForWiki(final String s) {
return s.replaceAll("(\\b[A-Z]\\w+[A-Z])", "!$1");
}
@@ -491,7 +490,7 @@
}
return ret;
}
- }
+ } // class MemberRankComparator
/**
* The manager of this Group.
@@ -597,10 +596,7 @@
*/
private boolean isAdmin() {
final Member member = members.get(manager.getActor());
- if (member == null) {
- return false;
- }
- return member.isAdmin();
+ return member != null && member.isAdmin();
}
/**
@@ -609,10 +605,7 @@
*/
private boolean isSender() {
final Member member = members.get(manager.getActor());
- if (member == null) {
- return false;
- }
- return member.isAdmin() || member.isSender();
+ return member != null && (member.isAdmin() || member.isSender());
}
/**
@@ -873,6 +866,7 @@
/**
* Returns wether the player applied for membership in this group.
+ * @param player Player to check whether he's an applicant
* @return <code>true</code> if the player applied for membership in this group
*/
boolean isApplicant(final String player) {
@@ -890,6 +884,7 @@
/**
* Return wether the player was invited to membership in this group.
+ * @param player Player to check whether he's an invitee
* @return <code>true</code> if the player was invited to membership in this group
*/
boolean isInvitee(final String player) {
@@ -1096,6 +1091,7 @@
/**
* Send message to all members.
+ * @param msg Message to send
*/
private void dispatch(final String msg) {
checkMaySend();
@@ -1109,6 +1105,9 @@
/**
* Implementation for deserialization:
* Take care about newly added fields
+ * @param stream Stream to deserialize with
+ * @throws IOException in case of I/O problems during deserialization
+ * @throws ClassNotFoundException in case a class required for deserialization was not found
*/
private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
@@ -1153,7 +1152,7 @@
return false;
}
final Group other = (Group) obj;
- return other.name != null ? other.name.equals(name) : false;
+ return other.name != null && other.name.equals(name);
}
/**
@@ -1374,24 +1373,21 @@
@Override public void load() throws IOException {
// Text interface: TODO
// Binary interface:
- ObjectInputStream in = null;
try {
// The groups are completely restored, not merged on load. This is intentional.
- in = new ObjectInputStream(new FileInputStream("groups.dat"));
- groups = (Map<String, Group>) in.readObject();
- for (Map.Entry<String, Group> entry : groups.entrySet()) {
- entry.getValue().manager = this;
+ final ObjectInputStream in = new ObjectInputStream(new FileInputStream("groups.dat"));
+ try {
+ groups = (Map<String, Group>) in.readObject();
+ for (Map.Entry<String, Group> entry : groups.entrySet()) {
+ entry.getValue().manager = this;
+ }
+ } finally {
+ in.close();
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
final IOException ioe = new IOException("Error with file \"groups.dat\":");
ioe.initCause(e);
throw ioe;
- } finally {
- try {
- in.close();
- } catch (Exception e) { /* ignore */ } finally {
- in = null;
- }
}
}
@@ -1401,16 +1397,11 @@
@Override public void save() throws IOException {
// Text interface (loading is unfinished):
// Binary interface:
- ObjectOutputStream out = null;
+ final ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("groups.dat"));
try {
- out = new ObjectOutputStream(new FileOutputStream("groups.dat"));
out.writeObject(groups);
} finally {
- try {
- out.close();
- } catch (Exception e) { /* ignore */ } finally {
- out = null;
- }
+ out.close();
}
}
Modified: trunk/src/net/sf/cherbot/MailManager.java
===================================================================
--- trunk/src/net/sf/cherbot/MailManager.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/MailManager.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -289,6 +289,7 @@
/**
* Checks wether someone has unread mail.
* @param who who has mail
+ * @return <code>true</code> in case <var>who</var> has unread mail, otherwise <code>false</code>.
*/
private boolean hasUnreadMail(final String who) {
final List<Mail> ms = mails.get(who);
@@ -306,6 +307,7 @@
/**
* Checks wether someone has mail.
* @param who who has mail
+ * @return <code>true</code> in case <var>who</var> has mail, otherwise <code>false</code>.
*/
private boolean hasMail(final String who) {
final List<Mail> ms = mails.get(who);
@@ -316,6 +318,7 @@
* Gets a mail.
* @param n number of mail to get
* @throws CherBotException if no such mail
+ * @return mail number <var>n</var> for the actor.
*/
private Mail getMail(final int n) {
try {
@@ -361,9 +364,9 @@
/**
* Send mail.
- * @param from
- * @param to
- * @param msg
+ * @param from Sender
+ * @param to Receiver
+ * @param msg Message body
*/
@Override public void mail(final String from, final String to, final String msg) {
new Mail(from, to, msg);
Modified: trunk/src/net/sf/cherbot/Manager.java
===================================================================
--- trunk/src/net/sf/cherbot/Manager.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/Manager.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -229,10 +229,7 @@
return false;
} // Return false since if not keeping track better treat noone as logged in
assert playerManager != this : "A Manager for \"players\" must override Manager.player(String)!";
- if (playerManager == this) {
- return false;
- } // simply return if assertions aren't enabled, to avoid endless recursion
- return playerManager.isLoggedIn(player);
+ return playerManager != this && playerManager.isLoggedIn(player);
}
/**
@@ -1013,7 +1010,7 @@
} finally {
try {
line = reader().readLine();
- } catch (IOException e) {
+ } catch (final IOException e) {
line = null;
this.e = e;
}
@@ -1067,7 +1064,7 @@
if (clearBeforeLoading) {
col.clear();
}
- for (String line : this) {
+ for (final String line : this) {
col.add(line);
}
}
@@ -1076,7 +1073,7 @@
* {@inheritDoc}
*/
@Override protected final void saveImpl() {
- for (String line : col) {
+ for (final String line : col) {
println(line);
}
}
Modified: trunk/src/net/sf/cherbot/PlayerManager.java
===================================================================
--- trunk/src/net/sf/cherbot/PlayerManager.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/PlayerManager.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -869,7 +869,7 @@
*/
private static enum Gender {
- male, female;
+ MALE, FEMALE
}
} // class LevelManager
Modified: trunk/src/net/sf/cherbot/PollManager.java
===================================================================
--- trunk/src/net/sf/cherbot/PollManager.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/PollManager.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -282,18 +282,13 @@
* {@inheritDoc}
*/
@Override public void save() throws IOException {
- PrintWriter out = null;
+ final PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream("polls.txt")));
try {
- out = new PrintWriter(new OutputStreamWriter(new FileOutputStream("polls.txt")));
- for (Poll poll : polls) {
+ for (final Poll poll : polls) {
poll.writeTo(out);
}
} finally {
- try {
- out.close();
- } catch (Exception e) { /* ignore */ } finally {
- out = null;
- }
+ out.close();
}
}
@@ -301,20 +296,15 @@
* {@inheritDoc}
*/
@Override public void load() throws IOException {
- BufferedReader in = null;
+ BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("polls.txt")));
try {
- in = new BufferedReader(new InputStreamReader(new FileInputStream("polls.txt")));
- try {
- while (polls.add(new Poll(in))) {
- ;
- }
- } catch (NullPointerException e) { /* ignore */ }
- } finally {
- try {
- in.close();
- } catch (Exception e) { /* ignore */ } finally {
- in = null;
+ while (polls.add(new Poll(in))) {
+ ;
}
+ } catch (final NullPointerException e) {
+ /* ignore */
+ } finally {
+ in.close();
}
}
Modified: trunk/src/net/sf/cherbot/SalesManager.java
===================================================================
--- trunk/src/net/sf/cherbot/SalesManager.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/SalesManager.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -133,7 +133,7 @@
/**
* List the sellers that sell a specific ware.
- * @param ware
+ * @param ware Ware to sell
*/
private void listSellers(final String ware) {
final Set<String> sellers = new TreeSet<String>();
Modified: trunk/src/net/sf/cherbot/SmutManager.java
===================================================================
--- trunk/src/net/sf/cherbot/SmutManager.java 2006-10-29 13:13:32 UTC (rev 30)
+++ trunk/src/net/sf/cherbot/SmutManager.java 2006-10-29 13:49:33 UTC (rev 31)
@@ -129,6 +129,7 @@
/**
* Remove a pattern to the list of smut patterns.
* @param pattern pattern to remove
+ * @return whether remove was successful
*/
public boolean remove(final String pattern) {
return patterns.remove(Pattern.compile(pattern));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-10-29 13:13:49
|
Revision: 30
http://svn.sourceforge.net/cherbot/?rev=30&view=rev
Author: christianhujer
Date: 2006-10-29 05:13:32 -0800 (Sun, 29 Oct 2006)
Log Message:
-----------
Added requirements document.
Modified Paths:
--------------
trunk/src/doc/start.xhtml
Added Paths:
-----------
trunk/src/doc/requirements2.0.xhtml
Property Changed:
----------------
trunk/src/doc/start.xhtml
Added: trunk/src/doc/requirements2.0.xhtml
===================================================================
--- trunk/src/doc/requirements2.0.xhtml (rev 0)
+++ trunk/src/doc/requirements2.0.xhtml 2006-10-29 13:13:32 UTC (rev 30)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
+ <head>
+ <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
+ <meta http-equiv="X-Subversion-Id" content="$Id$" />
+ <title>CherBot v2.0 Requirements</title>
+ </head>
+ <body>
+ <h1>CherBot v2.0 Requirements</h1>
+ <p>
+ The current version of CherBot has some flaws:
+ </p>
+ <ul>
+ <li>It needs a huge amount of memory (2.5 times more memory than gridarta, the daimonin map editor).</li>
+ <li>It has no proper support for multiple servers within a single CherBot instance.</li>
+ <li>Sometimes it doesn't detect a dropped network connection.</li>
+ </ul>
+ <p>
+ Additionally we think about the following new features:
+ </p>
+ <ul>
+ <li>Database backend.</li>
+ <li>IRC interface.</li>
+ <li>Even better natural language processing.</li>
+ <li>Web interface.</li>
+ <li>Graphical user interface.</li>
+ </ul>
+ </body>
+</html>
Property changes on: trunk/src/doc/requirements2.0.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:keywords
+ Id
Name: svn:eol-style
+ LF
Modified: trunk/src/doc/start.xhtml
===================================================================
--- trunk/src/doc/start.xhtml 2006-10-29 11:39:54 UTC (rev 29)
+++ trunk/src/doc/start.xhtml 2006-10-29 13:13:32 UTC (rev 30)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
- <meta name="Date" content="$Date: 2006-10-21 18:41:32 +0200 (Sa, 21 Okt 2006) $" />
+ <meta http-equiv="X-Subversion-Id" content="$Id$" />
<meta name="keywords" content="CherBot, Bot, MMORPG, Angelion, Crossfire, Daimonin" />
<meta name="description" content="CherBot is an information bot for Daimonin which probably would also work pretty well with Angelion and to less extent with Crossfire. CherBot keeps track of which players collect which items, who's been online, determines a level ranking, provides a mail system for mailing offline players, manages clans and more." />
<link rel="alternate" type="application/rss+xml" title="Project news releases" href="http://sourceforge.net/export/rss2_projnews.php?group_id=180828" />
@@ -26,9 +26,6 @@
CherBot does not walk around, target, kill mob, heal, do quest.
CherBot does not interefere with real player's gaming.
</p>
- <p>
- Usually, you will find Cherbot standing around in the church somewhere near the priest, since he regular needs food.
- </p>
<h2>Download CherBot</h2>
<p>
CherBot can't be downloaded yet.
@@ -78,5 +75,10 @@
<li>Cherbot responds with a text that tells you the command was executed.</li>
<li>Cherbot crashes (unlikely, but certainly possible)</li>
</ul>
+ <h2>The Future of CherBot</h2>
+ <p>
+ We've setup a page describing <a href="requirements2.0">requirements</a> for the next major version of CherBot.
+ If you have any ideas and wishes for CherBot, please use our <a href="http://sourceforge.net/tracker/?group_id=180828&atid=894751">Feature Request Tracker</a> (go to <em>Submit New</em> there).
+ </p>
</body>
</html>
Property changes on: trunk/src/doc/start.xhtml
___________________________________________________________________
Name: svn:keywords
+ Id
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-10-29 11:40:11
|
Revision: 29
http://svn.sourceforge.net/cherbot/?rev=29&view=rev
Author: christianhujer
Date: 2006-10-29 03:39:54 -0800 (Sun, 29 Oct 2006)
Log Message:
-----------
Added megaxslt jar.
Added Paths:
-----------
trunk/lib/LICENSE-megaxslt.jar
trunk/lib/megaxslt.jar
Added: trunk/lib/LICENSE-megaxslt.jar
===================================================================
--- trunk/lib/LICENSE-megaxslt.jar (rev 0)
+++ trunk/lib/LICENSE-megaxslt.jar 2006-10-29 11:39:54 UTC (rev 29)
@@ -0,0 +1,4 @@
+MegaXSLT must only be used for building the CherBot documentation.
+It is not allowed to use MegaXSLT for other purposes.
+MegaXSLT comes as it is, without any implicit or explicit warrant.
+USE AT YOUR OWN RISK!
Property changes on: trunk/lib/LICENSE-megaxslt.jar
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ LF
Added: trunk/lib/megaxslt.jar
===================================================================
(Binary files differ)
Property changes on: trunk/lib/megaxslt.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-10-29 00:19:32
|
Revision: 28
http://svn.sourceforge.net/cherbot/?rev=28&view=rev
Author: christianhujer
Date: 2006-10-28 17:19:13 -0700 (Sat, 28 Oct 2006)
Log Message:
-----------
Optimized imports.
Modified Paths:
--------------
trunk/src/net/sf/cherbot/ExampleTestCase.java
trunk/src/net/sf/cherbot/ExampleTester.java
trunk/src/net/sf/cherbot/Manager.java
Modified: trunk/src/net/sf/cherbot/ExampleTestCase.java
===================================================================
--- trunk/src/net/sf/cherbot/ExampleTestCase.java 2006-10-29 00:11:57 UTC (rev 27)
+++ trunk/src/net/sf/cherbot/ExampleTestCase.java 2006-10-29 00:19:13 UTC (rev 28)
@@ -7,7 +7,7 @@
package net.sf.cherbot;
import java.util.regex.Pattern;
-import junit.framework.*;
+import junit.framework.TestCase;
/**
* Class for a single Test Case that checks an example String against a regular expression.
Modified: trunk/src/net/sf/cherbot/ExampleTester.java
===================================================================
--- trunk/src/net/sf/cherbot/ExampleTester.java 2006-10-29 00:11:57 UTC (rev 27)
+++ trunk/src/net/sf/cherbot/ExampleTester.java 2006-10-29 00:19:13 UTC (rev 28)
@@ -8,7 +8,9 @@
import java.lang.reflect.Method;
import java.util.Enumeration;
-import junit.framework.*;
+import junit.framework.Test;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
/**
* Class that tests wether the examples given on the Commands really match the regular expressions.
Modified: trunk/src/net/sf/cherbot/Manager.java
===================================================================
--- trunk/src/net/sf/cherbot/Manager.java 2006-10-29 00:11:57 UTC (rev 27)
+++ trunk/src/net/sf/cherbot/Manager.java 2006-10-29 00:19:13 UTC (rev 28)
@@ -17,6 +17,7 @@
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.Target;
+import java.security.Permission;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -26,7 +27,6 @@
import java.util.NoSuchElementException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import java.security.Permission;
/**
* Base class for managers.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-10-29 00:12:04
|
Revision: 27
http://svn.sourceforge.net/cherbot/?rev=27&view=rev
Author: christianhujer
Date: 2006-10-28 17:11:57 -0700 (Sat, 28 Oct 2006)
Log Message:
-----------
Improved ignore.
Property Changed:
----------------
trunk/
Property changes on: trunk
___________________________________________________________________
Name: svn:ignore
- classes
cherbot.iws
dest
ideaclasses
developer.properties
+ classes
cherbot.iws
dest
ideaclasses
developer.properties
CherBot.jar
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-10-29 00:10:42
|
Revision: 26
http://svn.sourceforge.net/cherbot/?rev=26&view=rev
Author: christianhujer
Date: 2006-10-28 17:10:36 -0700 (Sat, 28 Oct 2006)
Log Message:
-----------
Added junit to classpath. Now project compiles with Ant again.
Modified Paths:
--------------
trunk/build.xml
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2006-10-29 00:09:24 UTC (rev 25)
+++ trunk/build.xml 2006-10-29 00:10:36 UTC (rev 26)
@@ -34,6 +34,9 @@
debug = "yes"
encoding = "utf-8"
>
+ <classpath>
+ <pathelement location="lib/junit-4.1.jar" />
+ </classpath>
<compilerarg line="-Xlint:all"/>
<compilerarg line="-Xmaxerrs 400"/>
<compilerarg line="-Xmaxwarns 4000"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2006-10-29 00:09:30
|
Revision: 25
http://svn.sourceforge.net/cherbot/?rev=25&view=rev
Author: christianhujer
Date: 2006-10-28 17:09:24 -0700 (Sat, 28 Oct 2006)
Log Message:
-----------
Improved ignore.
Property Changed:
----------------
trunk/
Property changes on: trunk
___________________________________________________________________
Name: svn:ignore
- classes
cherbot.iws
+ classes
cherbot.iws
dest
ideaclasses
developer.properties
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|