mirror of
https://github.com/songoda/EpicHoppers.git
synced 2024-11-22 18:25:59 +01:00
Replaces deprecated NBTItem calls
This commit is contained in:
parent
4697baf282
commit
39096ddb5c
@ -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
|
||||||
|
@ -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(":")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user