Skip to content
This repository has been archived by the owner on Jul 27, 2019. It is now read-only.

Commit

Permalink
Don't send messages when not connected.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnaude committed Mar 22, 2014
1 parent 84cdc06 commit 7206046
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/com/cnaude/purpleirc/PurpleBot.java
Expand Up @@ -365,20 +365,29 @@ public void asyncCTCPMessage(final String target, final String message) {
}

public void blockingIRCMessage(final String target, final String message) {
if (!this.isConnected()) {
return;
}
plugin.logDebug("[blockingIRCMessage] About to send IRC message to " + target);
bot.sendIRC().message(target, plugin.colorConverter
.gameColorsToIrc(message));
plugin.logDebug("[blockingIRCMessage] Message sent to " + target);
}

public void blockingCTCPMessage(final String target, final String message) {
if (!this.isConnected()) {
return;
}
plugin.logDebug("[blockingCTCPMessage] About to send IRC message to " + target);
bot.sendIRC().ctcpResponse(target, plugin.colorConverter
.gameColorsToIrc(message));
plugin.logDebug("[blockingCTCPMessage] Message sent to " + target);
}

public void asyncCTCPCommand(final String target, final String command) {
if (!this.isConnected()) {
return;
}
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
Expand Down Expand Up @@ -419,6 +428,9 @@ public void saveConfig() {
* @param newNick
*/
public void asyncChangeNick(final CommandSender sender, final String newNick) {
if (!this.isConnected()) {
return;
}
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
Expand All @@ -432,6 +444,9 @@ public void run() {
}

public void asyncJoinChannel(final String channelName, final String password) {
if (!this.isConnected()) {
return;
}
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
Expand All @@ -441,6 +456,9 @@ public void run() {
}

public void asyncNotice(final String target, final String message) {
if (!this.isConnected()) {
return;
}
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
Expand All @@ -459,6 +477,9 @@ public void run() {
}

public void asyncIdentify(final String password) {
if (!this.isConnected()) {
return;
}
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
Expand Down

0 comments on commit 7206046

Please sign in to comment.