mirror of
https://github.com/songoda/EpicVouchers.git
synced 2024-11-22 01:56:21 +01:00
Replace deprecated NBTItem calls
This commit is contained in:
parent
1802ad3100
commit
bb45ef13d7
@ -1,7 +1,6 @@
|
||||
package com.songoda.epicvouchers.listeners;
|
||||
|
||||
import com.songoda.core.nms.NmsManager;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import com.songoda.core.third_party.de.tr7zw.nbtapi.NBTItem;
|
||||
import com.songoda.epicvouchers.EpicVouchers;
|
||||
import com.songoda.epicvouchers.utils.CachedSet;
|
||||
import com.songoda.epicvouchers.voucher.Voucher;
|
||||
@ -27,9 +26,9 @@ public class PlayerInteractListener implements Listener {
|
||||
ItemStack item = e.getItem();
|
||||
|
||||
if (item != null && (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK)) {
|
||||
NBTItem itemNbt = NmsManager.getNbt().of(item);
|
||||
NBTItem itemNbt = new NBTItem(item);
|
||||
|
||||
boolean itemHasVoucher = itemNbt.has("epicvouchers:voucher");
|
||||
boolean itemHasVoucher = itemNbt.hasKey("epicvouchers:voucher");
|
||||
String itemVoucherValue = itemNbt.getString("epicvouchers:voucher");
|
||||
|
||||
boolean legacyChecked = checkedLegacyVouchers.contains(item);
|
||||
|
@ -2,8 +2,7 @@ package com.songoda.epicvouchers.voucher;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.core.nms.NmsManager;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import com.songoda.core.third_party.de.tr7zw.nbtapi.NBTItem;
|
||||
import com.songoda.core.utils.ItemUtils;
|
||||
import com.songoda.core.utils.TextUtils;
|
||||
import com.songoda.epicvouchers.EpicVouchers;
|
||||
@ -113,9 +112,10 @@ public class Voucher {
|
||||
item.setItemMeta(meta);
|
||||
} else {
|
||||
item.setItemMeta(meta);
|
||||
NBTItem nbtItem = NmsManager.getNbt().of(item);
|
||||
nbtItem.set("Unbreakable", (byte) 1);
|
||||
item = nbtItem.finish();
|
||||
|
||||
NBTItem nbtItem = new NBTItem(item);
|
||||
nbtItem.setByte("Unbreakable", (byte) 1);
|
||||
item = nbtItem.getItem();
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,10 +123,10 @@ public class Voucher {
|
||||
item = ItemUtils.getCustomHead(texture);
|
||||
}
|
||||
|
||||
NBTItem nbtItem = NmsManager.getNbt().of(item);
|
||||
nbtItem.set("epicvouchers:voucher", key);
|
||||
NBTItem nbtItem = new NBTItem(item);
|
||||
nbtItem.setString("epicvouchers:voucher", key);
|
||||
|
||||
return nbtItem.finish();
|
||||
return nbtItem.getItem();
|
||||
}
|
||||
|
||||
public String getName(boolean applyFormatting) {
|
||||
|
Loading…
Reference in New Issue
Block a user