Griswold
现在,NPC 可以为你修复和附魔物品!——无需任何命令!
向铁匠展示你的物品,他会告诉你这项服务需要多少钱。如果你同意——只需把物品交给他即可。普通用户无需使用任何命令(因为他们根本不需要)!
简单!
NPC 类型:
当你使用 /blacksmith create 命令时,你可以指定 NPC 的类型。可用类型如下:
-
"all" —— 可以修复所有物品并附魔已修复的物品。
-
"weapon" 或 "armor" —— 只能修复某一类物品,无法进行附魔。
-
"both" —— 可以修复所有物品,但无法进行附魔。
-
"enchant" —— 这些角色仅能进行附魔,无法修复物品。
权限:
-
griswold.admin - 允许你创建和移除修理工
-
griswold.tools - 允许用户与修复武器和工具的修理工对话
-
griswold.armor - 允许用户与修复护甲的修理工对话
-
griswold.enchant - 允许用户在修理工处为装备进行附魔
命令:
这些命令仅供管理用途,普通用户无需使用它们。
-
/blacksmith create name - 创建新的修理工。你还可以指定更多参数:/blacksmith create name type cost。名称可以是任意内容,当用户与修理工对话时会显示在聊天栏中。NPC 类型见下文说明。Cost(费用系数)是修理工的费用倍率——它可以大于 1 以提高价格,或小于 1 以降低价格。价格会四舍五入保留两位小数。
-
/blacksmith list - 列出所有曾创建的修理工
-
/blacksmith remove name - 移除特定的修理工
-
/blacksmith despawn / respawn - 使所有修理工消失或重新生成。配置不会重新读取,你必须使用下一个命令来重载配置。
-
/blacksmith names – 切换头顶名称的显示。
-
/blacksmith sound name bukkitsoundid – 设置与修理工交互时的音效。使用标准的 Bukkit Sound 名称(你可以在此处找到)。你可以将声音设置为 "mute" 以静音。
-
/blacksmith reload - 重载配置文件,并使所有修理工先消失后重新生成。
所有命令都需要 griswold.admin 权限,并在出错时回退到 OP(管理员)权限。
/blacksmith 命令有一个别名 /bsmith,以避免与其他插件冲突。
NPC 类型:
当你使用 /blacksmith create 命令时,你可以指定 NPC 的类型。可用类型如下:
-
"all" – 可以修复所有物品并附魔已修复的物品。
-
"weapon" 或 "armor" – 只能修复某一类物品,无法进行附魔。
-
"both" – 可以修复所有物品,但无法进行附魔。
-
"enchant" – 这些角色仅负责附魔,无法修复物品。
配置:
所有参数都存储在 config.yml 中,并且无需重启服务器即可重新加载(/blacksmith reload)。
Debug 用于调试相关功能,如果你不清楚为何需要它,通常不建议开启。默认值为 "false"。
Timeout 设定铁匠“记住”你的物品并等待你确认修复的超时时间。默认值为 "5000"(5 秒)。
Language 是语言文件的名称(不包含末尾的 .yml),该文件与 config.yml 位于同一目录,包含首选语言的所有文本内容。默认值为 "en_US"。
UseEnchantmentSystem 指示插件是否允许生成附魔类型的修理员,并允许全类型修理员添加附魔效果。
PriceToAddEnchantment 设置添加一组随机附魔所需的费用。默认值为 50。
ClearOldEnchantments 告知修理员在附魔前是否应清除物品的原有附魔,还是直接在现有附魔基础上添加新附魔。默认值为 true,即“是的,清除原有附魔”。
EnchantmentBonus 表示铁匠周围“虚拟书架”的数量。数值越大,附魔效果越强。默认值为 5。
UseEnchantmentSystem 用于整体开启或关闭附魔功能。
ShowNames – 在 NPC 头顶显示名称。
DuplicateFinder – 当生成新的 NPC 时,它会检查是否存在因过去服务器崩溃而导致的重复 NPC。默认关闭,但如果遇到 NPC 重复问题,可将其设置为 true。
DuplicateFinderRadius 是插件搜索重复 NPC 的范围半径。较小的范围会略微减少服务器负载,并且可能更安全(避免误删正确的 NPC)。通常情况下,不建议将此值设置超过 10 格。
你还可以通过修改基础护甲和工具的价格以及附魔成本来调整价格计算。修改参数 BasicArmorPrice、BasicToolPrice 和 BasicEnchantmentPrice。
价格计算方式如下:修理匠费用参数 × (基础物品类型费用 + (基础附魔价格 × 附魔数量 × 附魔等级之和))。
该公式使得简单未附魔物品的修理费用相当低廉,带有 1-2 个附魔的物品修理费用适中,而拥有大量附魔的极品装备修理则会花费巨额金钱。
如果你想更改 NPC 互动时的音效——你可以使用游戏内命令或在 NPC 的配置部分进行修改。
所有其他配置参数均可在游戏内设置,因此你无需为此操心。但如果你愿意——它们其实都一目了然。
Citizens 集成
你可以为你的 NPC 添加特质,使其表现为相应的 Griswold NPC 类型。
可添加的特质包括:
-
griswold_tools
-
griswold_armor
-
griswold_both
-
griswold_enchant
-
griswold_all
请不要同时添加多个特质,哈哈。
如何添加自定义物品
你需要在配置中创建一个名为 CustomItems 的新条目。该条目将包含两个子条目:Tools 和 Armor。在这两者之下,以 "'id': name" 的格式添加你的物品。
听起来很复杂,但其实不然!请看我的示例配置:
CustomItems:
Tools:
'BOW': Bow
'FLINT_AND_STEEL': Flint and steel
Armor:
'LEATHER_CHESTPLATE': Leather Armor
'CHAINMAIL_CHESTPLATE': Some other armor
你只需将其复制粘贴到配置文件的末尾,并修改对应的 ID。冒号(":")后面的名称仅为方便你识别,在代码中并未实际使用。
如何设置物品黑名单
你可以禁止玩家修复特定物品,同时也可单独禁止玩家为特定物品添加附魔。
这分别通过 ItemBlacklist.Repair 和 ItemBlacklist.Enchant 配置节来实现。
以下是一个示例配置:
ItemBlacklist:
Enchant:
- DIAMOND_SWORD
- GOLD_SPADE
Repair:
- GOLD_SPADE
- DIAMOND_SWORD
默认情况下,此设置不会出现在你的配置文件中,你需要手动添加它。
你可以将以下代码片段复制并粘贴到配置文件的末尾。
给作者捐一美元!
我从现在开始已经有两年多的 Minecraft 开发经验了,而且一直是在业余时间进行。我至今还没有一个合法的 Minecraft 账号。拥有一个账号将有助于我在在线模式服务器上进行面对面的支持。所以,如果你希望我来你的服务器,或者只是想对我说一声“谢谢,Tony!”——请随意使用下面的按钮。我将用这些钱购买一个 Minecraft 账号。
统计信息:

