NotifMod
一个 Fabric 客户端模组,当特定事件发生时为你提供通知!
通知的形式可以是声音、消息(聊天栏/动作栏/标题)或两者兼有。
该模组高度可配置,目前支持以下事件:
- 装备耐久度低
- 不可破坏装备失效(鞘翅)
- 装备完全修复(经验修补)
- 收到聊天消息
- 在聊天中被提及用户名
- 可以睡觉
- 牵引绳断裂
- 玩家加入服务器
- 玩家离开服务器
- 游戏加载完成
- 世界加载完成(首次连接时)
它还可以启动计时器并在时间结束时提醒你(对诸如繁殖动物等事情很有用)。
依赖项
此模组依赖于:
即使没有 Mod Menu,模组也能正常工作,但你将无法访问游戏内配置界面,因此建议包含它。
通知声音
模组自带一些简单的声音供你使用。不过,你也可以使用游戏中的任何声音,甚至通过一个简单的资源包替换 NotifMod 的声音来添加自定义声音!
通知过滤器
在模组的设置中,你会注意到你可以使用正则表达式(即 RegEx)指定哪些聊天消息会触发通知。
如果你不知道什么是正则表达式,它基本上是一系列描述要查找(匹配)模式的字符。
它们非常强大,可以描述大量内容,而且由于这个模组旨在高度可配置,它们非常适合这项任务。
如果你想真正学习它们并做更复杂的事情,你可以很容易地在网上找到很多信息或测试它们(为了有个概念,看看这个并查看 RegExr)!
我将介绍一些在此模组中非常常见的正则表达式用法,以让你了解如何做一些简单的事情。
为许多不同变体的你的名字获取提及通知
如果人们有时用我的用户名称呼我,但有时叫我 "awex"、"alex" 或 "baka",我可以使用这个正则表达式:.*(\p|awex|alex|baka).*
在实际解释正则表达式之前,此模组会将所有 \p 的出现替换为你的用户名。
我们可以在括号内添加任意多个名称/单词,用 | 分隔。
这里有一个小潜在问题:如果有人说 "alexa",我仍然会收到通知。
为了使其仅在它是完整单词且没有任何额外字母时才视为提及,我们可以使用这个:(.*\W)?(\p|awex|alex|baka)(\W.*)?
这种更改告诉系统,如果周围有任何其他字符,紧邻它的字符必须是非字母或数字的任何内容。
模组还可以在提及时给你的名字上色。你需要再次使用正则表达式模式,但它很可能与上面的过滤器非常相似。
如果你想为不同变体的你的名字着色,你基本上可以省略 .* 部分,例如:\p|awex|alex|baka
获取私聊通知
这可能会稍微困难一些,因为私聊功能使用服务器插件,其工作方式将根据服务器使用的插件而有所不同。
插件可能使用的是“系统”频道而不是“聊天”,所以你必须确保也过滤正确的频道。
其余部分取决于传入的私聊消息的样子。你需要相应地编写正则表达式。
例如,如果传入消息的格式是这样的:[Joe -> You] Hello!
你可以使用类似这样的内容:.*[.+ -> You] .*
你也可以将它与其他东西一起使用。例如,如果这是用于“系统”频道,但你也想从服务器控制台收到的消息获取通知(它们以 [Server] 开头并使用“系统”频道),你可以像上面处理名称那样组合它们:([Server] .*)|(.*[.+ -> You] .*)
更新:自 1.19 版本起,来自服务器控制台的聊天消息不再使用“系统”频道,现在它们在“聊天”频道上。
更新 2:自 1.19.1 版本起,来自服务器控制台的聊天消息再次使用“系统”频道,并且不包含 “[server]” 部分。
问题
请在 GitHub 报告任何问题,谢谢!
NotifMod
A client-side Fabric mod that gives you notifications when certain things happen!
The notifications can be in the form of a sound, a message (chat/actionbar/title) or both.
The mod is highly configurable and currently supports the following events:
- Equipment durability low
- Unbreakable equipment stopped working (elytra)
- Equipment fully repaired (mending)
- Chat message
- Chat username mention
- Able to sleep
- Your lead broke
- Player joined server
- Player left server
- Game's done loading
- World's done loading (when initially connecting)
It can also start a timer and remind you when the time's up (useful for things like breeding animals).
Dependencies
This mod depends on:
The mod will function without Mod Menu, but you won't be able to access the
in-game configuration screen, so it's recommended to include it.
Notification sounds
The mod comes with a few simple sounds you can use if you want. However, you can use any sound
in the game, or even add your own, by replacing NotifMod's sounds using a simple resource pack!
Notification filters
In the mod's settings, you'll notice that you can specify what chat messages give you notifications, using regular expressions (aka RegEx).
If you don't know what a regular expression is, it's basically a series of characters that describe a pattern to look for (match).
They're really powerful and can describe a ton of things and since this mod is meant to be highly configurable, they're perfect for the job.
If you really want to learn them and do something more complicated, you can find a lot of info or test them online, pretty easily (to get an idea, watch this and check out RegExr)!
I'll go over some very common uses of regex in this mod, to give you an idea of how to do simple things.
Getting mention notifications for many different variations of your name
If people sometimes refer to me by my username, but sometimes call me "awex", "alex", or "baka", I can use this regex: .*(\p|awex|alex|baka).*
This mod will replace any occurrences of \p with your username, before actually interpreting the regex.
We can add as many names/words as we want, inside the parentheses, separated by |.
There's a small potential issue with this: if someone says "alexa", I'll still get a notification.
To make it only consider it a mention if it's a full word, without any extra letters, we can use this: (.*\W)?(\p|awex|alex|baka)(\W.*)?
This change tells it that if there's any other characters around it, the ones immediately next to it have to be anything but letters or numbers.
The mod can also color your name, when mentioned. You'll have to use a regex pattern again, but you most likely want it to be pretty similar to the filter one, from above.
If you wanted to color different variations of your name, you could basically just omit the .* parts, e.g.: \p|awex|alex|baka
Getting notifications for private messages
This can be a bit more difficult, since private messages work using a server plugin and how it works will be different according to the plugin being used by the server etc.
The plugin might be using the "system" channel instead of "chat", so you'll have to make sure you're filtering the right channel too.
The rest comes down to what incoming private messages look like. You'll have to write the regex accordingly.
As an example, if the format of incoming messages is this: [Joe -> You] Hello!
You can use something like this: .*[.+ -> You] .*
You can also use it together with other things. For example, if this is for the "system" channel, but you also want to get notifications for messages coming from the server console (they'd start with [Server] and use the "system" channel too), you can combine it the same way we did with names above: ([Server] .*)|(.*[.+ -> You] .*)
Update: as of 1.19, chat messages coming from the server console do not use the "system" channel anymore, they're now on the "chat" channel.
Update 2: as of 1.19.1, chat messages coming from the server console use the "system" channel again and don't include the "[server]" part.
Issues
Please report any issues on GitHub, thanks!
下载 NotifMod
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 NotifMod
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 NotifMod
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 NotifMod
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 NotifMod
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 NotifMod
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 NotifMod
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 NotifMod
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 NotifMod
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 NotifMod
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
已更新至 26.1!
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
可定制的鞘翅模组,支持装饰纹饰、旗帜图案等更多功能!
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
AE2:一款流行的自动化与存储模组
评论 0
登录后参与评分
还没有评论,来抢沙发吧