public class PacketUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
NMS_PREFIX |
Constructor and Description |
---|
PacketUtils() |
Modifier and Type | Method and Description |
---|---|
static Object |
getDedicatedServer()
Get NMS server
|
static Object |
getEntityPlayer(org.bukkit.entity.Player p)
Get NMS entity player of specified one
|
static Class<?> |
getNmsClass(String name)
Get the Class in NMS, with a processing reducer
|
static Class<?> |
getNmsClass(String name,
String packagePrefix)
Get the Class in NMS, with a processing reducer
|
static Class<?> |
getObcClass(String name)
Get the Class in NMS, with a processing reducer
|
static Object |
getWorldServer(org.bukkit.Location loc)
Get the NMS world server
|
static void |
sendPacket(org.bukkit.entity.Player p,
Object packet)
Send the packet to the specified player
|
static void |
sendPacket(org.bukkit.entity.Player p,
String packetName,
Class<?> type,
Object data)
Create and send a packet (with only one parameter)
|
public static final String NMS_PREFIX
public static Class<?> getNmsClass(String name)
name
- of the NMS class (in net.minecraft.server package ONLY, because it's NMS)public static Class<?> getNmsClass(String name, String packagePrefix)
name
- of the NMS class (in net.minecraft.server package ONLY, because it's NMS)packagePrefix
- the prefix of the package for 1.17+public static Class<?> getObcClass(String name)
name
- of the OBC class (in org.bukkit.craftbukkit.version. package ONLY, because it's OBC)public static void sendPacket(org.bukkit.entity.Player p, String packetName, Class<?> type, Object data)
p
- the player which will receive the packetpacketName
- the name of the packet that will be created and senttype
- the constructor type of parameterdata
- the data associated with parameter typepublic static void sendPacket(org.bukkit.entity.Player p, Object packet)
p
- which will receive the packetpacket
- the packet to sentpublic static Object getEntityPlayer(org.bukkit.entity.Player p)
p
- the player that we want the NMS entity playerpublic static Object getDedicatedServer()
public static Object getWorldServer(org.bukkit.Location loc)
loc
- the location in the world of which we want to get the NMS world server