Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Function Repair

Phoenix Nemo edited this page Sep 19, 2016 · 3 revisions

Repair

Consume specific material and experience to regain durability.

Command

/nu repair add [item] [material] [fullRepairCostAmount] [expCostPerConsume] [enchantCostPerLv] [repairTimesLimit]

Add a repairable item. Note [item] can be something like WOOD_AXE and all wooden axes will be applied to this rule, no matter name, lore, enchantments or NBT tags. [material] can be something like WOOD and ignores any attribute as well.

  • [fullRepairCostAmount] is the amount of material needed to fully repair an item with no enchantments.
  • [expCostPerConsume] is the amount of exp to consume on each material consume.
  • [enchantCostPerLv] is the modifier to increase repair cost based on enchantment level summary.
  • [repairTimesLimit] is the limitation of time that an item can be repaired using this plugin. A NBT tag will be written in item to implement limitation per specific item.
/nu repair info

Hold the item to be repaired and type this command will print information about repairing.

/nu repair hand

Consume one material to repair.

/nu repair full

Repair item to full durability, or consume max possible materials/exp to regain max durability.

Permission

  • nu.addrepair - Add a repairable item, defaults to op.
  • nu.repair - Repair an item, access to repair information.

Config

File repair.yml is controlled in-game, please use command to add/edit, DO NOT modify this file directly unless you know what you are doing.

IRON_SWORD:
  material: IRON_INGOT
  fullRepairCost: 2
  expCost: 2
  enchantCostPerLv: 0.3
  repairLimit: 0
DIAMOND_SWORD:
  material: DIAMOND
  fullRepairCost: 2
  expCost: 2
  enchantCostPerLv: 0.4
  repairLimit: 3
  • This configuration content is an example. Default should be an empty file.

Usage

As op

E.g., set diamond sword to be repairable. Command:

/nu repair add DIAMOND_SWORD DIAMOND 2 2 0.5 0

Explanation:

  • To fully repair an diamond sword with no enchantment require 2 diamonds, every diamond consumption cost 2 points of exp. Enchantment cost modifier is 0.5 and no repair time limitation applied so no NBT will be written to item.
  • If the diamond sword (vanilla durability 1561) is enchanted with sharpness III and durability I, then enchantment summary is 1 + 3 = 4 so each diamond consumption gets floor(1561 / (2 + 2 * 0.5)) = 520 durability regain, and costs floor(2 + 0.5 * 4) = 4 points of exp.

As user

  1. Hold the item to be repaired in main hand
  2. Command /nu repair info to get repair information
  3. Hold required material in off hand
  4. Command /nu repair hand execute 1 repair and consumes 1 material, or /nu repair full to execute a full repair, costs all material and exp needed. If material/exp is insufficient, on any of the requirements fails the repair will stop so you will get max possible durability regain.