diff --git a/pom.xml b/pom.xml index 46d508a..e36957d 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.songoda EpicVouchers - 2.2.1 + 2.2.2 EpicVouchers Enhance your server with awesome customizable vouchers with a lot of features. @@ -114,7 +114,7 @@ com.songoda SongodaCore - 2.6.11 + 2.6.12 compile diff --git a/src/main/java/com/songoda/epicvouchers/listeners/PlayerInteractListener.java b/src/main/java/com/songoda/epicvouchers/listeners/PlayerInteractListener.java index 248dc5f..31c64b3 100644 --- a/src/main/java/com/songoda/epicvouchers/listeners/PlayerInteractListener.java +++ b/src/main/java/com/songoda/epicvouchers/listeners/PlayerInteractListener.java @@ -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); diff --git a/src/main/java/com/songoda/epicvouchers/voucher/Voucher.java b/src/main/java/com/songoda/epicvouchers/voucher/Voucher.java index 851fb16..7dfb12b 100644 --- a/src/main/java/com/songoda/epicvouchers/voucher/Voucher.java +++ b/src/main/java/com/songoda/epicvouchers/voucher/Voucher.java @@ -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) { diff --git a/src/main/java/com/songoda/epicvouchers/voucher/VoucherExecutor.java b/src/main/java/com/songoda/epicvouchers/voucher/VoucherExecutor.java index 8bac460..a3d1778 100644 --- a/src/main/java/com/songoda/epicvouchers/voucher/VoucherExecutor.java +++ b/src/main/java/com/songoda/epicvouchers/voucher/VoucherExecutor.java @@ -2,7 +2,6 @@ package com.songoda.epicvouchers.voucher; import com.songoda.core.compatibility.CompatibleSound; import com.songoda.core.compatibility.ServerVersion; -import com.songoda.core.utils.TextUtils; import com.songoda.epicvouchers.EpicVouchers; import com.songoda.epicvouchers.events.VoucherRedeemEvent; import com.songoda.epicvouchers.listeners.PlayerCommandListener; @@ -167,13 +166,13 @@ public class VoucherExecutor { player.addPotionEffect(new PotionEffect(PotionEffectType.getByName(effect), duration, amplifier)); } - instance.getLogger().log(Level.INFO, TextUtils.formatText("&f" + player.getName() + " has successfully redeemed the voucher " + voucher.getKey() + ".")); + instance.getLogger().log(Level.INFO, player.getName() + " has successfully redeemed the voucher " + voucher.getKey() + "."); instance.getConnections().saveRedeem(player, voucher.getName(true)); } else { - instance.getLogger().log(Level.WARNING, TextUtils.formatText("&c" + player.getName() + " has failed to duplicate the voucher " + voucher.getKey() + ".")); + instance.getLogger().log(Level.WARNING, player.getName() + " has failed to duplicate the voucher " + voucher.getKey() + "."); } } catch (Exception error) { - instance.getLogger().log(Level.SEVERE, TextUtils.formatText("&cFailed to redeem the voucher " + voucher.getKey() + " for the player " + player.getName() + ".")); + instance.getLogger().log(Level.SEVERE, "Failed to redeem the voucher " + voucher.getKey() + " for the player " + player.getName() + "."); instance.getLogger().log(Level.SEVERE, error.getMessage()); error.printStackTrace(); } @@ -202,4 +201,4 @@ public class VoucherExecutor { Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command); } } -} \ No newline at end of file +}