Replaces deprecated NBTItem calls

This commit is contained in:
Christian Koop 2022-03-18 21:15:25 +01:00
parent 4697baf282
commit 39096ddb5c
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
2 changed files with 8 additions and 10 deletions

View File

@ -12,8 +12,7 @@ import com.songoda.core.gui.GuiManager;
import com.songoda.core.hooks.EconomyManager; import com.songoda.core.hooks.EconomyManager;
import com.songoda.core.hooks.ProtectionManager; import com.songoda.core.hooks.ProtectionManager;
import com.songoda.core.locale.Locale; import com.songoda.core.locale.Locale;
import com.songoda.core.nms.NmsManager; import com.songoda.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.songoda.core.nms.nbt.NBTItem;
import com.songoda.core.utils.TextUtils; import com.songoda.core.utils.TextUtils;
import com.songoda.epichoppers.boost.BoostManager; import com.songoda.epichoppers.boost.BoostManager;
import com.songoda.epichoppers.commands.CommandBoost; import com.songoda.epichoppers.commands.CommandBoost;
@ -251,9 +250,9 @@ public class EpicHoppers extends SongodaPlugin {
} }
item.setItemMeta(itemmeta); item.setItemMeta(itemmeta);
NBTItem nbtItem = NmsManager.getNbt().of(item); NBTItem nbtItem = new NBTItem(item);
nbtItem.set("level", level.getLevel()); nbtItem.setInteger("level", level.getLevel());
return nbtItem.finish(); return nbtItem.getItem();
} }
@Override @Override

View File

@ -2,7 +2,7 @@ package com.songoda.epichoppers.hopper.levels;
import com.songoda.core.nms.NmsManager; import com.songoda.core.nms.NmsManager;
import com.songoda.core.nms.nbt.NBTCore; import com.songoda.core.nms.nbt.NBTCore;
import com.songoda.core.nms.nbt.NBTItem; import com.songoda.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.songoda.epichoppers.hopper.levels.modules.Module; import com.songoda.epichoppers.hopper.levels.modules.Module;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -28,11 +28,10 @@ public class LevelManager {
} }
public Level getLevel(ItemStack item) { public Level getLevel(ItemStack item) {
NBTCore nbt = NmsManager.getNbt(); NBTItem nbtItem = new NBTItem(item);
NBTItem nbtItem = nbt.of(item);
if (nbtItem.has("level")) if (nbtItem.hasKey("level"))
return getLevel(nbtItem.getNBTObject("level").asInt()); return getLevel(nbtItem.getInteger("level"));
// Legacy trash. // Legacy trash.
if (item.hasItemMeta() && item.getItemMeta().getDisplayName().contains(":")) { if (item.hasItemMeta() && item.getItemMeta().getDisplayName().contains(":")) {