Search in sources :

Example 1 with PacketPlayInSetCreativeSlot

use of net.minecraft.network.protocol.game.PacketPlayInSetCreativeSlot in project Panilla by ds58.

the class PacketInspector method checkPacketPlayInSetCreativeSlot.

@Override
public void checkPacketPlayInSetCreativeSlot(Object _packet) throws NbtNotPermittedException {
    if (_packet instanceof PacketPlayInSetCreativeSlot) {
        PacketPlayInSetCreativeSlot packet = (PacketPlayInSetCreativeSlot) _packet;
        int slot = packet.b();
        ItemStack itemStack = packet.getItemStack();
        if (itemStack == null || !itemStack.hasTag())
            return;
        NbtTagCompound tag = new NbtTagCompound(itemStack.getTag());
        String itemClass = itemStack.getItem().getClass().getSimpleName();
        String packetClass = packet.getClass().getSimpleName();
        NbtChecks.checkPacketPlayIn(slot, tag, itemClass, packetClass, panilla);
    }
}
Also used : INbtTagCompound(com.ruinscraft.panilla.api.nbt.INbtTagCompound) NbtTagCompound(com.ruinscraft.panilla.craftbukkit.v1_17_R1.nbt.NbtTagCompound) PacketPlayInSetCreativeSlot(net.minecraft.network.protocol.game.PacketPlayInSetCreativeSlot) ItemStack(net.minecraft.world.item.ItemStack)

Example 2 with PacketPlayInSetCreativeSlot

use of net.minecraft.network.protocol.game.PacketPlayInSetCreativeSlot in project Panilla by ds58.

the class PacketInspector method checkPacketPlayInSetCreativeSlot.

@Override
public void checkPacketPlayInSetCreativeSlot(Object _packet) throws NbtNotPermittedException {
    if (_packet instanceof PacketPlayInSetCreativeSlot) {
        PacketPlayInSetCreativeSlot packet = (PacketPlayInSetCreativeSlot) _packet;
        int slot = packet.b();
        ItemStack itemStack = packet.c();
        if (itemStack == null || !itemStack.r())
            return;
        NbtTagCompound tag = new NbtTagCompound(itemStack.s());
        String itemClass = itemStack.c().getClass().getSimpleName();
        String packetClass = packet.getClass().getSimpleName();
        NbtChecks.checkPacketPlayIn(slot, tag, itemClass, packetClass, panilla);
    }
}
Also used : NbtTagCompound(com.ruinscraft.panilla.craftbukkit.v1_18_R1.nbt.NbtTagCompound) INbtTagCompound(com.ruinscraft.panilla.api.nbt.INbtTagCompound) PacketPlayInSetCreativeSlot(net.minecraft.network.protocol.game.PacketPlayInSetCreativeSlot) ItemStack(net.minecraft.world.item.ItemStack)

Example 3 with PacketPlayInSetCreativeSlot

use of net.minecraft.network.protocol.game.PacketPlayInSetCreativeSlot in project Panilla by ds58.

the class PacketInspector method checkPacketPlayInSetCreativeSlot.

@Override
public void checkPacketPlayInSetCreativeSlot(Object _packet) throws NbtNotPermittedException {
    if (_packet instanceof PacketPlayInSetCreativeSlot) {
        PacketPlayInSetCreativeSlot packet = (PacketPlayInSetCreativeSlot) _packet;
        int slot = packet.b();
        ItemStack itemStack = packet.c();
        if (itemStack == null || !itemStack.s())
            return;
        NbtTagCompound tag = new NbtTagCompound(itemStack.t());
        String itemClass = itemStack.c().getClass().getSimpleName();
        String packetClass = packet.getClass().getSimpleName();
        NbtChecks.checkPacketPlayIn(slot, tag, itemClass, packetClass, panilla);
    }
}
Also used : NbtTagCompound(com.ruinscraft.panilla.craftbukkit.v1_18_R2.nbt.NbtTagCompound) INbtTagCompound(com.ruinscraft.panilla.api.nbt.INbtTagCompound) PacketPlayInSetCreativeSlot(net.minecraft.network.protocol.game.PacketPlayInSetCreativeSlot) ItemStack(net.minecraft.world.item.ItemStack)

Aggregations

INbtTagCompound (com.ruinscraft.panilla.api.nbt.INbtTagCompound)3 PacketPlayInSetCreativeSlot (net.minecraft.network.protocol.game.PacketPlayInSetCreativeSlot)3 ItemStack (net.minecraft.world.item.ItemStack)3 NbtTagCompound (com.ruinscraft.panilla.craftbukkit.v1_17_R1.nbt.NbtTagCompound)1 NbtTagCompound (com.ruinscraft.panilla.craftbukkit.v1_18_R1.nbt.NbtTagCompound)1 NbtTagCompound (com.ruinscraft.panilla.craftbukkit.v1_18_R2.nbt.NbtTagCompound)1