DirectMessages
适用于 Paper 和 Folia 的私聊插件,支持自定义聊天格式、音效、操作栏提示、屏蔽功能、私聊开关以及社交间谍模式。
玩家通过 /msg 发送消息,使用 /r 回复。接收者会在聊天栏和操作栏看到消息,并听到提示音;发送者会听到不同的音效,出错时还会播放第三种声音。悬停显示玩家名称时会弹出包含其统计信息的卡片,点击该名称即可向对方发起私信。
功能特性
- 支持
/msg,及其别名 /tell、/whisper、/message 和 /w;支持 /r(/reply)进行回复
- 原版命令
/minecraft:msg、/minecraft:tell 和 /minecraft:w 也经过本插件处理,因此无人能绕过屏蔽、私聊开关或社交间谍模式
- 发送、接收和社交间谍消息拥有独立的格式化设置,支持
& 颜色代码及 &#RRGGBB 十六进制颜色
- 收到新消息时,操作栏会显示一行提示
- 分别设置发送、接收和错误提示的音效,每种音效均可独立调整音量和音调
- 玩家名称悬停卡片支持 PlaceholderAPI 占位符;点击名称会在聊天框中自动输入
/msg <name>
/ignore(或 /block)可双向屏蔽私人消息,并隐藏被屏蔽玩家的公共聊天内容
/msgtoggle 用于关闭接收私人消息的功能;玩家仍可主动发送消息
/socialspy 供管理员使用
- 支持 Vanish(隐身):对于不可见的玩家,
/msg 和 Tab 补全均将其显示为离线状态
- 消息间设有冷却时间,可通过权限绕过
- 所有私人消息均写入每日日志文件
- 屏蔽列表和社交间谍数据保存在 SQLite 或 MySQL 数据库中
- 支持 Folia
- 执行
/directmessages reload 可在不重启服务器的情况下重载配置
依赖要求
- Paper 1.21.7 或更高版本(已在 1.21.7 和 26.1.2 上测试)
- Folia 26.x(已在 Canvas 26.3,一个 Folia 分支上测试)
- 26.x 服务器需 Java 25 或更高版本;1.21.x 服务器需 Java 21 或更高版本
- PlaceholderAPI 用于支持占位符(可选)
默认配置使用以下 PlaceholderAPI 扩展:
/papi ecloud download Player
/papi ecloud download Vault
/papi ecloud download Statistic
name 中的 %vault_prefix% 用于显示玩家的等级前缀。这需要安装 Vault 以及带有前缀功能的权限插件(如 LuckPerms)。若未安装 PlaceholderAPI,占位符将按原样显示,因此请将 name 设置为 "{name}",并从 hover.lines 中移除占位符相关行。
安装步骤
- 将
DirectMessages-<version>.jar 放入你的 plugins 文件夹。
- 启动服务器。插件将在首次启动时下载其所需的库文件(Kotlin、HikariCP、SQLite 和 MySQL 驱动)。
- 编辑
plugins/DirectMessages/config.yml,然后运行 /directmessages reload。
命令与权限
| 命令 |
权限 |
描述 |
/msg <player> <message> |
无 |
发送私人消息。别名:/tell、/whisper、/message、/w |
/r <message> |
无 |
回复最后与你互动的玩家或向你发消息的玩家。别名:/reply |
/ignore <player> |
无 |
屏蔽该玩家;若已屏蔽则取消屏蔽。别名:/block |
/ignore |
无 |
列出你当前屏蔽的玩家列表。别名:/block |
/msgtoggle |
无 |
开启或关闭接收私人消息功能 |
/socialspy |
directmessages.socialspy (op) |
查看其他玩家之间的所有私人消息 |
/directmessages reload |
directmessages.reload (op) |
重载配置文件 |
|
directmessages.cooldown.bypass (op) |
无视冷却时间发送消息 |
配置示例
name: "%vault_prefix%{name}"
formats:
sent: "&#C77DFFTo &f{receiver}&7: &f{message}"
received: "&#C77DFFFrom &f{sender}&7: &f{message}"
spy: "&8[&#C77DFFSpy&8] &7{sender} &8→ &7{receiver}&8: &7{message}"
action-bar: "&#C77DFF✉ &fNew message from {sender}"
hover:
lines:
- "&f{name}"
- "&7------------"
- "�FF11$ &fMoney: �FF11%vault_eco_balance_formatted%"
- "&#FF0000🗡 &fKills: &#FF0000%statistic_player_kills%"
- "&#FFE400⌚ &fPlaytime: &#FFE400%statistic_time_played%"
- "&#FA7600☠ &fDeaths: &#FA7600%statistic_deaths%"
- "&7------------"
- "&7Click To Message!"
click: "/msg {name} "
sounds:
sent:
sound: entity.experience_orb.pickup
volume: 0.6
pitch: 1.4
received:
sound: block.note_block.pling
volume: 1.0
pitch: 2.0
error:
sound: entity.villager.no
volume: 1.0
pitch: 1.0
cooldown: 1.0
log: true
storage:
type: sqlite
mysql:
host: localhost
port: 3306
database: minecraft
username: root
password: ""
messages:
msg-usage: "&cUsage: /msg <player> <message>"
reply-usage: "&cUsage: /r <message>"
not-online: "&c{player} is not online."
no-reply: "&cYou have nobody to reply to."
self: "&cYou can't message yourself."
not-accepting: "&cThat user is not accepting private messages."
you-ignore: "&cYou are ignoring {player}."
cooldown: "&cWait {seconds}s before sending another message."
ignore-on: "&7You now ignore &f{player}&7."
ignore-off: "&7You no longer ignore &f{player}&7."
ignore-self: "&cYou can't ignore yourself."
ignore-list: "&7Ignored players: &f{players}"
ignore-empty: "&7You don't ignore anyone."
never-joined: "&c{player} has never joined."
spy-on: "&aSocial spy on."
spy-off: "&cSocial spy off."
toggle-on: "&aPrivate messages on."
toggle-off: "&cPrivate messages off."
reloaded: "&aDirectMessages reloaded."
| 键 |
说明 |
name |
玩家在消息中显示的名称。{name} 是玩家的名字;占位符会针对该玩家进行填充 |
formats.sent |
发送者看到的内容 |
formats.received |
接收者看到的内容 |
formats.spy |
拥有社交窥视权限的管理员看到的内容 |
formats.action-bar |
接收者看到的动作栏行 |
hover.lines |
悬停在名称上时显示的卡片内容。占位符会针对该名称所属的玩家进行填充 |
hover.click |
点击名称时输入到聊天框中的内容。{name} 是玩家的名字 |
sounds.sent / sounds.received |
任意声音键,包括资源包中的声音。音量和音调为数值 |
sounds.error |
每当出现错误消息时播放,例如“你不能给自己发消息”或某玩家不接受消息 |
cooldown |
同一玩家两条消息之间的间隔秒数。设为 0 则关闭冷却时间 |
| log | 将每条消息写入 plugins/DirectMessages/logs/<date>.log |
| storage.type | sqlite(保存在 plugins/DirectMessages/data.db)或 mysql |
在 formats 中,{sender} 和 {receiver} 是两位玩家的名称,通过 name 显示,并附带悬浮提示卡和点击效果。
{message} 是消息文本。它不会解析颜色或占位符,因此玩家无法使用它们。令牌会继承其前面书写的颜色。
当某人忽略你或 /msgtoggle 处于关闭状态时,你会收到相同的 not-accepting 消息,因此你无法区分这两种情况。
空的格式、动作栏、声音、hover.lines 或 hover.click 将关闭相应部分。messages 中的空消息不会被发送。更改 storage 需要重启;其他所有内容可通过 /directmessages reload 立即应用。
构建
需要 JDK 25 或更高版本以及 Maven。
mvn package
JAR 文件会写入 target/ 目录。
支持
在我的 Discord 上提问:
许可证
MIT
DirectMessages
Private messages for Paper and Folia, with your own chat formats, sounds, an action bar notice, ignore, a PM toggle
and social spy.
Players message each other with /msg and answer with /r. The receiver sees the message in chat and on the action
bar and hears a sound; the sender hears a different one, and a third sound plays when something goes wrong. Hovering a player's name shows a card with their stats, and
clicking it starts a message to them.
Features
/msg with the aliases /tell, /whisper, /message and /w, and /r (/reply) to answer
- Vanilla
/minecraft:msg, /minecraft:tell and /minecraft:w go through the plugin too, so nobody can skip ignore,
the PM toggle or social spy
- Separate formats for sent, received and social spy messages, with
& colors and &#RRGGBB hex colors
- A line on the action bar when a message arrives
- One sound for sending, one for receiving and one for errors, each with its own volume and pitch
- A hover card on player names with PlaceholderAPI placeholders; clicking a name types
/msg <name> in the chat box
/ignore (or /block) blocks private messages both ways and hides the ignored player's public chat
/msgtoggle turns off receiving private messages; the player can still send them
/socialspy for staff
- Vanish support: players you can't see look offline to
/msg and tab completion
- Cooldown between messages, with a bypass permission
- Every private message written to a daily log file
- Ignore lists and social spy saved in SQLite or MySQL
- Folia support
/directmessages reload to reload the config without a restart
Requirements
- Paper 1.21.7 or newer (tested on 1.21.7 and 26.1.2)
- Folia 26.x (tested on Canvas 26.3, a Folia fork)
- Java 25 or newer on 26.x servers, Java 21 or newer on 1.21.x servers
- PlaceholderAPI for placeholders (optional)
The default config uses these PlaceholderAPI expansions:
/papi ecloud download Player
/papi ecloud download Vault
/papi ecloud download Statistic
%vault_prefix% in name shows the player's rank prefix. It needs Vault and a permissions plugin with prefixes, such
as LuckPerms. Without PlaceholderAPI, placeholders are shown as typed, so set name to "{name}" and remove the
placeholder lines from hover.lines.
Installation
- Put
DirectMessages-<version>.jar in your plugins folder.
- Start the server. The plugin downloads its libraries (Kotlin, HikariCP, SQLite and MySQL drivers) on first start.
- Edit
plugins/DirectMessages/config.yml and run /directmessages reload.
Commands and permissions
| Command |
Permission |
Description |
/msg <player> <message> |
none |
Sends a private message. Aliases: /tell, /whisper, /message, /w |
/r <message> |
none |
Replies to the last player you messaged or who messaged you. Alias: /reply |
/ignore <player> |
none |
Ignores the player, or stops ignoring them if you already do. Alias: /block |
/ignore |
none |
Lists the players you ignore. Alias: /block |
/msgtoggle |
none |
Turns receiving private messages off, or back on |
/socialspy |
directmessages.socialspy (op) |
Shows you every private message between other players |
/directmessages reload |
directmessages.reload (op) |
Reloads the config |
|
directmessages.cooldown.bypass (op) |
Sends messages without the cooldown |
Configuration
name: "%vault_prefix%{name}"
formats:
sent: "&#C77DFFTo &f{receiver}&7: &f{message}"
received: "&#C77DFFFrom &f{sender}&7: &f{message}"
spy: "&8[&#C77DFFSpy&8] &7{sender} &8→ &7{receiver}&8: &7{message}"
action-bar: "&#C77DFF✉ &fNew message from {sender}"
hover:
lines:
- "&f{name}"
- "&7------------"
- "�FF11$ &fMoney: �FF11%vault_eco_balance_formatted%"
- "&#FF0000🗡 &fKills: &#FF0000%statistic_player_kills%"
- "&#FFE400⌚ &fPlaytime: &#FFE400%statistic_time_played%"
- "&#FA7600☠ &fDeaths: &#FA7600%statistic_deaths%"
- "&7------------"
- "&7Click To Message!"
click: "/msg {name} "
sounds:
sent:
sound: entity.experience_orb.pickup
volume: 0.6
pitch: 1.4
received:
sound: block.note_block.pling
volume: 1.0
pitch: 2.0
error:
sound: entity.villager.no
volume: 1.0
pitch: 1.0
cooldown: 1.0
log: true
storage:
type: sqlite
mysql:
host: localhost
port: 3306
database: minecraft
username: root
password: ""
messages:
msg-usage: "&cUsage: /msg <player> <message>"
reply-usage: "&cUsage: /r <message>"
not-online: "&c{player} is not online."
no-reply: "&cYou have nobody to reply to."
self: "&cYou can't message yourself."
not-accepting: "&cThat user is not accepting private messages."
you-ignore: "&cYou are ignoring {player}."
cooldown: "&cWait {seconds}s before sending another message."
ignore-on: "&7You now ignore &f{player}&7."
ignore-off: "&7You no longer ignore &f{player}&7."
ignore-self: "&cYou can't ignore yourself."
ignore-list: "&7Ignored players: &f{players}"
ignore-empty: "&7You don't ignore anyone."
never-joined: "&c{player} has never joined."
spy-on: "&aSocial spy on."
spy-off: "&cSocial spy off."
toggle-on: "&aPrivate messages on."
toggle-off: "&cPrivate messages off."
reloaded: "&aDirectMessages reloaded."
| Key |
Description |
name |
How a player's name looks in messages. {name} is the player's name; placeholders are filled for that player |
formats.sent |
What the sender sees |
formats.received |
What the receiver sees |
formats.spy |
What staff with social spy on see |
formats.action-bar |
The action bar line the receiver sees |
hover.lines |
The card shown when hovering a name. Placeholders are filled for the player whose name it is |
hover.click |
Typed into the chat box when a name is clicked. {name} is the player's name |
sounds.sent / sounds.received |
Any sound key, including resource pack sounds. Volume and pitch are numbers |
sounds.error |
Plays with every error message, like "You can't message yourself." or a player not accepting messages |
cooldown |
Seconds between two messages from the same player. 0 turns it off |
log |
Writes every message to plugins/DirectMessages/logs/<date>.log |
storage.type |
sqlite (saved in plugins/DirectMessages/data.db) or mysql |
In formats, {sender} and {receiver} are the two players' names, drawn with name, with the hover card and click.
{message} is the message text. It is never parsed for colors or placeholders, so players can't use them. A token
takes the color written before it.
When someone ignores you or has /msgtoggle off, you get the same not-accepting message, so you can't tell which.
An empty format, action bar, sound, hover.lines or hover.click turns that part off. An empty message in
messages is not sent. Changing storage needs a restart; everything else applies with /directmessages reload.
Building
Requires JDK 25 or newer and Maven.
mvn package
The jar is written to target/.
Support
Ask on my Discord:
License
MIT
评论 0
登录后参与评分
还没有评论,来抢沙发吧