chat notifications: load highlights on start
This commit is contained in:
@@ -74,6 +74,12 @@ public class ChatNotificationsPlugin extends Plugin
|
|||||||
return configManager.getConfig(ChatNotificationsConfig.class);
|
return configManager.getConfig(ChatNotificationsConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startUp()
|
||||||
|
{
|
||||||
|
updateHighlights();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameStateChanged(GameStateChanged event)
|
public void onGameStateChanged(GameStateChanged event)
|
||||||
{
|
{
|
||||||
@@ -91,16 +97,21 @@ public class ChatNotificationsPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
if (event.getGroup().equals("chatnotification"))
|
if (event.getGroup().equals("chatnotification"))
|
||||||
{
|
{
|
||||||
highlightMatcher = null;
|
updateHighlights();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!config.highlightWordsString().trim().equals(""))
|
private void updateHighlights()
|
||||||
{
|
{
|
||||||
String[] items = config.highlightWordsString().trim().split(", ");
|
highlightMatcher = null;
|
||||||
String joined = Arrays.stream(items)
|
|
||||||
.map(Pattern::quote)
|
if (!config.highlightWordsString().trim().equals(""))
|
||||||
.collect(Collectors.joining("|"));
|
{
|
||||||
highlightMatcher = Pattern.compile("\\b(" + joined + ")\\b", Pattern.CASE_INSENSITIVE);
|
String[] items = config.highlightWordsString().trim().split(", ");
|
||||||
}
|
String joined = Arrays.stream(items)
|
||||||
|
.map(Pattern::quote)
|
||||||
|
.collect(Collectors.joining("|"));
|
||||||
|
highlightMatcher = Pattern.compile("\\b(" + joined + ")\\b", Pattern.CASE_INSENSITIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user