二、详细的副指挥部描述
- /bp 打印 <文件名> [作者] – 管理员 打印 书籍
权限:bookprinter.print(默认:OP)
功能:直接将指定的.txt文件转换为书面书籍,并交给执行者(玩家)或输出到控制台。不扣减费用;适合行政测试或奖励。
参数:
<文件名>:用于转换的文本文件。.txt扩展可以省略。文件必须位于插件数据文件夹plugins/BookPrinter/中(除非配置允许子目录或绝对路径)。
[作者](可选):指定书籍作者。如果未提供,且执行人是玩家,则默认使用其游戏内名称;如果执行人是控制台,必须提供作者。
示例:
/bp 打印故事 → 阅读story.txt,作者默认为执行人。
/bp 打印novel.txt Alice → 阅读novel.txt,作者设置为 Alice。
- /bp 购买 <文件名> [作者] – 玩家购买书籍
权限:bookprinter.buy(默认:所有人)
功能:玩家可以用游戏内货币或经验值购买指定的书籍。插件会在扣除费用并授予书籍之前,检查玩家是否有足够的资金或经验。
前提条件:服务器必须安装了Vault(如果支付方式是现金)或使用基于经验的支付(无需Vault)。
参数:和print命令一样。
配置:
支付方式设置在config.yml(payment.method 是 money 或 exp)。
价格由买入价格(金币数量、经验等级或经验值)决定。
购买命令可以通过启用购买命令完全禁用。
示例:
/bp 购买指南 → 尝试购买guide.txt并根据配置扣除相应的金币或经验值。
如果资金或经验不足,会显示提示。
- /bp reload – Reload 配置
权限:bookprinter.reload(默认:OP)
功能:重新加载config.yml和语言文件(例如Language-zh_CN.yml),在不重启服务器的情况下应用更改。
示例:修改配置后,运行 /bp reload 来应用更改。
- /bp 信息 – 查看插件信息
权限:bookprinter.info(默认:OP)
功能:显示当前操作模式(经典/现代)、语言设置、最大文件大小限制、插件版本等。
举例:/bp info输出的大致内容是:
========== [印刷工] ==========
当前模式:现代
语言:zh_CN
最大文件大小:2.00 MB
插件版本:1.0.0
==================================
三、权限列表
权限节点描述 默认
bookprinter.print 允许使用 print 子命令 OP
bookprinter.buy 允许使用 buy 子命令 true
bookprinter.reload 允许重新加载OP配置
bookprinter.info允许查看插件信息,楼主
四、文件放置与命名
所有.txt文件必须放在插件数据文件夹中:plugins/BookPrinter/
文件名不区分大小写,.txt扩展名可以省略(插件会自动添加)。
子目录和绝对路径的使用由经典模式配置控制(默认禁用)。
五、支付配置(config.yml例)
支付设置
付款:
方法:金钱 # 金钱或经验
经验类型:等级 # 等级 或 点数(仅在方法=经验值时适用)
购买价格:100.0 # 金币数量 / 经验等级 / 经验值
Whether to enable the /bp buy command
enable-buy-command: true
Money payment: Requires Vault and an economy plugin (e.g., EssentialsX, CMI).
Experience payment:
level: Deducts experience levels (e.g., 5 levels).
point: Deducts experience points (e.g., 100 points).
VI. Notes
File encoding: Text files must be UTF-8 encoded, otherwise Chinese characters may display incorrectly.
File size limit: Default is 2 MB; can be adjusted via max_file_bytes in config.yml.
Color codes:
Classic mode: Uses & plus color codes (e.g., &a for green), supports RGB hex (e.g., &#FF0000 for red).
Modern mode: Uses MiniMessage format (e.g., <green>green</green>), offering more powerful formatting.
Multi-language: Switch language via the language setting (built-in: Chinese zh_CN and English en_US or other); custom language files can be added.
VII. Frequently Asked Questions
Q: Why does /bp buy say Vault is unavailable?
A: Check if Vault is installed and payment.method is set to money. If using experience payment, Vault is not required.
Q: How can players be allowed to purchase books?
A: Grant players the bookprinter.buy permission (all players have it by default) and set the correct payment method and price in config.yml.
Q: What is the books title after generation?
A: The title is automatically derived from the filename. For example, my_story.txt becomes My Story.
Q: What is the book’s title after generation?
A: The title is automatically derived from the filename. For example, becomes .my_story.txtMy Story