A fixed version of the Citizens Blacksmith trait plugin
Go to file
EpicKnarvik97 2489cac8db Changes configuration values to lower camelcase
Also fixes some grammar mistakes related to the word reforge
2022-10-03 12:39:15 +02:00
lib minimal update to 1.13 2018-10-12 12:00:54 -07:00
META-INF update some deprecated 2021-02-25 20:49:27 +03:00
src/main Changes configuration values to lower camelcase 2022-10-03 12:39:15 +02:00
.gitignore minimal update to 1.13 2018-10-12 12:00:54 -07:00
pom.xml Adds a permission for usage, and updates to 1.19.2 2022-10-03 00:11:39 +02:00
README.md Changes configuration values to lower camelcase 2022-10-03 12:39:15 +02:00

Blacksmith

The blacksmith plugin adds a new blacksmith trait to Citizens NPCs. NPCs are able to repair a player's held item for a fee. Costs are highly customizable.

Important changes from the original fork

  • The problem with armor being unrepairable because the player would equip it instead has been fixed.
  • A lot of configuration value have had their paths altered, so configurations need to be updated.
  • By default, natural cost is used. The original fork made it cheaper the more damaged an item is, but natural cost makes the cost increase the more damaged the item is.
  • EnchantmentTarget is used instead of a hard-coded list of repairable items
  • All settings (except default reforge-able-items), both global and for each blacksmith, can be changed using commands, and support tab-completion.

Dependencies

  • Citizens2
  • Vault

Basic usage

To create a new blacksmith, simply add the blacksmith trait to an NPC. Right-clicking the NPC will tell you if the currently held item is repairable by the blacksmith. If it is, the blacksmith should give a price quote. Right-clicking again starts the repair. The item should be given back or dropped after a random delay according to the set limits.

While costs are always set globally (no blacksmith can do the same job for cheaper), the blacksmith's messages, cool-down between each reforge, whether the item is dropped or given, the chance of failing or adding an enchantment, the maximum number of added enchantments, max and min delays, the length of the cool-down and which items the blacksmith is able to reforge can be changed individually.

Also note: Changing the default value of a setting doesn't change the setting for existing NPCs, even if no custom value has been set. Make sure to change default settings as needed before creating too many NPCs.

Special behavior

In addition to just being able to repair items, blacksmiths have some random features which can be cool or annoying:

  • There is a chance that blacksmiths fail to repair an item, leaving it at about the same durability as before. Use failReforgeChance to control the chance. Set it to 0 to remove the feature.
  • There is a chance a blacksmith may add

Commands

  • /blacksmith [new value] - Changes a configuration option for the selected blacksmith (use Citizens' /npc select first)
  • /blacksmithconfig <reload/option> [new value] - Changes a default/global configuration value

If a new value isn't specified, the current value is displayed instead.

Note: basePrice, pricePerDurabilityPoint and enchantmentCost can be set like: /blacksmithconfig option 4 or like /blacksmithconfig option material/enchantment 4 depending on whether you are setting the default or an override for a specific material/enchantment.

Permissions

  • blacksmith.admin - Allows overall blacksmith configuration
  • blacksmith.edit - Allows changing settings for the selected blacksmith NPC
  • blacksmith.use - Allows the player to repair items using blacksmiths

Configuration options

Global-only options

  • basePrice (positive decimal number) - The base price which has to be paid regardless of the durability remaining for an item. Setting this without specifying a material sets the basePrice for any item the basePrice has not been set for.
  • pricePerDurabilityPoint (positive decimal number) - The price added for each durability point present/missing (depends on natural cost's value). Setting this without specifying a material sets the pricePerDurabilityPoint for any item the pricePerDurabilityPoint has not been set for.
  • enchantmentCost (positive decimal number) - The added cost for each level of an enchantment present on the item. The cost can be set for specific enchantments. Not specifying an enchantment sets the value for all enchantments without a set value.
  • useNaturalCost (true/false) - If true, each missing durability will add to the cost (price = basePrice + missingDurability * pricePerDurabilityPoint + enchantmentCost). If false, durability will be used to calculate the cost instead of missingDurability (this was the behavior before natural cost was added).

Per-npc (with default values)

Configuration values

  • dropItem (true/false) - Whether the blacksmith should drop the repaired item on the ground (instead of putting it into the player's inventory)
  • disableCoolDown (true/false) - Whether to completely disable the cool-down between repairs
  • disableDelay (true/false) - Whether to completely disable the delay required to reforge an item
  • failReforgeChance (0-100) - The chance of the blacksmith failing to repair an item
  • extraEnchantmentChance (0-100) - The chance of the blacksmith adding an enchantment to an item
  • maxEnchantments (0-10) - The maximum number of different enchantments a blacksmith can add
  • maxReforgeDelay (0-3600) - The maximum number of seconds a player needs to wait for an item to be repaired
  • minReforgeDelay (0-3600) - The minimum number of seconds a player needs to wait for an item to be repaired
  • reforgeCoolDown (0-3600) - The cool-down a player has to wait between each time they use one specific blacksmith
  • reforgeAbleItems (DIAMOND_LEGGINGS,GOLD-pickaxe,bow, etc.) - Specifies which items this blacksmith is able to reforge. If set to "" or null, all items can be repaired. If set to a list of items, only the items specified can be repaired. Some presets have been included for ease of use. Use a preset by specifying "preset:sword-smith" instead of a material such as "gold-pickaxe". Available presets: SWORD_SMITH, WEAPON_SMITH, ARMOR_SMITH, TOOL_SMITH, RANGED_SMITH.

Messages

  • busyPlayerMessage - The message displayed when the blacksmith is serving another player
  • busyReforgeMessage - The message displayed when the blacksmith is busy reforging an item
  • coolDownUnexpiredMessage - The message displayed when the player has to wait for the cool-down to expire before using the blacksmith again
  • costMessage - The message displayed when telling a player about the cost of repairing an item
  • failReforgeMessage - The message displayed when a blacksmith fails to reforge an item
  • insufficientFundsMessage - The message displayed when a player is unable to pay for reforging an item
  • invalidItemMessage - The message displayed when a blacksmith is presented an item which it cannot repair
  • itemChangedMessage - The message displayed when a player changes their item after being shown the repair cost
  • startReforgeMessage - The message displayed when a blacksmith starts reforging an item
  • successMessage - The message displayed when a blacksmith successfully repairs an item