diff --git a/core/src/main/java/me/pikamug/quests/listeners/BukkitBlockListener.java b/core/src/main/java/me/pikamug/quests/listeners/BukkitBlockListener.java index 63037bf3b..f05ac4dc8 100644 --- a/core/src/main/java/me/pikamug/quests/listeners/BukkitBlockListener.java +++ b/core/src/main/java/me/pikamug/quests/listeners/BukkitBlockListener.java @@ -10,7 +10,6 @@ package me.pikamug.quests.listeners; -import de.tr7zw.changeme.nbtapi.NBT; import me.pikamug.quests.BukkitQuestsPlugin; import me.pikamug.quests.enums.ObjectiveType; import me.pikamug.quests.events.quester.BukkitQuesterPostUpdateObjectiveEvent; @@ -22,12 +21,10 @@ import me.pikamug.quests.player.Quester; import me.pikamug.quests.quests.Quest; import me.pikamug.quests.quests.components.BukkitObjective; import me.pikamug.quests.quests.components.BukkitStage; -import me.pikamug.quests.util.stack.BlockItemStack; import me.pikamug.quests.util.BukkitLang; +import me.pikamug.quests.util.stack.BlockItemStack; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.data.Ageable; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -39,7 +36,6 @@ import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.EquipmentSlot; -import org.bukkit.inventory.ItemStack; import java.util.HashSet; import java.util.LinkedList; @@ -375,39 +371,4 @@ public class BukkitBlockListener implements Listener { } } } - - /** - * Gets item equivalent of Block, unless server is on certain builds of Paper - * server software, in which case may return null - * - * @param block Block to convert - * @return item or null - */ - @SuppressWarnings("deprecation") - private ItemStack getItemEquivalent(final Block block) { - short durability = 0; - try { - durability = block.getState().getData().toItemStack().getDurability(); - } catch (final IllegalArgumentException e) { - // https://github.com/PikaMug/Quests/issues/2236 - } - try { - return new ItemStack(block.getType(), 1, durability); - } catch (final IllegalArgumentException e) { - // https://github.com/PikaMug/Quests/issues/2243 - } - try { - // Should only happen on Paper 1.21+ - final ItemStack item = new ItemStack(block.getBlockData().getPlacementMaterial()); - if (block.getBlockData() instanceof Ageable) { - NBT.modify(item, nbt -> { - nbt.setShort("quests_age", (short) ((Ageable)block.getBlockData()).getAge()); - }); - } - return item; - } catch (Exception e) { - // https://github.com/PikaMug/Quests/issues/2256 - } - return null; - } } diff --git a/core/src/main/java/me/pikamug/quests/player/BukkitQuester.java b/core/src/main/java/me/pikamug/quests/player/BukkitQuester.java index 07feabd8a..cf7232a34 100644 --- a/core/src/main/java/me/pikamug/quests/player/BukkitQuester.java +++ b/core/src/main/java/me/pikamug/quests/player/BukkitQuester.java @@ -1858,7 +1858,7 @@ public class BukkitQuester implements Quester { } } */ else if (Material.getMaterial("CRAFTER") != null && broken.getType().isEdible()) { // Paper 1.21+ is special case - final short toBreakAge = /* NBT.get(toBreak, nbt -> (short) nbt.getShort("quests_age")); */ 0; + final short toBreakAge = 0; final short brokenAge = broken.getDurability(); if (toBreakAge > 0) { // Age toBreak specified so check for durability diff --git a/core/src/main/java/me/pikamug/quests/util/BukkitItemUtil.java b/core/src/main/java/me/pikamug/quests/util/BukkitItemUtil.java index 35410e30d..54e5bca04 100644 --- a/core/src/main/java/me/pikamug/quests/util/BukkitItemUtil.java +++ b/core/src/main/java/me/pikamug/quests/util/BukkitItemUtil.java @@ -10,7 +10,6 @@ package me.pikamug.quests.util; -import de.tr7zw.changeme.nbtapi.NBT; import me.pikamug.quests.util.stack.BlockItemStack; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -233,9 +232,6 @@ public class BukkitItemUtil { if (mat.isBlock() && Material.getMaterial("CRAFTER") != null) { // Paper 1.21+ does not allow ItemStack from unobtainable blocks (i.e. CARROTS block) item = new ItemStack(mat.createBlockData().getPlacementMaterial(), amount); - NBT.modify(item, nbt -> { - nbt.setShort("quests_age", durability); - }); } else { item = new ItemStack(mat, amount, durability); }