Sample Packets

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!


Active Member
Mar 15, 2022
Dependencies: skript-reflect

Firstly, it is a remake of PacketListenerNMSK by TPGamesNL which works on versions 1.8 to 1.19.4.

What does this script include:
- In, out packet listener
- auto-detection available packets
- auto-detection of packet constructors
- auto-detection of packet decoders
- stuff to create packets and decrypt them
- method to send packets to players

API syntax:

event: packet event
fired when packet received or sended
on packet [%packet name%]:
  [event-]packet #what packet sended\received
  [event-]player #who sended\to whom it was sent

effect: send packet
sends packets to specified players
send packet %packets% to %players%

function: create empty buffer
returns an empty buffer to create the packet

functions: write data to the buffer
write specific type to buffer
writeBoolean(%boolean%, %buffer%)
writeByte(%number%, %buffer%)
writeShort(%number%, %buffer%)
writeFloat(%number%, %buffer%)
writeDouble(%number%, %buffer%)
writeInt(%number%, %buffer%)
writeLong(%number%, %buffer%)
writePosition(%x number%,%y number%,%z number%,%buffer%)
writeVarInt(%number%, %buffer%)
writeVarLong(%number%, %buffer%)
writeString(%text%, %buffer%)
writeUUID(%uuid object or string%, %buffer%)
writeAngle(%number%, %buffer%)

functions: read data from the buffer
read specified type from buffer and return it
readBoolean(%buffer%) :: boolean
readByte(%buffer%) :: number
readShort(%buffer%) :: number
readFloat(%buffer%) :: number
readDouble(%buffer%) :: number
readInt(%buffer%) :: number
readLong(%buffer%) :: number
readPosition(%buffer%) :: numbers list of 3
readVarInt(%buffer%) :: number
readVarLong(%buffer%) :: number
readString(%buffer%) :: text
readUUID(%buffer%) :: uuid_object
readAngle(%buffer%) :: number

function: create packet
creates and returns packet by simplied class name with data from the buffer, buffer data defined at WIKI.VG
createPacket(%packet name%,%buffer%) :: %packet%

function: get packet name by protocol
returns packet simplied name by its STATE, BOUND and ID, defined at WIKI.VG
getWrappedPacketNameByProtocol(%number id%,%text state%,%text bound%) :: text:

function: decode packet
returns buffer of received or sended packet (created packet)
decodePacket(%packet%) :: buffer:

Also its include some ready to use packets what has less differences on different versions, such as:
- PacketPlayOutEntityDestroy
- PacketPlayOutCamera
- PacketPlayOutEntityTeleport
- PacketPlayOutOpenSignEditor
- PacketPlayOutPosition
- PacketPlayOutUpdateHealth
- PacketPlayOutBlockBreakAnimation
- PacketPlayOutAnimation
- PacketPlayOutEntityHeadRotation
- PacketPlayOutEntityLook

The list will be updated in future updates.

How to create packet if not included?
1. Go to this site and select your core version
2. Find the required packet, find its id (in decimal), state and bound.
3. Get wrapped packet name with function getWrappedPacketNameByProtocol(...)
4. Create EmptyBuffer and fill it with data
5. Create packet with function CreatePacket(...)

Example, I need this packet:
I converted id to decimal, I know which State and Bound. Now I can get the packet name with function - it's PacketPlayOutCamera.
function PacketPlayOutCamera(id: number) :: object:
  set {_buffer} to EmptyBuffer()
  return createPacket("PacketPlayOutCamera",{_buffer})

I populated a buffer based on information from the site, created a packet, and wrapped it all in a function to call it in the future. Now putting the number of the entity into the function - I can create a packet and send it to any player.