Add and increase Threshold
Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
2f72d011e6
Commit
d75fe24ebe
@ -27,6 +27,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class InventoryListener_15 {
|
||||
|
||||
private static final int threshold = 2048;
|
||||
|
||||
public static boolean checkItemStack(ItemStack item) {
|
||||
net.minecraft.server.v1_15_R1.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
|
||||
NBTTagCompound tag = nmsItem.getTag();
|
||||
@ -34,13 +36,13 @@ public class InventoryListener_15 {
|
||||
NBTTagCompound blockTag = tag.getCompound("BlockEntityTag");
|
||||
assert blockTag != null;
|
||||
if (blockTag.hasKey("Items")) {
|
||||
return drillDown(blockTag.getList("Items", 10), 0, 0) > 1024;
|
||||
return drillDown(blockTag.getList("Items", 10), 0, 0) > threshold;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static int drillDown(NBTTagList items, int layer, int start) {
|
||||
if (layer > 2) return start + 1024;
|
||||
if (layer > 2) return start + threshold;
|
||||
int invalid = start;
|
||||
for (NBTBase nbtBase : items) {
|
||||
if (!(nbtBase instanceof NBTTagCompound))
|
||||
@ -56,7 +58,7 @@ public class InventoryListener_15 {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (invalid > 1024)
|
||||
if (invalid > threshold)
|
||||
break;
|
||||
}
|
||||
return invalid;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren