SimpleChat(分支版本)
此分支版本是因为主项目 已不再维护。
一款适用于你服务器的简易聊天模组。
即使在单人游戏中也能正常工作。
只需使用 !<message> 进行全局聊天,或使用 #<message> 进行世界聊天!
功能
-
FTB Teams 集成 (已测试 2001.1.4)
-
LuckPerms 集成 (已测试 5.4.25)
-
全局、世界和本地聊天(可关闭)
-
彩色聊天(可关闭)
-
通过命令重载配置文件
-
支持 PlacehoderAPI(从 1.19.4 开始)
-
添加了颜色标签支持 (<bold><red>Example</bold>) (从 1.19.4 开始)
-
对于开发者:玩家聊天事件
配置
配置文件位于 <游戏或服务器目录>/config/simplechat.json。
| 名称 |
描述 |
类型 |
| enable_chat_mod |
启用(true)或禁用(false)模组对聊天的处理。 |
boolean |
| enable_global_chat |
启用(true)或禁用(false)全局聊天功能。 |
boolean |
| enable_world_chat | 启用(true)或禁用(false)世界聊天。 | boolean |
| enable_chat_colors | 启用(true)或禁用(false)聊天中使用颜色代码。 | boolean |
| local_chat_format | 定义本地聊天的外观样式。 | String |
| global_chat_format | 定义全局聊天的外观样式。 | String |
| no_players_nearby_text | 定义在附近没有玩家时,本地聊天显示的消息内容。 | String |
| no_players_nearby_message | 启用(true)或禁用(false)该消息提示。 | boolean |
| no_players_nearby_action_bar | 启用(true)或禁用(false)操作栏消息。 | boolean |
| chat_range | 指定全局聊天启用时,本地聊天消息不再可见的距离。 | int |
{
"enable_chat_mod": true,
"enable_global_chat": true,
"enable_world_chat": false,
"enable_chat_colors": false,
"local_chat_format": "%player%&7:&r &7%message%",
"global_chat_format": "&8[&2G&8] &r%player%&7:&r &e%message%",
"world_chat_format": "&8[&9W&8] &r%player%&7:&r &e%message%",
"no_players_nearby_text": "&f附近没有玩家。请使用 &e!<message> &f进行全局聊天。",
"no_players_nearby_message": true,
"no_players_nearby_action_bar": true,
"chat_range": 100
}
你可以使用占位符 %player% 指定玩家的昵称,并使用占位符 %message% 指定他们在聊天中的消息。
%ftbteam% FTB Team 集成 - 在聊天中显示你的队伍。
%lp_group% LuckPerms - 显示玩家所属组别。
%lp_prefix% LuckPerms - 显示玩家前缀。
%lp_suffix% LuckPerms - 显示玩家后缀。
你可以使用 /simplechat 命令在无需重启服务器或游戏的情况下重新加载配置(需要 权限等级 1 或更高)。
API
如果你是开发者,可以使用一个在玩家向聊天栏发送消息时触发的事件。
查看 me.vetustus.server.simplechat.api.event.PlayerChatCallback。
要控制行为,请使用 ChatMessage 子类,它可以用于取消发送消息或修改消息内容。
示例:
/**
* 通过取消事件来禁止玩家发送消息。
*/
PlayerChatCallback.EVENT.register((player, message) -> {
PlayerChatCallback.ChatMessage chatMessage = new PlayerChatCallback.ChatMessage(player, message);
chatMessage.setCancelled(true);
return chatMessage;
});
许可证
本项目采用 MIT 许可证。
SimpleChat (fork)
This fork was created because the main project is no longer maintained.
A simple chat mod for your server.
Works even in a single player game.
Just use !<message> for global chat or #<message> for world chat!
Features
-
FTB Teams integration (tested 2001.1.4)
-
LuckPerms integration (tested 5.4.25)
-
Global, world and local chat (you can turn it off)
-
Color chat (you can turn it off)
-
Reloading the configuration with the command
-
Support PlacehoderAPI (From 1.19.4)
-
Added support color tags (<bold><red>Example</bold>) (From 1.19.4)
-
For developers: Player chat event
Configuration
The configuration is located in <game or server directory>/config/simplechat.json.
| Name |
Description |
Type |
| enable_chat_mod |
Enables (true) or disables (false) chat handling by the mod. |
boolean |
| enable_global_chat |
Enables (true) or disables (false) the global chat. |
boolean |
| enable_world_chat |
Enables (true) or disables (false) the world chat. |
boolean |
| enable_chat_colors |
Enables (true) or disables (false) the use of color codes in the chat. |
boolean |
| local_chat_format |
Defines the appearance of the local chat. |
String |
| global_chat_format |
Defines the appearance of the global chat. |
String |
| no_players_nearby_text |
Defines a message for local chat when there are no players nearby. |
String |
| no_players_nearby_message |
Enables (true) or disables (false) message. |
boolean |
| no_players_nearby_action_bar |
Enables (true) or disables (false) action bar message. |
boolean |
| chat_range |
Specifies the distance after which local chat messages will not be visible (if global chat is enabled). |
int |
{
"enable_chat_mod": true,
"enable_global_chat": true,
"enable_world_chat": false,
"enable_chat_colors": false,
"local_chat_format": "%player%&7:&r &7%message%",
"global_chat_format": "&8[&2G&8] &r%player%&7:&r &e%message%",
"world_chat_format": "&8[&9W&8] &r%player%&7:&r &e%message%",
"no_players_nearby_text": "&fNo players nearby. Please use &e!<message> &ffor global chat.",
"no_players_nearby_message": true,
"no_players_nearby_action_bar": true,
"chat_range": 100
}
You can use the placeholder %player% to specify the player's nickname and the placeholder %message% to specify their message in the chat.
%ftbteam% FTB Team integration - display your party in chat.
%lp_group% LuckPerms - display player group.
%lp_prefix% LuckPerms - display player prefix.
%lp_suffix% LuckPerms - display player suffix.
You can reload the configuration without restarting the server or the game using the /simplechat command (requires permission level 1 or more).
API
If you are a developer, you can use an event called when a player writes something to the chat.
Look me.vetustus.server.simplechat.api.event.PlayerChatCallback.
To control the behavior, use the ChatMessage subclass, which can be used to cancel sending a message or change it.
Example:
/**
* Prohibits players from writing messages by canceling an event.
*/
PlayerChatCallback.EVENT.register((player, message) -> {
PlayerChatCallback.ChatMessage chatMessage = new PlayerChatCallback.ChatMessage(player, message);
chatMessage.setCancelled(true);
return chatMessage;
});
License
The MIT license is used.
评论 0
登录后参与评分
还没有评论,来抢沙发吧