mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2024-11-29 05:26:19 +01:00
Add %CHANNELPREFIX%
This commit is contained in:
parent
b30654daed
commit
3dd9f42279
@ -137,6 +137,7 @@ public final class PurpleBot {
|
||||
public CaseInsensitiveMap<Boolean> invalidCommandCTCP;
|
||||
public CaseInsensitiveMap<Boolean> logIrcToHeroChat;
|
||||
public CaseInsensitiveMap<Boolean> enableMessageFiltering;
|
||||
public CaseInsensitiveMap<String> channelPrefix;
|
||||
private final CaseInsensitiveMap<Boolean> shortify;
|
||||
public CaseInsensitiveMap<String> heroChannel;
|
||||
public CaseInsensitiveMap<String> townyChannel;
|
||||
@ -216,6 +217,7 @@ public final class PurpleBot {
|
||||
this.joinMsg = new CaseInsensitiveMap<>();
|
||||
this.msgOnJoin = new CaseInsensitiveMap<>();
|
||||
this.enableMessageFiltering = new CaseInsensitiveMap<>();
|
||||
this.channelPrefix = new CaseInsensitiveMap<>();
|
||||
this.plugin = plugin;
|
||||
this.file = file;
|
||||
this.reconnectCount = 0;
|
||||
@ -821,6 +823,9 @@ public final class PurpleBot {
|
||||
enableMessageFiltering.put(channelName, config.getBoolean("channels." + enChannelName + ".enable-filtering", false));
|
||||
plugin.logDebug(" EnableMessageFiltering => " + enableMessageFiltering.get(channelName));
|
||||
|
||||
channelPrefix.put(channelName, config.getString("channels." + enChannelName + ".prefix", ""));
|
||||
plugin.logDebug(" ChannelPrefix => " + channelPrefix.get(channelName));
|
||||
|
||||
// build channel op list
|
||||
Collection<String> cOps = new ArrayList<>();
|
||||
for (String channelOper : config.getStringList("channels." + enChannelName + ".ops")) {
|
||||
@ -2121,6 +2126,13 @@ public final class PurpleBot {
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getChannelPrefix(Channel channel) {
|
||||
if (channelPrefix.containsKey(channel.getName())) {
|
||||
return channelPrefix.get(channel.getName());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sender
|
||||
|
@ -55,9 +55,12 @@ public class ChatTokenizer {
|
||||
* @return
|
||||
*/
|
||||
public String chatIRCTokenizer(PurpleBot ircBot, User user, org.pircbotx.Channel channel, String template) {
|
||||
return plugin.colorConverter.ircColorsToGame(ircUserTokenizer(template, user, ircBot)
|
||||
return plugin.colorConverter.ircColorsToGame(
|
||||
ircUserTokenizer(template, user, ircBot)
|
||||
.replace("%NICKPREFIX%", ircBot.getNickPrefix(user, channel))
|
||||
.replace("%CHANNEL%", channel.getName()));
|
||||
.replace("%CHANNELPREFIX%", ircBot.getChannelPrefix(channel))
|
||||
.replace("%CHANNEL%", channel.getName())
|
||||
);
|
||||
}
|
||||
|
||||
public String ircUserTokenizer(String template, User user, PurpleBot ircBot) {
|
||||
@ -139,6 +142,7 @@ public class ChatTokenizer {
|
||||
.replace("%HERONICK%", channelManager.getChannel(hChannel).getNick())
|
||||
.replace("%HEROCOLOR%", channelManager.getChannel(hChannel).getColor().toString())
|
||||
.replace("%NICKPREFIX%", ircBot.getNickPrefix(user, channel))
|
||||
.replace("%CHANNELPREFIX%", ircBot.getChannelPrefix(channel))
|
||||
.replace("%CHANNEL%", channel.getName()));
|
||||
}
|
||||
|
||||
@ -164,6 +168,7 @@ public class ChatTokenizer {
|
||||
}
|
||||
return plugin.colorConverter.ircColorsToGame(ircUserTokenizer(tmpl, user, ircBot)
|
||||
.replace("%NICKPREFIX%", ircBot.getNickPrefix(user, channel))
|
||||
.replace("%CHANNELPREFIX%", ircBot.getChannelPrefix(channel))
|
||||
.replace("%MESSAGE%", message)
|
||||
.replace("%CHANNEL%", channel.getName()));
|
||||
}
|
||||
@ -194,6 +199,7 @@ public class ChatTokenizer {
|
||||
.replace("%HERONICK%", channelManager.getChannel(hChannel).getNick())
|
||||
.replace("%HEROCOLOR%", channelManager.getChannel(hChannel).getColor().toString())
|
||||
.replace("%NICKPREFIX%", ircBot.getNickPrefix(user, channel))
|
||||
.replace("%CHANNELPREFIX%", ircBot.getChannelPrefix(channel))
|
||||
.replace("%MESSAGE%", message)
|
||||
.replace("%CHANNEL%", channel.getName()));
|
||||
}
|
||||
@ -221,6 +227,7 @@ public class ChatTokenizer {
|
||||
return plugin.colorConverter.ircColorsToGame(ircUserTokenizer(tmpl, user, ircBot)
|
||||
.replace("%TOWNYCHANNEL%", tChannel)
|
||||
.replace("%NICKPREFIX%", ircBot.getNickPrefix(user, channel))
|
||||
.replace("%CHANNELPREFIX%", ircBot.getChannelPrefix(channel))
|
||||
.replace("%MESSAGE%", message)
|
||||
.replace("%CHANNEL%", channel.getName()));
|
||||
}
|
||||
@ -239,6 +246,7 @@ public class ChatTokenizer {
|
||||
public String ircKickTokenizer(PurpleBot ircBot, User recipient, User kicker, String reason, org.pircbotx.Channel channel, String template) {
|
||||
return plugin.colorConverter.ircColorsToGame(ircUserTokenizer(template, recipient, kicker, ircBot)
|
||||
.replace("%NICKPREFIX%", ircBot.getNickPrefix(kicker, channel))
|
||||
.replace("%CHANNELPREFIX%", ircBot.getChannelPrefix(channel))
|
||||
.replace("%REASON%", reason)
|
||||
.replace("%CHANNEL%", channel.getName()));
|
||||
}
|
||||
@ -262,6 +270,7 @@ public class ChatTokenizer {
|
||||
.replace("%HERONICK%", channelManager.getChannel(hChannel).getNick())
|
||||
.replace("%HEROCOLOR%", channelManager.getChannel(hChannel).getColor().toString())
|
||||
.replace("%NICKPREFIX%", ircBot.getNickPrefix(kicker, channel))
|
||||
.replace("%CHANNELPREFIX%", ircBot.getChannelPrefix(channel))
|
||||
.replace("%REASON%", reason)
|
||||
.replace("%CHANNEL%", channel.getName()));
|
||||
}
|
||||
@ -280,6 +289,7 @@ public class ChatTokenizer {
|
||||
return plugin.colorConverter.ircColorsToGame(ircUserTokenizer(template, user, ircBot)
|
||||
.replace("%MODE%", mode)
|
||||
.replace("%NICKPREFIX%", ircBot.getNickPrefix(user, channel))
|
||||
.replace("%CHANNELPREFIX%", ircBot.getChannelPrefix(channel))
|
||||
.replace("%CHANNEL%", channel.getName()));
|
||||
}
|
||||
|
||||
@ -297,6 +307,7 @@ public class ChatTokenizer {
|
||||
public String ircNoticeTokenizer(PurpleBot ircBot, User user, String message, String notice, org.pircbotx.Channel channel, String template) {
|
||||
return plugin.colorConverter.ircColorsToGame(ircUserTokenizer(template, user, ircBot)
|
||||
.replace("%NICKPREFIX%", ircBot.getNickPrefix(user, channel))
|
||||
.replace("%CHANNELPREFIX%", ircBot.getChannelPrefix(channel))
|
||||
.replace("%MESSAGE%", message)
|
||||
.replace("%NOTICE%", notice)
|
||||
.replace("%CHANNEL%", channel.getName()));
|
||||
|
@ -85,6 +85,8 @@ channels:
|
||||
# Use %2E instead of dots in the channel names.
|
||||
# Example: minecraft%2Etest == minecraft.test
|
||||
'#minecraft-test':
|
||||
# message prefix (replaces %CHANNELPREFIX%
|
||||
prefix: ''
|
||||
# worlds we listen to for this channel
|
||||
worlds:
|
||||
- '*'
|
||||
|
@ -23,6 +23,7 @@ channel-check-interval: 100
|
||||
# %KICKERSERVER% - Server of IRC kicker
|
||||
# %KICKERAWAY% - IRC kicker away message
|
||||
# %NICKPREFIX% - IRC user's status (see nick-prefixes below)
|
||||
# %CHANNELPREFIX% - Custom prefix per channel (see prefix option in SampleBot.yml)
|
||||
# %DISPLAYNAME% - Player's custom name
|
||||
# %PLAYERIP% - IP address of a player
|
||||
# %CHANNEL%
|
||||
|
Loading…
Reference in New Issue
Block a user