Skip to content
This repository was archived by the owner on Jan 19, 2018. It is now read-only.

Commit 80ae5b0

Browse files
committed
Formatted using bruce's xml fiel
This commit formats the code using the codestyle.xml formatting used by Bruce. I have commited the changes and netbeans configuration file in this commit to, so other netbeans users can use the config :).
1 parent 46c7a06 commit 80ae5b0

35 files changed

+2030
-1948
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ bin/
66
target/
77

88
# Configuration
9-
uc_pircbotx.json
9+
uc_pircbotx.json
10+
11+
#Netbeans Related
12+
nbactions.xml

codestyle.xml

Lines changed: 291 additions & 0 deletions
Large diffs are not rendered by default.

nb-configuration.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project-shared-configuration>
3+
<!--
4+
This file contains additional configuration written by modules in the NetBeans IDE.
5+
The configuration is intended to be shared among all the users of project and
6+
therefore it is assumed to be part of version control checkout.
7+
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
8+
-->
9+
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
10+
<!--
11+
Properties that influence various parts of the IDE, especially code formatting and the like.
12+
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
13+
That way multiple projects can share the same settings (useful for formatting rules for example).
14+
Any value defined here will override the pom.xml file value but is only applicable to the current project.
15+
-->
16+
<de-markiewb-netbeans-plugins-eclipse-formatter.showNotifications>true</de-markiewb-netbeans-plugins-eclipse-formatter.showNotifications>
17+
<de-markiewb-netbeans-plugins-eclipse-formatter.useProjectSettings>true</de-markiewb-netbeans-plugins-eclipse-formatter.useProjectSettings>
18+
<de-markiewb-netbeans-plugins-eclipse-formatter.eclipseFormatterEnabled>true</de-markiewb-netbeans-plugins-eclipse-formatter.eclipseFormatterEnabled>
19+
<de-markiewb-netbeans-plugins-eclipse-formatter.eclipseFormatterLocation>C:\Users\joseph\Documents\GitHub\uc_pircbotx\codestyle.xml</de-markiewb-netbeans-plugins-eclipse-formatter.eclipseFormatterLocation>
20+
<de-markiewb-netbeans-plugins-eclipse-formatter.enableFormatAsSaveAction>false</de-markiewb-netbeans-plugins-eclipse-formatter.enableFormatAsSaveAction>
21+
</properties>
22+
</project-shared-configuration>

nbactions.xml

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 58 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
/**
1+
/**
22
* Copyright © 2012-2013 Bruce Cowan <bruce@bcowan.me.uk>
33
* Copyright © 2012-2013 Joseph Walton-Rivers <webpigeon@unitycoders.co.uk>
44
*
55
* This file is part of uc_PircBotX.
66
*
7-
* uc_PircBotX is free software: you can redistribute it and/or modify
8-
* it under the terms of the GNU General Public License as published by
9-
* the Free Software Foundation, either version 3 of the License, or
10-
* (at your option) any later version.
7+
* uc_PircBotX is free software: you can redistribute it and/or modify it under
8+
* the terms of the GNU General Public License as published by the Free Software
9+
* Foundation, either version 3 of the License, or (at your option) any later
10+
* version.
1111
*
12-
* uc_PircBotX is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
12+
* uc_PircBotX is distributed in the hope that it will be useful, but WITHOUT
13+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15+
* details.
1616
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with uc_PircBotX. If not, see <http://www.gnu.org/licenses/>.
17+
* You should have received a copy of the GNU General Public License along with
18+
* uc_PircBotX. If not, see <http://www.gnu.org/licenses/>.
1919
*/
2020
package uk.co.unitycoders.pircbotx;
2121

@@ -35,62 +35,59 @@
3535

