Better Mending

Better Mending

Plugin

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

Server EquipmentGame MechanicsMagicUtility

364 downloads
13 followers
Createda year ago
Updateda year ago

Follow Save
Better Mending has been archived. Better Mending will not receive any further updates unless the author decides to unarchive the project.
Host your Minecraft server on BisectHosting - get 25% off your first month with code MODRINTH.

Better Mending 1.0.6-1.19.3-paper

Changelog

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.

Files

bettermending-1.0.6-1.19.3-paper.jar(34.25 KiB) Primary Download

Project members

laika

Owner

AkaSokuro

Member

Lumio

Member


Technical information

License
Project ID