mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2025-02-18 04:21:23 +01:00
Try and catch possible socket exceptions.
This commit is contained in:
parent
1904ac2523
commit
1ebc474bcf
17
pom.xml
17
pom.xml
@ -57,14 +57,14 @@
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
|
||||
|
||||
<!-- Vault -->
|
||||
<!--
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
-->
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
-->
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@ -240,8 +240,7 @@
|
||||
<groupId>org.pircbotx</groupId>
|
||||
<artifactId>pircbotx</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependency>
|
||||
|
||||
<!-- CleverNotch -->
|
||||
<dependency>
|
||||
@ -298,7 +297,7 @@
|
||||
<artifactId>SuperVanish</artifactId>
|
||||
<version>5.0.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Testing only -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
@ -58,6 +58,7 @@ public class CommandQueueWatcher {
|
||||
&& plugin.getServer().getPluginCommand(ircCommand.getGameCommand()) == null) {
|
||||
plugin.logDebug("Dispatching command as ConsoleSender: " + ircCommand.getGameCommand());
|
||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), ircCommand.getGameCommand());
|
||||
ircCommand.getIRCCommandSender().sendMessage("Command sent: " + ircCommand.getGameCommand());
|
||||
} else {
|
||||
plugin.logDebug("Dispatching command as IRCCommandSender: " + ircCommand.getGameCommand());
|
||||
plugin.getServer().dispatchCommand(ircCommand.getIRCCommandSender(), ircCommand.getGameCommand());
|
||||
|
@ -206,11 +206,11 @@ public final class PurpleBot {
|
||||
loadConfig();
|
||||
addListeners();
|
||||
version = plugin.getDescription().getFullName() + ", "
|
||||
+ plugin.getDescription().getDescription() + " - "
|
||||
+ plugin.getDescription().getWebsite();
|
||||
+ plugin.getDescription().getDescription() + " - "
|
||||
+ plugin.getDescription().getWebsite();
|
||||
buildBot();
|
||||
messageQueue = new IRCMessageQueueWatcher(this, plugin);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void buildBot() {
|
||||
@ -436,8 +436,7 @@ public final class PurpleBot {
|
||||
|
||||
public void asyncCTCPMessage(final String target, final String message) {
|
||||
plugin.logDebug("Entering asyncCTCPMessage");
|
||||
messageQueue.add(new IRCMessage(target, plugin.colorConverter
|
||||
.gameColorsToIrc(message), true));
|
||||
messageQueue.add(new IRCMessage(target, plugin.colorConverter.gameColorsToIrc(message), true));
|
||||
}
|
||||
|
||||
public void blockingIRCMessage(final String target, final String message) {
|
||||
@ -445,8 +444,11 @@ public final class PurpleBot {
|
||||
return;
|
||||
}
|
||||
plugin.logDebug("[blockingIRCMessage] About to send IRC message to " + target);
|
||||
bot.sendIRC().message(target, plugin.colorConverter
|
||||
.gameColorsToIrc(message));
|
||||
try {
|
||||
bot.sendIRC().message(target, plugin.colorConverter.gameColorsToIrc(message));
|
||||
} catch (Exception ex) {
|
||||
plugin.logError("Problem sending IRC message: " + ex.getMessage());
|
||||
}
|
||||
plugin.logDebug("[blockingIRCMessage] Message sent to " + target);
|
||||
}
|
||||
|
||||
@ -455,8 +457,11 @@ public final class PurpleBot {
|
||||
return;
|
||||
}
|
||||
plugin.logDebug("[blockingCTCPMessage] About to send IRC message to " + target);
|
||||
bot.sendIRC().ctcpResponse(target, plugin.colorConverter
|
||||
.gameColorsToIrc(message));
|
||||
try {
|
||||
bot.sendIRC().ctcpResponse(target, plugin.colorConverter.gameColorsToIrc(message));
|
||||
} catch (Exception ex) {
|
||||
plugin.logError("Problem sending IRC CTCP message: " + ex.getMessage());
|
||||
}
|
||||
plugin.logDebug("[blockingCTCPMessage] Message sent to " + target);
|
||||
}
|
||||
|
||||
@ -1957,15 +1962,15 @@ public final class PurpleBot {
|
||||
}
|
||||
List<String> channelUsers = new ArrayList<>();
|
||||
for (User user : channel.getUsers()) {
|
||||
String nick = user.getNick();
|
||||
nick = getNickPrefix(user, channel) + nick;
|
||||
String n = user.getNick();
|
||||
n = getNickPrefix(user, channel) + n;
|
||||
if (user.isAway()) {
|
||||
nick = nick + ChatColor.GRAY + " | Away";
|
||||
n = n + ChatColor.GRAY + " | Away";
|
||||
}
|
||||
if (nick.equals(bot.getNick())) {
|
||||
nick = ChatColor.DARK_PURPLE + nick;
|
||||
if (n.equals(bot.getNick())) {
|
||||
n = ChatColor.DARK_PURPLE + n;
|
||||
}
|
||||
channelUsers.add(nick);
|
||||
channelUsers.add(n);
|
||||
}
|
||||
Collections.sort(channelUsers, Collator.getInstance());
|
||||
for (String userName : channelUsers) {
|
||||
|
@ -7,8 +7,8 @@
|
||||
nick: AwesomeBot
|
||||
# If your bot's nick is in use try these alternates. Leave blank for none.
|
||||
alt-nicks:
|
||||
- %NICK%_
|
||||
- %NICK%__
|
||||
- '%NICK%_'
|
||||
- '%NICK%__'
|
||||
# login - Your bot's login name
|
||||
login: AwesomeName
|
||||
# realname
|
||||
|
Loading…
Reference in New Issue
Block a user