Skip to content

Commit

Permalink
update NBT API usage
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Aug 6, 2024
1 parent 78b9149 commit eb71550
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.xginko.aef.modules.illegals.items.nbt;

import de.tr7zw.changeme.nbtapi.NBTItem;
import de.tr7zw.changeme.nbtapi.NBT;
import me.xginko.aef.enums.AEFPermission;
import me.xginko.aef.enums.ItemLegality;
import me.xginko.aef.modules.illegals.items.IllegalItemModule;
Expand Down Expand Up @@ -36,7 +36,7 @@ public ItemLegality legalityOf(ItemStack itemStack) {
return ItemLegality.LEGAL;
}

if (new NBTItem(itemStack).toString().contains("run_command")) {
if (NBT.get(itemStack, itemNBT -> itemNBT).toString().contains("run_command")) {
return ItemLegality.ILLEGAL;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.xginko.aef.modules.illegals.items.nbt;

import de.tr7zw.changeme.nbtapi.NBTItem;
import de.tr7zw.changeme.nbtapi.NBT;
import me.xginko.aef.enums.AEFPermission;
import me.xginko.aef.enums.IllegalHandling;
import me.xginko.aef.enums.ItemLegality;
Expand Down Expand Up @@ -58,7 +58,7 @@ public ItemLegality legalityOf(ItemStack itemStack) {
}

if (!useWhitelist || blacklistMode == whitelistedTypes.contains(itemStack.getType())) {
String nbtItemToString = new NBTItem(itemStack).toString();
String nbtItemToString = NBT.get(itemStack, itemNBT -> itemNBT).toString();
for (String tag : illegalTags) {
if (nbtItemToString.contains(tag)) {
return ItemLegality.ILLEGAL;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.xginko.aef.modules.illegals.items.nbt;

import com.destroystokyo.paper.MaterialTags;
import de.tr7zw.changeme.nbtapi.NBTItem;
import de.tr7zw.changeme.nbtapi.NBT;
import me.xginko.aef.enums.AEFPermission;
import me.xginko.aef.enums.IllegalHandling;
import me.xginko.aef.enums.ItemLegality;
Expand Down Expand Up @@ -60,7 +60,7 @@ public ItemLegality legalityOf(ItemStack itemStack) {
return ItemLegality.LEGAL;
}

if (storageTypes.contains(itemStack.getType()) && new NBTItem(itemStack).getKeys().contains(stored_items_tag)) {
if (storageTypes.contains(itemStack.getType()) && NBT.get(itemStack, itemNBT -> itemNBT).getKeys().contains(stored_items_tag)) {
return ItemLegality.ILLEGAL;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.xginko.aef.modules.illegals.items.nbt;

import de.tr7zw.changeme.nbtapi.NBTItem;
import de.tr7zw.changeme.nbtapi.NBT;
import me.xginko.aef.enums.AEFPermission;
import me.xginko.aef.enums.ItemLegality;
import me.xginko.aef.modules.illegals.items.IllegalItemModule;
Expand Down Expand Up @@ -37,7 +37,7 @@ public ItemLegality legalityOf(ItemStack itemStack) {
return ItemLegality.LEGAL;
}

if (new NBTItem(itemStack).toString().contains("run_command")) {
if (NBT.get(itemStack, itemNBT -> itemNBT).toString().contains("run_command")) {
return ItemLegality.ILLEGAL;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.xginko.aef.modules.illegals.items.nbt;

import de.tr7zw.changeme.nbtapi.NBTItem;
import de.tr7zw.changeme.nbtapi.NBT;
import me.xginko.aef.enums.AEFPermission;
import me.xginko.aef.enums.IllegalHandling;
import me.xginko.aef.enums.ItemLegality;
Expand Down Expand Up @@ -58,7 +58,7 @@ public ItemLegality legalityOf(ItemStack itemStack) {
}

if (!useWhitelist || blacklistMode == whitelistedTypes.contains(itemStack.getType())) {
String nbtItemToString = new NBTItem(itemStack).toString();
String nbtItemToString = NBT.get(itemStack, itemNBT -> itemNBT).toString();
for (String tag : illegalTags) {
if (nbtItemToString.contains(tag)) {
return ItemLegality.ILLEGAL;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.xginko.aef.modules.illegals.items.nbt;

import de.tr7zw.changeme.nbtapi.NBTItem;
import de.tr7zw.changeme.nbtapi.NBT;
import me.xginko.aef.enums.AEFPermission;
import me.xginko.aef.enums.IllegalHandling;
import me.xginko.aef.enums.ItemLegality;
Expand Down Expand Up @@ -59,7 +59,7 @@ public ItemLegality legalityOf(ItemStack itemStack) {
return ItemLegality.LEGAL;
}

if (storageTypes.contains(itemStack.getType()) && new NBTItem(itemStack).getKeys().contains(stored_items_tag)) {
if (storageTypes.contains(itemStack.getType()) && NBT.get(itemStack, itemNBT -> itemNBT).getKeys().contains(stored_items_tag)) {
return ItemLegality.ILLEGAL;
}

Expand Down

0 comments on commit eb71550

Please sign in to comment.