mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2024-11-29 13:36:04 +01:00
Add %CUSTOMPREFIX% to irc-nickchange template tokenizer.
This commit is contained in:
parent
debdcbffb8
commit
0cc1d3b044
@ -20,6 +20,7 @@ import com.cnaude.purpleirc.TemplateName;
|
||||
import com.cnaude.purpleirc.PurpleBot;
|
||||
import com.cnaude.purpleirc.PurpleIRC;
|
||||
import org.pircbotx.Channel;
|
||||
import org.pircbotx.User;
|
||||
import org.pircbotx.hooks.ListenerAdapter;
|
||||
import org.pircbotx.hooks.events.NickChangeEvent;
|
||||
|
||||
@ -50,6 +51,7 @@ public class NickChangeListener extends ListenerAdapter {
|
||||
public void onNickChange(NickChangeEvent event) {
|
||||
String newNick = event.getNewNick();
|
||||
String oldNick = event.getOldNick();
|
||||
User user = event.getUser();
|
||||
plugin.logDebug("OLD: " + oldNick);
|
||||
plugin.logDebug("NEW: " + newNick);
|
||||
|
||||
@ -57,11 +59,8 @@ public class NickChangeListener extends ListenerAdapter {
|
||||
Channel channel = ircBot.getChannel(channelName);
|
||||
if (channel != null) {
|
||||
if (ircBot.enabledMessages.get(channelName).contains(TemplateName.IRC_NICK_CHANGE)) {
|
||||
plugin.broadcastToGame(plugin.colorConverter.ircColorsToGame(
|
||||
plugin.getMessageTemplate(ircBot.botNick, channelName, TemplateName.IRC_NICK_CHANGE)
|
||||
.replace("%NEWNICK%", newNick)
|
||||
.replace("%OLDNICK%", oldNick)
|
||||
.replace("%CHANNEL%", channelName)), "irc.message.nickchange");
|
||||
String message = plugin.tokenizer.ircNickChangeTokenizer(user, oldNick, newNick, channelName, ircBot);
|
||||
plugin.broadcastToGame(message, "irc.message.nickchange");
|
||||
}
|
||||
if (plugin.netPackets != null) {
|
||||
plugin.netPackets.remFromTabList(oldNick);
|
||||
|
@ -109,6 +109,25 @@ public class ChatTokenizer {
|
||||
.replace("%AWAY%", away);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* @param oldNick
|
||||
* @param newNick
|
||||
* @param channelName
|
||||
* @param ircBot
|
||||
* @return
|
||||
*/
|
||||
public String ircNickChangeTokenizer(User user, String oldNick, String newNick, String channelName, PurpleBot ircBot) {
|
||||
String template = plugin.getMessageTemplate(ircBot.botNick, channelName, TemplateName.IRC_NICK_CHANGE);
|
||||
String message = template.replace("%NEWNICK%", newNick)
|
||||
.replace("%OLDNICK%", oldNick)
|
||||
.replace("%CHANNEL%", channelName);
|
||||
message = plugin.colorConverter.ircColorsToGame(ircUserTokenizer(message, user, ircBot));
|
||||
|
||||
return plugin.colorConverter.ircColorsToGame(message);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param template
|
||||
|
Loading…
Reference in New Issue
Block a user