3636
/**
3737
* The actual bot itself.
38-
*
38+
*
3939
* @author Bruce Cowan
4040
*/
41-
public class Bot
42-
{
43-
public static void main(String[] args) throws Exception
44-
{
45-
// Bot Configuration
46-
Configuration config = ConfigurationManager.loadConfig();
47-
48-
CommandProcessor processor = new CommandProcessor(config.trigger);
41+
public class Bot {
42+
43+
public static void main(String[] args) throws Exception {
44+
// Bot Configuration
45+
Configuration config = ConfigurationManager.loadConfig();
46+
47+
CommandProcessor processor = new CommandProcessor(config.trigger);
48+
49+
ProfileManager profiles = new ProfileManager(DBConnection.getProfileModel());
50+
DateTimeCommand dtCmd = new DateTimeCommand();
4951

50-
ProfileManager profiles = new ProfileManager(DBConnection.getProfileModel());
51-
DateTimeCommand dtCmd = new DateTimeCommand();
52+
// Commands
53+
processor.register("rand", new RandCommand());
54+
processor.register("time", dtCmd);
55+
processor.register("date", dtCmd);
56+
processor.register("datetime", dtCmd);
57+
processor.register("lart", new LartCommand());
58+
processor.register("killertrout", new KillerTroutCommand());
59+
processor.register("joins", new JoinsCommand());
60+
processor.register("calc", new CalcCommand());
61+
processor.register("karma", new KarmaCommand());
62+
processor.register("profile", new ProfileCommand(profiles));
63+
processor.register("help", new HelpCommand(processor));
5264

53-
// Commands
54-
processor.register("rand", new RandCommand());
55-
processor.register("time", dtCmd);
56-
processor.register("date", dtCmd);
57-
processor.register("datetime", dtCmd);
58-
processor.register("lart", new LartCommand());
59-
processor.register("killertrout", new KillerTroutCommand());
60-
processor.register("joins", new JoinsCommand());
61-
processor.register("calc", new CalcCommand());
62-
processor.register("karma", new KarmaCommand());
63-
processor.register("profile", new ProfileCommand(profiles));
64-
processor.register("help", new HelpCommand(processor));
65+
PircBotX bot = new PircBotX();
66+
ListenerManager<? extends PircBotX> manager = bot.getListenerManager();
6567

66-
PircBotX bot = new PircBotX();
67-
ListenerManager<? extends PircBotX> manager = bot.getListenerManager();
68+
// Listeners
69+
manager.addListener(new CommandListener(processor));
70+
manager.addListener(new LinesListener());
71+
manager.addListener(JoinsListener.getInstance());
6872

69-
// Listeners
70-
manager.addListener(new CommandListener(processor));
71-
manager.addListener(new LinesListener());
72-
manager.addListener(JoinsListener.getInstance());
73+
// Snapshot (1.8-SNAPSHOT) only
74+
bot.setAutoReconnect(true);
75+
bot.setAutoReconnectChannels(true);
7376

74-
// Snapshot (1.8-SNAPSHOT) only
75-
bot.setAutoReconnect(true);
76-
bot.setAutoReconnectChannels(true);
77+
try {
78+
bot.setName(config.nick);
79+
if (config.ssl) {
80+
bot.connect(config.host, config.port, SSLSocketFactory.getDefault());
81+
} else {
82+
bot.connect(config.host, config.port);
83+
}
7784

78-
try
79-
{
80-
bot.setName(config.nick);
81-
if (config.ssl) {
82-
bot.connect(config.host, config.port, SSLSocketFactory.getDefault());
83-
} else {
84-
bot.connect(config.host, config.port);
85-
}
86-
87-
for(String channel : config.channels) {
88-
bot.joinChannel(channel);
89-
}
90-
bot.setVerbose(true);
91-
} catch (Exception e)
92-
{
93-
e.printStackTrace();
94-
}
95-
}
85+
for (String channel : config.channels) {
86+
bot.joinChannel(channel);
87+
}
88+
bot.setVerbose(true);
89+
} catch (Exception e) {
90+
e.printStackTrace();
91+
}
92+
}
9693
}

src/main/java/uk/co/unitycoders/pircbotx/Configuration.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
*
44
* This file is part of uc_PircBotX.
55
*
6-
* uc_PircBotX is free software: you can redistribute it and/or modify
7-
* it under the terms of the GNU General Public License as published by
8-
* the Free Software Foundation, either version 3 of the License, or
9-
* (at your option) any later version.
6+
* uc_PircBotX is free software: you can redistribute it and/or modify it under
7+
* the terms of the GNU General Public License as published by the Free Software
8+
* Foundation, either version 3 of the License, or (at your option) any later
9+
* version.
1010
*
11-
* uc_PircBotX is distributed in the hope that it will be useful,
12-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
* GNU General Public License for more details.
11+
* uc_PircBotX is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14+
* details.
1515
*
16-
* You should have received a copy of the GNU General Public License
17-
* along with uc_PircBotX. If not, see <http://www.gnu.org/licenses/>.
16+
* You should have received a copy of the GNU General Public License along with
17+
* uc_PircBotX. If not, see <http://www.gnu.org/licenses/>.
1818
*/
19-
2019
package uk.co.unitycoders.pircbotx;
2120

2221
/**
2322
*
2423
* @author joseph
2524
*/
2625
public class Configuration {
26+
2727
public String nick;
2828
public String host;
2929
public int port;
Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
/**
1+
/**
22
* Copyright © 2013 Joseph Walton-Rivers <webpigeon@unitycoders.co.uk>
33
* Copyright © 2013 Bruce Cowan <bruce@bcowan.me.uk>
44
*
55
* This file is part of uc_PircBotX.
66
*
7-
* uc_PircBotX is free software: you can redistribute it and/or modify
8-
* it under the terms of the GNU General Public License as published by
9-
* the Free Software Foundation, either version 3 of the License, or
10-
* (at your option) any later version.
7+
* uc_PircBotX is free software: you can redistribute it and/or modify it under
8+
* the terms of the GNU General Public License as published by the Free Software
9+
* Foundation, either version 3 of the License, or (at your option) any later
10+
* version.
1111
*
12-
* uc_PircBotX is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
12+
* uc_PircBotX is distributed in the hope that it will be useful, but WITHOUT
13+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15+
* details.
1616
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with uc_PircBotX. If not, see <http://www.gnu.org/licenses/>.
17+
* You should have received a copy of the GNU General Public License along with
18+
* uc_PircBotX. If not, see <http://www.gnu.org/licenses/>.
1919
*/
2020
package uk.co.unitycoders.pircbotx;
2121

@@ -26,29 +26,28 @@
2626

2727
/**
2828
* Static Utility class to deal with configuration files.
29-
*
29+
*
3030
* This class can be used to read/write configuration files as required by the
3131
* bot.
3232
*/
3333
public class ConfigurationManager {
34-
public static final String CONF_FILE_NAME = "uc_pircbotx.properties";
3534
public static final String JSON_FILE_NAME = "uc_pircbotx.json";
36-
35+
3736
// Default configuration values
3837
public static final String DEFAULT_IRC_HOST = "irc.freenode.net";
3938
public static final String DEFAULT_BOT_NAME = "uc_pircbotx";
4039
public static final String DEFAULT_PORT = "6697";
4140
public static final String DEFAULT_SSL = "true";
4241
public static final String DEFAULT_CHANS = "#unity-coders";
4342
public static final String DEFAULT_TRIGGER = "&";
44-
43+
4544
private static Reader getFileReader(String file) throws IOException {
4645
return new FileReader(file);
4746
}
48-
47+
4948
public static Configuration loadConfig() throws IOException {
5049
Gson gson = new Gson();
51-
return gson.fromJson(getFileReader(JSON_FILE_NAME), Configuration.class);
50+
return gson.fromJson(getFileReader(JSON_FILE_NAME), Configuration.class);
5251
}
53-
52+
5453
}

0 commit comments

Comments
 (0)