Rewrites a lot of scrapper code to fix actual and potential bugs
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good
This commit is contained in:
@ -7,7 +7,6 @@ import net.knarcraft.blacksmith.config.Settings;
|
||||
import net.knarcraft.blacksmith.config.TraitSettings;
|
||||
import net.knarcraft.blacksmith.formatting.TimeFormatter;
|
||||
import net.knarcraft.blacksmith.manager.EconomyManager;
|
||||
import net.knarcraft.blacksmith.util.SalvageHelper;
|
||||
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -196,9 +195,9 @@ public abstract class CustomTrait<K extends Setting> extends Trait {
|
||||
Objects.requireNonNull(((LivingEntity) npc.getEntity()).getEquipment()).setItemInMainHand(heldItem);
|
||||
}
|
||||
//Remove the item from the player's inventory
|
||||
if (!isBlacksmith) {
|
||||
if (this.session instanceof SalvageSession salvageSession) {
|
||||
// For scrappers, just reduce the amounts of items, unless the remaining stack is salvaged
|
||||
int amount = SalvageHelper.getRequiredAmountForSalvage(player.getServer(), heldItem);
|
||||
int amount = salvageSession.getItemsConsumed();
|
||||
if (amount != heldItem.getAmount()) {
|
||||
heldItem.setAmount(heldItem.getAmount() - amount);
|
||||
playerInventory.setItemInMainHand(heldItem);
|
||||
|
Reference in New Issue
Block a user