该插件使用了 Hidendra 的插件指标系统,这意味着以下信息会被发送至 mcstats.org:
唯一标识符、服务器 Java 版本、服务器处于离线还是在线模式、Griswold 的版本、Bukkit 版本、操作系统版本与架构、CPU 核心数、在线玩家数量、指标系统版本。
您可以通过编辑 plugins/Plugin Metrics/config.yml 并将 opt-out 的值更改为 true 来退出此服务。
Griswold
NPCs now can repair and enchant your items! – Without any commands!
Show your stuff to blacksmith and he'll tell you how much he wants for the job. If you agree – just pass him the item. Users have no commands (because they don't need them)!
Simple!
NPC Types:
When you use /blacksmith create command you can specify a type of NPC. Available types are:
-
"all" – can repair everything and enchant repaired things.
-
"weapon" or "armor" – can repair only one type of items, cannot enchant.
-
"both" – can repair everything but cannot enchant.
-
"enchant" – these guys are just enchanters and cannot repair things.
Permissions:
-
griswold.admin - lets you create and remove repairmen
-
griswold.tools - lets users talk to repairmen who repair their weapons and tools
-
griswold.armor - lets users talk to repairmen who repair armors
-
griswold.enchant - lets users to enchant their gear at repairmen
Commands:
These commands are for administrative purposes, users don't need them.
-
/blacksmith create name - creates new repairman. You can also specify more parameters: /blacksmith create name type cost. Name can be anything and will be displayed in chat when user talks to repairman. NPC types are described below. Cost is repairman's multiplier of cost – it can be greater than 1 to make prices higher or below 1 to make prices lower. Prices are rounded to 2 digits after comma.
-
/blacksmith list - lists all the repairmen ever created
-
/blacksmith remove name - removes a particular repairman
-
/blacksmith despawn / respawn - despawns or respawns all repairmen. Config is not re-read, you have to use next command to reload config.
-
/blacksmith names – toggles names above their heads.
-
/blacksmith sound name bukkitsoundid – sets the interaction sound for the repairman. Use standard bukkit Sound names (you can find those here). You can set sound to "mute" to be silent.
-
/blacksmith reload - reloads config, despawns and then respawns all the repairmen.
All commands require griswold.admin permission and fallbacks to OP if something bad happens.
/blacksmith command has an alias – /bsmith to avoid conflicts with other plugins.
NPC Types:
When you use /blacksmith create command you can specify a type of NPC. Available types are:
-
"all" – can repair everything and enchant repaired things.
-
"weapon" or "armor" – can repair only one type of items, cannot enchant.
-
"both" – can repair everything but cannot enchant.
-
"enchant" – these guys are just enchanters and cannot repair things.
Config:
All parameters are stored in config.yml and are reloadable without restarting the server (/blacksmith reload).
Debug is for debugging stuff and not usually useful if you don't know why you need it. Default is "false".
Timeout is for timeout of blacksmiths "remember" your item and are waiting for you to confirm the repair. Default is "5000" (5 sec).
Language is a name of language file (without .yml at the end) stored next to config.yml and containing all the text in preferred language. Default is "en_US".
UseEnchantmentSystem tells the plugin if he should allow spawning of enchant-type repairmen and allow all-type ones to add enchantments.
PriceToAddEnchantment sets the price to add one random set of enchantments. Default - 50.
ClearOldEnchantments says to repairmen whether they should blank the item before they enchant it or just add new enchantments to it. Default - true that means "yes, blank it".
EnchantmentBonus is a number of "virtual bookshelves" around blacksmith. Greater the number - cooler are enchantments. Default - 5.
UseEnchantmentSystem switches the whole enchantment routine on and off.
ShowNames – shows names over NPC heads.
DuplicateFinder – when a new NPC spawns it will check for possible duplicates that may be there because of server crash in the past. It is off by default, but you can set it to true if you have NPC duplicate issues.
DuplicateFinderRadius is a radius where plugin will search for duplicate NPCs. Smaller means slightly less work for server and probably little bit safer (won't delete wrong guys). You don't usually want it to be more than 10 blocks anyways.
You also can alternate price calculation by changing basic armor and tool prices and enchantment cost. Modify parameters BasicArmorPrice, BasicToolPrice and BasicEnchantmentPrice.
Prices are calculated like this: repairman cost parameter * (basic item type cost + (basic enchantment price * number of enchantments * sum'd enchantment levels)).
This formula makes repairment of simple non-enchanted items quite cheap, items with 1-2 enchantments are at moderate cost and uber-enchanted items repairment cost a fortune.
If you want to change sound that NPC are making on interact – you can use ingame command or change it in the config part of the NPC.
All other config parameters are configurable in-game, so you don't have to bother about them. But if you want – they are quite self-explanatory.
Citizens integration
You can add traits to your npcs to act like respective Griswold NPC types.
Following traits can be added:
-
griswold_tools
-
griswold_armor
-
griswold_both
-
griswold_enchant
-
griswold_all
Please don't add multiple traits at once, lol.
How to add a custom item
You have to create a new entry in config with name CustomItems. This entry will contain two more entries: Tools and Armor. Under those you add your items in "'id': name" format.
Yes, it sounds complicated, but it is not! Here, look at my sample config:
CustomItems:
Tools:
'BOW': Bow
'FLINT_AND_STEEL': Flint and steel
Armor:
'LEATHER_CHESTPLATE': Leather Armor
'CHAINMAIL_CHESTPLATE': Some other armor
You can just copy-paste it in your config at the very end of it and change the IDs. Names after ":" are just for your convenience and are not used anywhere in the code.
How to blacklist items
You can prohibit players to repair certain items and also, separately, prohibit them from adding enchantments to certain items.
This is achieved through ItemBlacklist.Repair and ItemBlacklist.Enchant config sections, respectively.
Here is an example of such config:
ItemBlacklist:
Enchant:
- DIAMOND_SWORD
- GOLD_SPADE
Repair:
- GOLD_SPADE
- DIAMOND_SWORD
By default, this setting is not in your config and you have to add it manually.
You can copy-paste this snippet to the end of your config.
Give author a dollar!
I started to develop for Minecraft more than two years from now and only did it in my spare time. I still don't have a legit Minecraft account. Having one would be helpfull to give support in-person on online-mode servers. So if you want me to come to your server or just want to say "Thanks, Tony!" – feel free to use the button below. I will buy myself a minecraft account from these money.
Stats:

This plugin utilises Hidendra's plugin metrics system, which means that the following information is sent to mcstats.org:
unique identifier, server's version of Java, whether the server is in offline or online mode, Griswold's version, Bukkit version, OS version and architecture, CPU core count, number of players online, metrics version.
You can opt-out of this service by editing plugins/Plugin Metrics/config.yml and changing opt-out to true.
评论 0
登录后参与评分
还没有评论,来抢沙发吧