PiglinTrades
一个轻量级的 Spigot/Paper 1.21+ 插件,允许特殊猪灵和(可选地)普通猪灵通过完全可配置、带权重的奖励池进行交易。玩家“提供”一件物品,猪灵会欣赏它一小段时间(冷却期),期间会将物品展示在副手中以防止武器丢失,随后根据你的配置掉落奖励。支持物品奖励(包括药水与附魔书)和控制台命令奖励——并可选支持 PlaceholderAPI 占位符。
亮点
- 特殊猪灵:无敌、不会消失,在“思考”时展示提供的物品,然后支付奖励。
- 普通猪灵(可切换):保留原版交易或通过在配置中切换让它们使用 PiglinTrades。
- 副手欣赏:提供的物品显示在副手中,以便猪灵保持主手的武器。
- 按物品类型分组的奖励池:每个奖励池由玩家提供的MATERIAL键控(例如
GOLD_INGOT)。
- 权重奖励:每项条目的
weight 控制概率;数量可以是固定值或范围。
- 奖励类型:
- 物品(支持附魔;通过基础
PotionType 支持药水; tipped arrows)
- 附魔书(存储的附魔)
- 命令(从控制台运行;支持
{player} 和 PlaceholderAPI)
- 管理员 GUI 与工具:在游戏中添加/编辑奖励池和奖励;模拟器测试概率。
要求
- 服务器:Spigot/Paper 1.21+
- Java:21+
- 可选:PlaceholderAPI(用于命令奖励中的占位符)
安装
- 将
PiglinTrades.jar 放入 /plugins 文件夹。
- (可选)如果你想在命令奖励中使用占位符,请安装 PlaceholderAPI。
- 重启以生成
config.yml 和 rewards.yml。
- 自定义设置,然后运行
/pt reload。
快速入门
- 使用
/pt spawn 放置一只特殊猪灵。
- 在
rewards.yml 中创建一个以玩家将要提供的物品为键的奖励池(例如 GOLD_INGOT)。
- 通过右键点击猪灵或在它们附近丢弃物品来提供该物品(消耗 1 个)。
- 冷却时间过后,匹配的奖励池中的奖励将出现。
想让普通猪灵也使用此插件?请参阅下面的配置切换选项。
配置
config.yml
cooldown-seconds — 猪灵“欣赏”物品后支付奖励前的秒数(默认:3)。
allow-vanilla-piglin-barter — 如果为 true,普通猪灵保留原版交易。特殊猪灵始终使用 PiglinTrades。
regular-piglins-use-plugin-trades — 如果为 true,普通猪灵也通过 PiglinTrades 进行交易。
这两个布尔值是互斥的。如果两者都为 true,插件会记录警告并禁用原版交易,使普通猪灵使用 PiglinTrades。
示例:
cooldown-seconds: 3
allow-vanilla-piglin-barter: false
regular-piglins-use-plugin-trades: false
rewards.yml(概念)
- 奖励池由MATERIAL 名称键控(例如
GOLD_INGOT)。
- 每个奖励池包含以下条目:
type: item | enchanted_book | command
weight: 越高越可能出现
- 对于物品:
material、amount(数字或 min-max)、可选 enchants、可选 potion
- 对于附魔书:
stored_enchants、amount
- 对于命令:
command(控制台),支持 {player} 和 PlaceholderAPI
提示:使用 /pt simulate <POOL_KEY> <COUNT> 预览结果分布。
命令与权限
- 基本命令:
/piglintrades(别名 /pt)
- 权限:
piglintrades.admin(默认:OP)
子命令:
/pt spawn — 生成一只特殊猪灵。
/pt reload — 重新加载配置。
/pt simulate <POOL_KEY> <COUNT> — 测试加权结果。
/pt kill <all|nearest> — 移除特殊猪灵。
/pt gui — 打开管理员 GUI。
玩家如何使用
- 特殊猪灵:右键点击或丢弃已配置的物品;等待冷却时间;收集奖励。
- 普通猪灵:
- 如果
allow-vanilla-piglin-barter: true → 它们表现得像原版。
- 如果
regular-piglins-use-plugin-trades: true → 它们使用与特殊猪灵相同的 PiglinTrades 流程。
注意事项
- 提供的物品在猪灵“欣赏”期间显示在其副手中(主手装备保持完整)。
- 如果奖励池没有有效条目或只有非正数的权重,它将不会选择奖励。
- 请根据 Spigot 枚举验证 MATERIAL 名称和附魔键。
故障排除
- 普通猪灵仍在进行原版交易 → 设置
allow-vanilla-piglin-barter: false 和 regular-piglins-use-plugin-trades: true,然后执行 /pt reload。如果两者都为 true,请检查控制台是否有互斥性警告。
/pt simulate 中出现“未知奖励池” → 验证确切的 MATERIAL 键。
- 没有奖励掉落 → 检查条目
type、权重和字段。
- 占位符未应用 → 安装 PlaceholderAPI 及所需的扩展包。
PiglinTrades
A lightweight Spigot/Paper 1.21+ plugin that lets both special Piglins and (optionally) regular Piglins trade via fully configurable, weighted reward pools. Players “offer” an item, the Piglin admires it for a short cooldown (shows it in off-hand so weapons aren’t lost), then drops a reward based on your config. Supports item rewards (incl. potions & enchanted books) and console command rewards — with optional PlaceholderAPI placeholders.
Highlights
- Special Piglins: Invulnerable, don’t despawn, show the offered item while “thinking,” then pay out.
- Regular Piglins (toggle): Keep vanilla bartering or switch them to PiglinTrades via config.
- Off-hand admire: Offered item appears in off-hand so Piglins keep their main-hand weapon.
- Item-keyed pools: Each pool is keyed by the MATERIAL the player offers (e.g.,
GOLD_INGOT).
- Weighted rewards: Per-entry
weight controls odds; amounts can be fixed or ranges.
- Reward types:
- Item (supports enchants; potions via base
PotionType; tipped arrows)
- Enchanted books (stored enchants)
- Command (runs from console; supports
{player} and PlaceholderAPI)
- Admin GUI & tools: Add/edit pools and rewards in-game; simulator to test odds.
Requirements
- Server: Spigot/Paper 1.21+
- Java: 21+
- Optional: PlaceholderAPI (for placeholders in command rewards)
Installation
- Drop
PiglinTrades.jar into /plugins.
- (Optional) Install PlaceholderAPI if you want placeholders in command rewards.
- Restart to generate
config.yml and rewards.yml.
- Customize settings, then run
/pt reload.
Quick Start
/pt spawn to place a Special Piglin.
- In
rewards.yml, create a pool keyed by the item players will offer (e.g., GOLD_INGOT).
- Offer the item by right-clicking the Piglin or dropping it near them (consumes 1).
- After the cooldown, a reward from the matching pool appears.
Want regular Piglins to use the plugin too? See the config toggle below.
Configuration
config.yml
cooldown-seconds — Seconds a Piglin “admires” the item before payout (default: 3).
allow-vanilla-piglin-barter — If true, regular Piglins keep vanilla bartering. Special Piglins always use PiglinTrades.
regular-piglins-use-plugin-trades — If true, regular Piglins also trade via PiglinTrades.
These two booleans are mutually exclusive. If both are true, the plugin logs a warning and disables vanilla bartering, making regular Piglins use PiglinTrades.
Example:
cooldown-seconds: 3
allow-vanilla-piglin-barter: false
regular-piglins-use-plugin-trades: false
rewards.yml (concept)
- Pools are keyed by MATERIAL names (e.g.,
GOLD_INGOT).
- Each pool has entries with:
type: item | enchanted_book | command
weight: higher = more likely
- For items:
material, amount (number or min-max), optional enchants, optional potion
- For enchanted books:
stored_enchants, amount
- For commands:
command (console), supports {player} and PlaceholderAPI
Tip: /pt simulate <POOL_KEY> <COUNT> to preview outcome distribution.
Commands & Permissions
- Base:
/piglintrades (alias /pt)
- Perm:
piglintrades.admin (default: OP)
Subcommands:
/pt spawn — Spawn a Special Piglin.
/pt reload — Reload configs.
/pt simulate <POOL_KEY> <COUNT> — Test weighted outcomes.
/pt kill <all|nearest> — Remove Special Piglins.
/pt gui — Open the admin GUI.
How players use it
- Special Piglins: Right-click or drop a configured item; wait the cooldown; collect reward.
- Regular Piglins:
- If
allow-vanilla-piglin-barter: true → they behave vanilla.
- If
regular-piglins-use-plugin-trades: true → they use the same PiglinTrades flow as specials.
Notes
- Offered items show in the Piglin’s off-hand while admiring (main-hand gear stays intact).
- If a pool has no valid entries or only non-positive weights, it won’t select a reward.
- Validate MATERIAL names and enchant keys against Spigot enums.
Troubleshooting
- Regular Piglin still barters vanilla → Set
allow-vanilla-piglin-barter: false and regular-piglins-use-plugin-trades: true, then /pt reload. Check console for the mutual-exclusivity warning if both were true.
- “Unknown pool” in
/pt simulate → Verify the exact MATERIAL key.
- No rewards dropping → Check entry
type, weights, and fields.
- Placeholders not applied → Install PlaceholderAPI and required expansions.
评论 0
登录后参与评分
还没有评论,来抢沙发吧