Перейти к содержимому
Mineforgian

Better Mending

A plugin that allows players to repair their items with experience points, with customizable repair amounts and costs.

Загрузки
1K
Подписчики
14
Обновлён
9 января 2023 г.
Лицензия
MIT

Опубликован 7 января 2023 г.

This project has been replace by ForgeMend

. .

BetterMending

A plugin that allows players to repair their items with experience points, with customizable repair amounts and costs.

Features

  • Repair items using experience points on a specific enchantments
  • Permission is required to use the repair feature (Default: true)
  • Repair items with the right click mouse button while holding shift
  • Allow only certain enchantments to be repaired with the plugin

BetterMending gif

Configuration

The plugin's configuration can be found in the plugins/BetterMending/config.yml file.

# The amount of experience points required to repair 1 durability point
xpCost: 1

# The amount of durability points repaired per use
repairAmount: 2

# List of enchantments that are allowed to be used with the repair feature.
# The plugin will only use enchantments from this list for repair.
# Enchantments should be specified using their Minecraft ID (e.g. MENDING, PROTECTION).
# To allow all enchantments, specify "any" (without quotes).
allowedEnchantments:
 - MENDING

# Message displayed when the player does not have permission to use the repair feature
noPermissionMessage: "You do not have permission to use the repair feature!"

# Message displayed when the player's item is already fully repaired
itemAlreadyRepaired: "Your item is already fully repaired."

# Message displayed when the player's item does not have the MENDING enchantment
itemDoesNotHaveMending: "Your item does not have the MENDING enchantment."

# Message displayed when the MENDING enchantment is not allowed on the server
mendingNotAllowed: "The MENDING enchantment is not allowed on this server."

# Message displayed when the player does not have enough XP to repair their item
insufficientXP: "You do not have enough XP to repair your item."

# Message displayed when showing the player how much durability is left until their item is fully repaired
durabilityLeftMessage: "Your item has %d durability left until it is fully repaired."

# Message displayed when showing the player how many repairs are needed and how much XP it will cost to fully repair their item
repairsNeededMessage: "It will take %d repair(s) to fully repair your item, costing a total of %d exp points."

Permissions

bettermending.use: Allow a player to use the repair feature

Statistics

bstats

Ченджлог

1.0.7-1.19.3-paperАльфа1.19.1, 1.19.2, 1.19.3 · 9 января 2023 г.
  • Fixed a syntax error in the code
    • Problem: There was no opening parenthesis after else if and the semicolon at the end of the line was terminating the if statement prematurely.
    • Solution: Added the missing parenthesis and removed the semicolon at the end of the line.
1.0.6-1.19.3-paperАльфа1.19.1, 1.19.2, 1.19.3 · 8 января 2023 г.

Changes

  • Replace the following block of code:
List<String> allowedEnchantments = getConfig().getStringList("allowedEnchantments");
for (Enchantment enchant : enchantments.keySet()) {
if (!allowedEnchantments.contains(enchant.getName())) {
// Enchantment is not allowed, cancel the event
interactEvent.setCancelled(true);
return;
}
}

with the following code:

if (enchantments.isEmpty()) {
// Item has no enchantments, cancel the event
interactEvent.setCancelled(true);
return;
}

List<String> allowedEnchantments = getConfig().getStringList("allowedEnchantments");
boolean hasAllowedEnchantment = false;
for (Enchantment enchant : enchantments.keySet()) {
if (allowedEnchantments.contains(enchant.getName())) {
hasAllowedEnchantment = true;
break;
}
}

if (!hasAllowedEnchantment) {
// Item does not have any allowed enchantments, cancel the event
interactEvent.setCancelled(true);
return;
}

This change modifies the onPlayerInteract method to check if the item being repaired has at least one allowed enchantment, rather than checking if all of its enchantments are allowed. If the item has at least one allowed enchantment, the player is allowed to use experience points to repair the item. If the item does not have any allowed enchantments, the event is cancelled and the player is not allowed to use experience points to repair the item.

1.0.5-1.19.3-paperАльфа1.19.3 · 8 января 2023 г.
  • Fix issue with enchantment in config not working
1.0.4-1.19.3-paperРелиз1.19.3 · 7 января 2023 г.

Changed

  • Forgot to include permission in plugin.yml
  • Optimize code
1.0.3-1.19.3-paperАльфа1.19.3 · 7 января 2023 г.

Added

  • Config options for messages: noPermissionMessage, itemAlreadyRepaired, itemDoesNotHaveMending, mendingNotAllowed, insufficientXP, durabilityLeftMessage, repairsNeededMessage.
  • /bm reload command to allow users with the bettermending.reload permission to reload the plugin's config.
  • /bm status command to allow users to check how many xp cost and durability repair.
1.0.2-1.19.3-paperБета1.19.3 · 7 января 2023 г.

Added

  • Configuration option allowedEnchantments to allow players to choose which enchantments they want to use with the repair feature. The plugin will only use enchantments from this list for repair.

Changed

  • Event handler to use the containsKey method of the Map class to check if an ItemStack has the MENDING enchantment, and the contains method of the List class to check if the MENDING enchantment is in the list of allowed enchantments.
  • Dependency on bStats library to the latest version to fix a compilation error.
  • Configuration option xpCost to 1. The amount of experience points required to repair 1 durability point is now 1.
  • Configuration option repairAmount to 2. The amount of durability points repaired per use is now 2.

Removed

  • Unused metrics variable from the onEnable method.
1.0.1-1.19.3-paperАльфа1.19.3 · 7 января 2023 г.

Added bstats to project for plugin analytics

1.0.0-1.19.3-paperАльфа1.19.3 · 7 января 2023 г.

Initial release of BetterMending Repair amounts and costs are configurable

Комментарии

Загружаем…