Messenger
一个插件,用于按照设定的时间间隔在聊天栏中发送格式化为 MiniMessage 的轮换消息。
配置
duration: 整数
- 每条消息在聊天栏中发送的时间间隔(秒)
- 默认值:
300(5 分钟)
message-format: 字符串
- 显示给用户在聊天栏中的消息格式。此选项可用于为消息添加前缀或后缀
- 支持 MiniMessage
- 默认值:
<gray>[<red>+</red>]</gray> %message%(渲染为 [+] %message%)
debug-logging: 布尔值
命令
/messenger <add|reload>
- Messenger 的主命令
/messenger add - 打开编辑器以向聊天栏添加新的轮换消息。
/messenger add <message> - 直接向聊天栏添加一条消息
/messenger reload - 从 messages.json 文件重新加载插件的配置和消息。
权限
messenger.command.messenger
- 运行
/messenger 命令的能力
- 默认值:
op(管理员)
数据
该插件目前仅处理两个文件:config.yml 和 messages.json。
config.yml 保存插件的配置,更多详情请参见 Configuration。
messages.json 保存要打印到聊天栏中的每条消息。从此列表中删除/添加消息将从游戏中移除/添加该消息(在执行 /messenger reload 或服务器重启后生效)。
消息格式
可以使用 MiniMessage 对消息进行格式化。如果消息中包含 %player%,它将被替换为玩家的用户名。
API
该插件提供了一个简单的 API,允许添加新消息。
如果使用 Maven 将其作为依赖项,请将以下内容添加到你的 pom.xml 中:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.funnyboy-roks</groupId>
<artifactId>Messenger</artifactId>
<version>Tag</version>
</dependency>
否则,请查看 jitpack 仓库 以获取其他系统的说明。
使用示例
// 构造一条新消息,内容为 "hello " + 玩家名称
// 并发送给所有玩家
Message msg = new Message(
p -> Component.text("hello ").append(p.displayName()),
p -> true
);
// 将消息添加到列表
Messenger.api().addMessage(msg);
未来待办事项
我始终在寻找创意,如果你有任何想法,请创建一个 Issue 并告诉我!
Messenger
A plugin to send
MiniMessage formatted
rotating messages in chat on a scheduled interval.
Configuration
duration: integer
- Seconds between each message being sent in chat
- Default:
300 (5 minutes)
message-format: string
- Format of the messages to be displayed to the user in chat. This
is used for adding a prefix or suffix to the message
- Supports MiniMessage
- Default:
<gray>[<red>+</red>]</gray> %message% (renders to [+] %message%)
debug-logging: boolean
- Whether verbose logging should be printed to the console
- Default:
false
Commands
/messenger <add|reload>
- Main command for Messenger
/messenger add - Open an editor to add a new rotating message to
the chat.
/messenger add <message> - Add a message into the chat directly
/messenger reload - Reload the plugin's configuration and
messages from the messages.json file.
Permissions
messenger.command.messenger
- Ability to run the
/messenger command
- Default:
op
Data
The plugin currently only handles two files: config.yml and
messages.json.
The config.yml holds the configuration for the plugin, see
Configuration for more details
The messages.json holds each message to be printed into chat.
Removing/Adding a message from this list will remove/add it from/to the
game (After /messenger reload or server restart).
Message Format
A message can be formatted using
MiniMessage. If
%player% is included in the message, it will be replaced with the
player's username.
API
The plugin offers a simple API which allows for adding new messages.
To add it as a dependency if using maven, add the following to your pom.xml:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.funnyboy-roks</groupId>
<artifactId>Messenger</artifactId>
<version>Tag</version>
</dependency>
Otherwise, checkout the jitpack repo for other systems
Usage example
// construct a new message that says "hello " + playername
// and is sent to all players
Message msg = new Message(
p -> Component.text("hello ").append(p.displayName()),
p -> true
);
// Add a message to the list
Messenger.api().addMessage(msg);
Future To-Do
- PAPI support - If there is interest
- More configuration options
I'm always looking for ideas, if you have any, please create an issue
and let me know!
评论 0
登录后参与评分
还没有评论,来抢沙发吧