mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2025-02-15 19:11:43 +01:00
Herochat null pointer check (invalid channel)
This commit is contained in:
parent
155b1467cc
commit
fddf4f8377
8
pom.xml
8
pom.xml
@ -96,16 +96,16 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>spigot-19</artifactId>
|
||||
<version>1.9</version>
|
||||
<artifactId>spigot-184</artifactId>
|
||||
<version>1.8.4</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>spigot-184</artifactId>
|
||||
<version>1.8.4</version>
|
||||
<artifactId>spigot-19</artifactId>
|
||||
<version>1.9</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
@ -2763,6 +2763,9 @@ public final class PurpleBot {
|
||||
String rawHCMessage = filterMessage(
|
||||
plugin.tokenizer.ircChatToHeroChatTokenizer(this, user, channel, tmpl, message, Herochat.getChannelManager(), hChannel), channelName);
|
||||
if (!rawHCMessage.isEmpty()) {
|
||||
if (Herochat.getChannelManager().getChannel(hChannel) == null) {
|
||||
plugin.logError("Herochat channel is invalid: " + hChannel);
|
||||
} else {
|
||||
Herochat.getChannelManager().getChannel(hChannel).sendRawMessage(rawHCMessage);
|
||||
messageSent = true;
|
||||
if (logIrcToHeroChat.containsKey(channelName)) {
|
||||
@ -2772,6 +2775,7 @@ public final class PurpleBot {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Send messages to VentureChat if enabled
|
||||
|
@ -206,17 +206,26 @@ public class ChatTokenizer {
|
||||
*/
|
||||
public String ircChatToHeroChatTokenizer(PurpleBot ircBot, User user, org.pircbotx.Channel channel, String template, String message, ChannelManager channelManager, String hChannel) {
|
||||
String ircNick = user.getNick();
|
||||
String heroNick = "";
|
||||
String heroColor = "";
|
||||
String tmpl;
|
||||
if (channelManager.getChannel(hChannel) == null) {
|
||||
plugin.logError("Herochat channel is invalid: " + hChannel);
|
||||
} else {
|
||||
heroNick = channelManager.getChannel(hChannel).getNick();
|
||||
heroColor = channelManager.getChannel(hChannel).getColor().toString();
|
||||
}
|
||||
Player player = this.getPlayer(ircNick);
|
||||
if (player != null) {
|
||||
tmpl = playerTokenizer(player, template);
|
||||
} else {
|
||||
tmpl = playerTokenizer(ircNick, template);
|
||||
}
|
||||
plugin.logDebug(message);
|
||||
return plugin.colorConverter.ircColorsToGame(ircUserTokenizer(tmpl, user, ircBot)
|
||||
.replace("%HEROCHANNEL%", hChannel)
|
||||
.replace("%HERONICK%", channelManager.getChannel(hChannel).getNick())
|
||||
.replace("%HEROCOLOR%", channelManager.getChannel(hChannel).getColor().toString())
|
||||
.replace("%HERONICK%", heroNick)
|
||||
.replace("%HEROCOLOR%", heroColor)
|
||||
.replace("%NICKPREFIX%", ircBot.getNickPrefix(user, channel))
|
||||
.replace("%CHANNELPREFIX%", ircBot.getChannelPrefix(channel))
|
||||
.replace("%MESSAGE%", message)
|
||||
|
Loading…
Reference in New Issue
Block a user