Skip to content

Commit

Permalink
improve(stick): reset ItemStack damage by using DataComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
Siroshun09 committed Nov 18, 2024
1 parent d02d43b commit 4cc8109
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.okocraft.box.feature.stick.listener;

import io.papermc.paper.datacomponent.DataComponentTypes;
import net.okocraft.box.api.BoxAPI;
import net.okocraft.box.api.model.item.BoxItem;
import net.okocraft.box.api.player.BoxPlayer;
Expand Down Expand Up @@ -36,7 +37,6 @@
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.FurnaceInventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.Damageable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -286,7 +286,7 @@ public void onItemBreak(@NotNull PlayerItemBreakEvent event) {
return;
}

original.editMeta(Damageable.class, meta -> meta.setDamage(0));
original.setData(DataComponentTypes.DAMAGE, 0);

if (this.tryConsumingStock(boxPlayer, original, new StickCauses.ItemBreak(boxPlayer))) {
original.setAmount(2);
Expand Down

0 comments on commit 4cc8109

Please sign in to comment.