What is a "Handle" in NMS / ProtocolLib?

Discussion in 'Spigot Plugin Development' started by victor2748, May 14, 2015.

  1. I recently faced this issue when trying to send a block to a player via ProtocolLib: I need to construct an instance of WrappedBlockData class.

    WrappedBlockData class has only one constructor:

    Code (Text):
    public WrappedBlockData(Object handle) {}
    What is a handle in NMS and ProtocolLib?

    I very oftenly heard the term "handle" when dealing with NMS or ProtocolLib, but did not find any definition. Can you please explain what is a "handle", what does it do, and preferably, an example of what should I pass as a parameter in this situation.

    Thank you,

    Victor
     
  2. If you wrap an object, getHandle() returns the wrapped object.
     
  3. @victor2748 it's the nms object the wrapper wraps.