-
Notifications
You must be signed in to change notification settings - Fork 3
How To Proxy
Creating NMS proxy classes is very simple, its just a matter of creating an interface with the right annotations and NMSPoxy will handle the rest. NMSProxy supports any class but is especially good at NMS & CraftBukkit/Spigot classes.
To start you will need an interface that extends NMSProxy and is annotated with @NMSClass. This is the marker to a
valid proxy class and tells the api the class type we will be proxying. When proxying NMS (NMSClass.Type.NMS) and
CraftBukkit/Spigot (NMSClass.Type.CRAFTBUKKIT) classes the api will automatically prefix the correct versioned package
to the provided class name to save you time. If implimenting something outside these bounds, you can insert %version
into the class name and it will be replaced with the nms version identifier used in many places in the bukkit ecosystem.
Next up is specifying methods and fields.
@NMSClass(type = NMSClass.Type.CRAFTBUKKIT, className = "entity.CraftPlayer")
public class NMSCraftPlayer implements NMSProxy {
@NMSMethod
NMSEntityPlayer getHandle();
}@NMSClass(type = NMSClass.Type.NMS, className = "EntityPlayer")
public class NMSEntityPlayer implements NMSProxy {
@NMSField(type = NMSField.Type.GETTER)
NMSPlayerConnection playerConnection();
@NMSMethod
GameProfile getProfile();
}