forked from Minecraft/Hush
Merge pull request 'Highlight matched phrase.' (#1) from ZeroHD/Hush:master into master
Reviewed-on: https://git.etztech.xyz/Minecraft/Hush/pulls/1master
commit
7746f6905e
|
@ -20,7 +20,7 @@ public class WatchList {
|
||||||
private static List<Pattern> buildPattern(List<String> patternList) {
|
private static List<Pattern> buildPattern(List<String> patternList) {
|
||||||
return patternList
|
return patternList
|
||||||
.stream()
|
.stream()
|
||||||
.map(Pattern::compile)
|
.map(p -> Pattern.compile(String.format("(%s)", p)))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,9 +73,11 @@ public class HushAsyncChatListener implements Listener {
|
||||||
|
|
||||||
String playerName = player.getName();
|
String playerName = player.getName();
|
||||||
String webhook = plugin.getConfig().getString("webhook");
|
String webhook = plugin.getConfig().getString("webhook");
|
||||||
|
chatMessage = Javacord.escapeFormat(chatMessage);
|
||||||
|
chatMessage = pattern.matcher(chatMessage).replaceAll("**$0**");
|
||||||
|
|
||||||
if (webhook != null) {
|
if (webhook != null) {
|
||||||
String message = playerName + " said: " + "`" + Javacord.escapeFormat(chatMessage) + "`";
|
String message = playerName + " said: " + chatMessage;
|
||||||
Embed embed = new Embed()
|
Embed embed = new Embed()
|
||||||
.color(0xC70039)
|
.color(0xC70039)
|
||||||
.description(message)
|
.description(message)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: Hush
|
name: Hush
|
||||||
version: v0.1.0
|
version: 0.1.0
|
||||||
main: com.zerohighdef.hush.Hush
|
main: com.zerohighdef.hush.Hush
|
||||||
api-version: "1.16"
|
api-version: "1.16"
|
||||||
authors: [ZeroHighDef]
|
authors: [ZeroHighDef]
|
||||||
|
|
Loading…
Reference in New Issue