diff --git a/build.gradle.kts b/build.gradle.kts index 02a81f5..9e0ef8d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,7 +24,7 @@ repositories { // NBT-API maven { name = "codemc-repo" - url = uri("https://repo.codemc.org/repository/maven-public/") + url = uri("https://repo.codemc.io/repository/maven-public/") } // FoliaLib @@ -80,7 +80,7 @@ tasks { relocate("org.bstats", "cn.dreeam.surf.libs.bstats") relocate("com.tcoded.folialib", "cn.dreeam.surf.libs.folialib") relocate("com.cryptomorin.xseries", "cn.dreeam.surf.libs.xseries") - relocate("de.tr7zw.nbtapi", "cn.dreeam.surf.libs.nbtapi") + relocate("de.tr7zw.changeme.nbtapi", "cn.dreeam.surf.libs.nbtapi") } processResources { diff --git a/src/main/java/cn/dreeam/surf/modules/patch/NBTBan.java b/src/main/java/cn/dreeam/surf/modules/patch/NBTBan.java index bfbbec4..940dbb3 100644 --- a/src/main/java/cn/dreeam/surf/modules/patch/NBTBan.java +++ b/src/main/java/cn/dreeam/surf/modules/patch/NBTBan.java @@ -2,7 +2,7 @@ import cn.dreeam.surf.config.Config; import cn.dreeam.surf.util.Util; -import de.tr7zw.nbtapi.NBT; +import de.tr7zw.changeme.nbtapi.NBT; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; @@ -19,15 +19,29 @@ public void onJoin(PlayerJoinEvent event) { Inventory inv = event.getPlayer().getInventory(); AtomicInteger itemSize = new AtomicInteger(); - inv.forEach(i -> { - if (i != null && i.getType().name().contains("SHULKER_BOX")) { - itemSize.addAndGet(NBT.itemStackToNBT(i).toString().length()); + // TODO + if (Util.majorVersion >= 20 && Util.minorVersion >= 5) { + inv.forEach(i -> { + if (i != null && i.getType().name().contains("SHULKER_BOX")) { + itemSize.addAndGet(NBT.itemStackToNBT(i).toString().length()); - if (itemSize.get() > Config.preventNBTBanLimit) { - inv.remove(i); - Util.sendMessage(event.getPlayer(), Config.preventNBTBanMessage); + if (itemSize.get() > Config.preventNBTBanLimit) { + inv.remove(i); + Util.sendMessage(event.getPlayer(), Config.preventNBTBanMessage); + } } - } - }); + }); + } else { + inv.forEach(i -> { + if (i != null && i.getType().name().contains("SHULKER_BOX")) { + itemSize.addAndGet(NBT.itemStackToNBT(i).toString().length()); + + if (itemSize.get() > Config.preventNBTBanLimit) { + inv.remove(i); + Util.sendMessage(event.getPlayer(), Config.preventNBTBanMessage); + } + } + }); + } } }