CustomPaintings
CustomPaintings 允许服务器管理员上传 PNG 图片到服务器,并向玩家提供基于地图的画作,包括多地图壁画(2x2、4x4 等)。
功能特性
- 直接将 PNG 文件上传到服务器文件系统
- 导入为:
- 单张画作(
1x1 地图)
- 多地图壁画(
2x2 至 8x8)
- 通过一条命令向玩家发放画作套装
- 在
paintings.yml 中持久化保存画作索引
- 支持命令和画作名称的 Tab 补全
要求
构建
从插件源码文件夹执行:
./gradlew build
输出 jar 包:
build/libs/CustomPaintings-1.0.0.jar
安装
- 停止你的 Paper 服务器。
- 将
CustomPaintings-1.0.0.jar 复制到服务器的 plugins/ 文件夹中。
- 启动服务器。
- 确认插件已启用:
- 运行
/plugins
CustomPaintings 应显示为绿色
生成的文件夹/文件
成功启动后,插件会创建以下目录和文件:
plugins/CustomPaintings/config.yml
plugins/CustomPaintings/uploads/ (在此放入待上传的 PNG 图片)
plugins/CustomPaintings/paintings/ (生成的地图切片 PNG 图片)
plugins/CustomPaintings/paintings.yml (画作元数据)
命令参考
基础命令:
/painting
1) 列出画作
/painting list
显示所有已注册的画作名称及尺寸(例如 wallart (4x4))。
2) 导入画作
/painting import <name> <upload-file.png> [widthMaps] [heightMaps]
name: 画作 ID(仅支持 a-z、0-9、_、-,最大长度 32 个字符)
upload-file.png: 放置在 uploads/ 目录中的文件名
widthMaps: 可选,默认值为 1,范围 1..8
heightMaps: 可选,默认值为 1,范围 1..8
示例:
/painting import mona mona.png
/painting import castle castle.png 2 2
/painting import mega_wall panorama.png 4 3
3) 发放画作套装
/painting give <name> [player] [sets]
name: 已注册的画作名称
player: 可选的目标玩家
sets: 可选的全套数量(默认 1,上限 64)
一套包含完成壁画所需的所有地图物品:
1x1 壁画 = 每套 1 张地图
2x2 壁画 = 每套 4 张地图
4x4 壁画 = 每套 16 张地图
示例:
/painting give mona
/painting give mona bitz
/painting give castle bitz 3
4) 移除画作
/painting remove <name>
删除该画作的元数据及生成的切片图像。
5) 重载画作索引
/painting reload
无需重启服务器即可重载 paintings.yml。
权限
custompaintings.use(默认:true)
custompaintings.admin(默认:op)
管理权限用于:
/painting import ...
/painting remove ...
/painting reload
完整工作流程示例(用户名为 bitz)
- 将
sunset.png 上传至:
plugins/CustomPaintings/uploads/sunset.png
- 将其导入为 2x2 壁画:
/painting import sunset sunset.png 2 2
- 确认:
/painting list
- 给自己发放一套:
/painting give sunset bitz 1
- 按网格顺序将地图放置在画框中:
放置顺序说明
地图显示名称中包含切片位置信息,例如:
Painting: sunset [1/2, 1/2]
含义:
- 第一组数值表示水平位置(
x/宽度)
- 第二组数值表示垂直位置(
y/高度)
利用此信息可正确放置壁画的画框。
故障排除
插件在 /plugins 中显示为红色
检查服务器启动时的控制台日志,查找 CustomPaintings 相关的错误。
本项目修复的一个常见问题:
- jar 包中缺少
config.yml 会导致:
The embedded resource 'config.yml' cannot be found
上传文件夹缺失
该文件夹路径为:
plugins/CustomPaintings/uploads
如果不存在,说明插件可能未能成功启用。
“未找到画作”
- 确保已先导入画作
- 在
/painting list 中检查确切的画作名称
“未找到上传文件”
- 验证文件是否存在于
plugins/CustomPaintings/uploads/ 中
- 使用确切的文件名,包括
.png 后缀
“仅支持 .png 文件”
请将源文件转换为 PNG 格式并重试导入。
壁画过大
最大导入尺寸为 8x8 地图。
数据格式
paintings.yml 将每个画作存储为:
width(宽度)
height(高度)
prefix(切片文件名前缀)
插件还支持加载旧版的单一文件条目,并将其视为 1x1 处理。
安全升级/替换 Jar 包
- 停止服务器。
- 替换
plugins/ 中的插件 jar 包。
- 启动服务器。
- 如果仅在运行时更改了元数据,请运行
/painting reload。
卸载
- 停止服务器。
- 从
plugins/ 中移除插件 jar 包。
- (可选)删除
plugins/CustomPaintings/ 数据文件夹。
许可证
MIT
CustomPaintings
CustomPaintings lets server admins upload PNG images to the server and give players map-based paintings, including multi-map murals (2x2, 4x4, etc.).
Features
- Upload PNG files directly to the server filesystem
- Import as:
- Single painting (
1x1 map)
- Multi-map mural (
2x2 up to 8x8)
- Give painting sets to players with one command
- Persistent painting index in
paintings.yml
- Tab-complete for commands and painting names
Requirements
Build
From plugin source folder:
./gradlew build
Output jar:
build/libs/CustomPaintings-1.0.0.jar
Install
- Stop your Paper server.
- Copy
CustomPaintings-1.0.0.jar into your server plugins/ folder.
- Start the server.
- Confirm plugin is enabled:
- Run
/plugins
CustomPaintings should be green
Created Folders/Files
After successful startup, plugin creates:
plugins/CustomPaintings/config.yml
plugins/CustomPaintings/uploads/ (put upload PNGs here)
plugins/CustomPaintings/paintings/ (generated map tile PNGs)
plugins/CustomPaintings/paintings.yml (painting metadata)
Command Reference
Base command:
/painting
1) List paintings
/painting list
Shows all registered painting names and dimensions (example wallart (4x4)).
2) Import painting
/painting import <name> <upload-file.png> [widthMaps] [heightMaps]
name: painting id (a-z, 0-9, _, -, max 32 chars)
upload-file.png: filename placed in uploads/
widthMaps: optional, default 1, range 1..8
heightMaps: optional, default 1, range 1..8
Examples:
/painting import mona mona.png
/painting import castle castle.png 2 2
/painting import mega_wall panorama.png 4 3
3) Give painting set(s)
/painting give <name> [player] [sets]
name: registered painting
player: optional target player
sets: optional number of full sets (default 1, clamped 1..64)
A set contains all map items required for the mural:
1x1 mural = 1 map per set
2x2 mural = 4 maps per set
4x4 mural = 16 maps per set
Examples:
/painting give mona
/painting give mona bitz
/painting give castle bitz 3
4) Remove painting
/painting remove <name>
Deletes metadata and generated tile images for that painting.
5) Reload painting index
/painting reload
Reloads paintings.yml without restarting server.
Permissions
custompaintings.use (default: true)
custompaintings.admin (default: op)
Admin required for:
/painting import ...
/painting remove ...
/painting reload
Full Workflow Example (with username bitz)
- Upload
sunset.png to:
plugins/CustomPaintings/uploads/sunset.png
- Import as 2x2 mural:
/painting import sunset sunset.png 2 2
- Confirm:
/painting list
- Give one set to yourself:
/painting give sunset bitz 1
- Place maps in item frames in grid order:
- Top row left to right
- Then next row left to right
Notes on Placement Order
Map display names include tile position like:
Painting: sunset [1/2, 1/2]
Meaning:
- first value pair is horizontal position (
x/width)
- second pair is vertical position (
y/height)
Use that to place frames correctly for murals.
Troubleshooting
Plugin is red in /plugins
Check console logs on startup for CustomPaintings errors.
Common issue fixed in this project:
- Missing
config.yml in jar causes:
The embedded resource 'config.yml' cannot be found
Upload folder missing
Folder is:
plugins/CustomPaintings/uploads
If it does not exist, plugin likely failed to enable.
"Painting not found"
- Ensure painting was imported first
- Check exact painting name in
/painting list
"Upload file not found"
- Verify file exists in
plugins/CustomPaintings/uploads/
- Use exact filename including
.png
"Only .png files are supported"
Convert source to PNG and retry import.
Mural too large
Max import size is 8x8 maps.
Data Format
paintings.yml stores each painting as:
width
height
prefix (tile filename prefix)
The plugin also supports loading older legacy single-file entries and treating them as 1x1.
Upgrade/Replace Jar Safely
- Stop server.
- Replace plugin jar in
plugins/.
- Start server.
- Run
/painting reload if only metadata changed while running.
Uninstall
- Stop server.
- Remove plugin jar from
plugins/.
- (Optional) Delete
plugins/CustomPaintings/ data folder.
License
MIT
评论 0
登录后参与评分
还没有评论,来抢沙发吧