ModernChatInjector
一个即插即用式的 ChatInjector 替代品,现已内置支持 EssentialsX Chat 2.21.1+,同时也对旧版本提供有限支持。
使用方法
将 ModernChatInjector 与 PlaceholderAPI、你所需的任何扩展以及你选择的聊天格式化插件一起安装。
然后,在你的聊天格式化插件中使用以下语法添加 PlaceholderAPI 占位符:
{placeholder_name}。
请注意,你需要使用 { 和 } 包裹占位符,而不是你可能预期的 % 符号!
工作原理
在 EssentialsX 2.20.0 及以上版本中,ModernChatInjector 会挂钩 EssentialsX Chat 自身的聊天事件,以确保在启用本地/全局聊天时将 PlaceholderAPI 占位符注入消息格式。
这是必要的,因为之前版本的 ChatInjector 依赖于 Bukkit 事件和协议黑客手段,这些方法与当前版本的 EssentialsX Chat 或 Paper 聊天事件不完全兼容。
如果未安装 EssentialsX Chat,或者你正在运行旧版本的 Spigot 或 Paper,该插件将回退到挂钩 Bukkit 的 AsyncPlayerChatEvent(正如 ChatInjector 所做的那样),以确保与其他遗留聊天格式化程序的兼容性。
为什么这个功能没有内置于 EssentialsX Chat?
这为像 EssentialsX Chat 和 VaultChatFormatter 这样的“传统”风格聊天格式化插件提供了 PlaceholderAPI 支持,方式与以前 ChatInjector 的工作方式相同。
我们计划在未来的版本中对 EssentialsX Chat 进行更大规模的 overhaul(重构),其中将包括对外部占位符的支持。在那之前,我们不想保证支持一种特定格式的 PAPI,因为这种格式未来可能会发生变化,否则所有服务器所有者都需要重新配置他们的聊天格式第二次。
ModernChatInjector
A drop-in replacement for ChatInjector, now with built-in support for EssentialsX Chat 2.21.1+, as well as limited support for older
versions.
Usage
Install ModernChatInjector alongside PlaceholderAPI, any expansions you need, and your chat formatter of choice.
Then, add PlaceholderAPI placeholders within your chat formatting plugin using the following syntax:
{placeholder_name}.
Note that you need to use { and } around the placeholders, not % symbols like you might expect!
How does it work?
On EssentialsX 2.20.0 and above, ModernChatInjector hooks EssentialsX Chat's own chat events to ensure PlaceholderAPI
placeholders are injected into the message format when local/global chat is enabled.
This is necessary as the previous versions of ChatInjector relied on Bukkit events and protocol hacks, which aren't
fully compatible with current versions of EssentialsX Chat or Paper chat events.
If EssentialsX Chat isn't installed or if you're running older versions of Spigot or Paper, this plugin will fall back
to hooking Bukkit's AsyncPlayerChatEvent (as ChatInjector does), ensuring compatibility with other legacy chat
formatters.
Why isn't this built into EssentialsX Chat?
This provides support for PlaceholderAPI in "legacy" style chat formatting plugins, like EssentialsX Chat and
VaultChatFormatter, in the same way ChatInjector used to work.
We're planning a larger overhaul of EssentialsX Chat in a future version, which will include support for external
placeholders. Until that's ready, we don't want to guarantee support for a specific PAPI format that could change in the
future, as all server owners would then need to reconfigure their chat formats a second time.
评论 0
登录后参与评分
还没有评论,来抢沙发吧