DungeonInstances
一个用于 Spigot/Paper Minecraft 的插件,通过小队系统、可点击的邀请、管理员命令和游戏内记分板 HUD 来管理副本实例。
概述
DungeonInstances 允许你从模板创建副本世界,邀请玩家加入小队,并在进入实例时显示动态记分板。该插件旨在提供简单的管理功能(创建/删除/编辑模板、设置出生点)以及友好的用户体验(彩色消息、接受/拒绝邀请的可点击按钮)。
主要功能
- 基于模板创建实例(位于
templates-dungeons/ 下的文件夹)。
- 小队系统,支持可点击的邀请(
[Accept]、[Decline])。
- 管理员命令:加载/编辑/保存/清除实例,定义出生点。
- 在副本世界中可见的记分板(
instance_<name>_<uuid>),显示:
- 小队成员(队长标记为
♛,你自己标记为 ★)。
- 显示成员相对位置的 directional arrows(方向箭头)。
- 以颜色显示当前生命值(绿色/黄色/红色)。
- 离线成员显示为删除线。
安装
- 构建:
cd /path/to/DungeonsInstances
mvn clean package -DskipTests -T 1C
或者如果你使 ./build 脚本具有可执行权限,也可以使用它。
- 部署:将生成的 JAR 文件复制到你的 Spigot/Paper 服务器
plugins/ 文件夹中:
cp "target/Dungeon Instances-1.0.0.jar" /path/to/server/plugins/
- 重启服务器。
重要文件夹结构
templates-dungeons/ – 模板文件夹(一个文件夹 = 一个副本模板)。如果文件夹不存在,插件会自动创建它并从内部归档安装默认的 manaria 副本。
plugins/DungeonInstances/spawnPoints.json – 通过 /dungeon admin setspawn 设置的出生点。
命令
所有命令均以 /dungeon 开头。
注意:
- 邀请使用 TextComponent API 来提供客户端上的可点击按钮。
- 没有权限的玩家看不到管理员命令。
记分板 (HUD)
- 当玩家处于名称以
instance_ 开头的世界中时,记分板会自动激活。
- 它在侧边栏显示:
- 副本名称(从世界名称
instance_<name>_<uuid> 中提取)。
- 带有生命值状态、相对方向、队长/星星标记的小队成员。
- 统一的分隔符(页眉/页脚)采用一致的颜色。
出生点
/dungeon admin setspawn <template>
- 出生点持久化存储在
plugins/DungeonInstances/spawnPoints.json 中。
模板与实例
- 将你的副本模板放置在
templates-dungeons/<template_name>/ 中。
- 实例通过复制创建,并加载为
instance_<template_name>_<uuid>。
- 空的实例会自动卸载并删除。
权限
dungeon.admin – 访问管理员命令(/dungeon admin ...)。
其他命令默认没有特定权限(如果需要可以添加检查)。
故障排除
- 如果实例加载失败,请检查世界容器文件夹(模板文件夹副本)的写入权限。
- 如果记分板不出现:确保你在
instance_... 世界中并且属于一个小队。
- 如果离线玩家名称显示不正确,插件会使用
Bukkit.getOfflinePlayer(UUID).getName() 作为后备方案。
自定义战利品表
DungeonInstances 包含每个副本/难度的战利品表系统。每个生物都可以标记一个 pool alias(战利品池别名),该别名决定当生物在副本中死亡时使用的战利品表。别名存储在 NBT(PersistentDataContainer)中,并在保存/加载之间保持持久。
配置
配置文件位于 plugins/DungeonInstances/lootTables.json。首次加载时,会创建一个空的 {},以便管理员手动填充。预期结构:
{
"<模板名称>": {
"<难度>": {
"<别名>": {
"iterations": <掷骰次数>,
"loots": [
{
"item": "minecraft:diamond_sword",
"nbt": { "item_name": "Legendary Sword" },
"count": 1,
"chance": 0.1
},
{
"item": "minecraft:iron_nugget",
```json
{
"nbt": { "item_name": "盾牌" },
"count": 1,
"chance": 0.4
}
模板 manaria 配合别名 default 在全部四种难度下的完整示例:
在此示例中,随着难度提升,iterations(迭代次数)和掉落几率都会相应增加;请根据你的需求调整这些数值。
战利品表字段
iterations – 池子被访问的次数;每次迭代会从 loots 中随机选取一项。
loots – 可能的条目数组。对于每个条目,将 chance 与一个随机值(0.0–1.0)进行比较;如果判定成功,则该物品会被加入掉落物中。
item – Bukkit/Spigot 材质 ID(如 DIAMOND_SWORD、IRON_NUGGET 等)。
nbt – 用于设置物品名称(item_name)、描述 lore 等的自由映射。目前仅支持简单的键(参见源代码)。
count – 当该条目被选中时生成的物品数量。
分配别名
在编辑模板时,看向一只怪物并运行:
/dungeon admin alias <alias>
如果不提供参数,插件会显示当前的别名。要清除别名,请使用 none:
/dungeon admin alias none
别名会与怪物一起保存,并在副本实例中自动恢复。
重载配置
在磁盘上编辑完 lootTables.json 后,在游戏中使用以下命令重载更改:
/dungeon admin reloadloot
游戏内行为
当带有别名的怪物在副本实例中死亡时,原版掉落物会被移除,并替换为根据匹配的池子(模板 + 难度 + 别名)计算出的物品。如果未找到对应的表,则保持原版行为不变。
自定义与建议
- 你可以在代码中修改记分板更新频率(
DungeonScoreboardManager)和消息格式。
- 可能的改进方向:多语言支持、通过
config.yml 进行配置、隐藏某些 HUD 元素的选项等。
DungeonInstances
A Spigot/Paper Minecraft plugin for managing instanced dungeons with party system, clickable invitations, admin commands and in-game scoreboard HUD.
Overview
DungeonInstances lets you create dungeon worlds copied from templates, invite players to parties, and display a dynamic scoreboard when inside an instance. The plugin aims for simple administration (create/delete/edit templates, set spawns) and friendly UX (colored messages, clickable buttons to accept/decline invitations).
Main Features
- Instance creation based on templates (folders under
templates-dungeons/).
- Party system with clickable invitations (
[Accept], [Decline]).
- Admin commands: load/edit/save/purge instances, define spawn points.
- Scoreboard visible in instance worlds (
instance_<name>_<uuid>) displaying:
- Party members (leader marked with
♛, you marked with ★).
- Directional arrows showing members' relative position.
- Current health in color (green/yellow/red).
- Offline members displayed with strikethrough.
Installation
- Build:
cd /path/to/DungeonsInstances
mvn clean package -DskipTests -T 1C
Or use the ./build script if you made it executable.
- Deploy: copy the generated JAR to your Spigot/Paper server's
plugins/ folder:
cp "target/Dungeon Instances-1.0.0.jar" /path/to/server/plugins/
- Restart the server.
Important Folder Structure
templates-dungeons/ – template folders (one folder = one dungeon template). If the folder doesn't exist, the plugin automatically creates it and installs the default manaria dungeon from its internal archive.
plugins/DungeonInstances/spawnPoints.json – spawn points set via /dungeon admin setspawn.
Commands
All commands are under /dungeon.
Notes:
- Invitations use TextComponent API to provide clickable buttons on the client.
- Admin commands are hidden from players without permission.
Scoreboard (HUD)
- The scoreboard activates automatically for players in a world whose name starts with
instance_.
- It displays in the sidebar:
- The dungeon name (extracted from world name
instance_<name>_<uuid>).
- Party members with health status, relative direction, leader/star markers.
- Uniform separators (header/footer) in consistent color.
Spawn Points
- Set a spawn per template with:
/dungeon admin setspawn <template>
- Spawns are persisted in
plugins/DungeonInstances/spawnPoints.json.
Templates & Instances
- Place your dungeon templates in
templates-dungeons/<template_name>/.
- Instances are created by copying and loaded under
instance_<template_name>_<uuid>.
- Empty instances are automatically unloaded and deleted.
Permissions
dungeon.admin – access to admin commands (/dungeon admin ...).
Other commands have no specific permissions by default (you can add checks if needed).
Troubleshooting
- If an instance fails to load, check write permissions on the world container folder (template folder copy).
- If the scoreboard doesn't appear: ensure you're in an
instance_... world and belong to a party.
- If offline player names display incorrectly, the plugin uses
Bukkit.getOfflinePlayer(UUID).getName() as fallback.
Custom Loot Tables
DungeonInstances includes a loot table system per dungeon/difficulty. Each mob can be marked with a pool alias that determines the loot table used when the mob dies in an instance. The alias is stored in NBT (PersistentDataContainer) and persists across saves/loads.
Configuration
The config file is at plugins/DungeonInstances/lootTables.json. On first load, an empty {} is created so admins can populate it manually. Expected structure:
{
"<template_name>": {
"<difficulty>": {
"<alias>": {
"iterations": <number of rolls>,
"loots": [
{
"item": "minecraft:diamond_sword",
"nbt": { "item_name": "Legendary Sword" },
"count": 1,
"chance": 0.1
},
{
"item": "minecraft:iron_nugget",
"nbt": { "item_name": "Shield" },
"count": 1,
"chance": 0.4
}
]
}
}
}
}
Complete example for template manaria with default alias across all four difficulties:
{
"manaria": {
"BEGINNER": {
"default": {
"iterations": 2,
"loots": [
{"item":"minecraft:emerald","nbt":{},"count":1,"chance":0.2},
{"item":"minecraft:gold_nugget","nbt":{},"count":2,"chance":0.5}
]
}
},
"NORMAL": {
"default": {
"iterations": 3,
"loots": [
{"item":"minecraft:emerald","nbt":{},"count":1,"chance":0.4},
{"item":"minecraft:gold_ingot","nbt":{},"count":1,"chance":0.25},
{"item":"minecraft:iron_nugget","nbt":{},"count":3,"chance":0.6}
]
}
},
"HEROIC": {
"default": {
"iterations": 4,
"loots": [
{"item":"minecraft:diamond","nbt":{},"count":1,"chance":0.05},
{"item":"minecraft:gold_ingot","nbt":{},"count":2,"chance":0.4},
{"item":"minecraft:iron_ingot","nbt":{},"count":5,"chance":0.8}
]
}
},
"MYTHIC": {
"default": {
"iterations": 5,
"loots": [
{"item":"minecraft:nether_star","nbt":{},"count":1,"chance":0.01},
{"item":"minecraft:diamond","nbt":{},"count":2,"chance":0.2},
{"item":"minecraft:gold_ingot","nbt":{},"count":4,"chance":0.5}
]
}
}
}
}
In this example, increasing difficulty raises both iterations and drop chances; adjust these values to suit your needs.
Loot Table Fields
iterations – number of times the pool is visited; each iteration randomly picks an item from loots.
loots – array of possible entries. For each entry, chance is compared to a random value (0.0–1.0); if the roll succeeds, the item is added to drops.
item – Bukkit/Spigot material ID (DIAMOND_SWORD, IRON_NUGGET, etc.).
nbt – free mapping for item name (item_name), lore, etc. Only simple keys are supported currently (see source code).
count – quantity of items to generate when the entry is selected.
Assigning Aliases
While editing a template, look at a mob and run:
/dungeon admin alias <alias>
The plugin shows the current alias if no argument is given. To clear the alias, use none:
/dungeon admin alias none
The alias is saved with the mob and automatically restored in instances.
Reloading Configuration
After editing lootTables.json on disk, reload changes in-game with:
/dungeon admin reloadloot
In-Game Behavior
When a mob with an alias dies in an instance, vanilla drops are removed and replaced with items calculated from the matching pool (template + difficulty + alias). If no table is found, vanilla behavior is unchanged.
Customization & Suggestions
- You can modify the scoreboard update frequency (
DungeonScoreboardManager) and message formats in the code.
- Possible improvements: multi-language support, config via
config.yml, options to hide certain HUD elements.
评论 0
登录后参与评分
还没有评论,来抢沙发吧