Skip to content

PacketsUtils

Fulminazzo edited this page Oct 2, 2023 · 1 revision

PacketsUtils is a group of functions to send packets to the player using NMS. Many of these should not worry you, and you should only focus on the sendPacket function. However, they might be helpful, so we will explain every one of them:

  • getEntityPlayer(Object player): returns a ReflObject containing the equivalent of ((CraftPlayer) player).getHandle();
  • getPlayerConnection(Object player): returns a ReflObject containing the field of ((EntityPlayer) player) of type PlayerConnection;
  • getWorldConnection(World world): returns a ReflObject containing the equivalent of ((CraftWorld) world).getHandle();
  • sendPacket(Object player, ReflObject<?> packet): sends a packet encapsulated in a ReflObject using the getPlayerConnection() method.

Clone this wiki locally