Class BukkitUnwrapper

java.lang.Object
com.comphenix.protocol.injector.BukkitUnwrapper
All Implemented Interfaces:
PacketConstructor.Unwrapper

public class BukkitUnwrapper extends Object implements PacketConstructor.Unwrapper
Represents an object capable of converting wrapped Bukkit objects into NMS objects.

Typical conversions include:

  • org.bukkit.entity.Player to net.minecraft.server.EntityPlayer
  • org.bukkit.World to net.minecraft.server.WorldServer
  • Field Details

    • REPORT_ILLEGAL_ARGUMENT

      public static final ReportType REPORT_ILLEGAL_ARGUMENT
    • REPORT_SECURITY_LIMITATION

      public static final ReportType REPORT_SECURITY_LIMITATION
    • REPORT_CANNOT_FIND_UNWRAP_METHOD

      public static final ReportType REPORT_CANNOT_FIND_UNWRAP_METHOD
    • REPORT_CANNOT_READ_FIELD_HANDLE

      public static final ReportType REPORT_CANNOT_READ_FIELD_HANDLE
  • Constructor Details

    • BukkitUnwrapper

      public BukkitUnwrapper()
      Construct a new Bukkit unwrapper with ProtocolLib's default error reporter.
    • BukkitUnwrapper

      public BukkitUnwrapper(ErrorReporter reporter)
      Construct a new Bukkit unwrapper with the given error reporter.
      Parameters:
      reporter - - the error reporter to use.
  • Method Details

    • getInstance

      public static BukkitUnwrapper getInstance()
      Retrieve the default instance of the Bukkit unwrapper.
      Returns:
      The default instance.
    • unwrapItem

      public Object unwrapItem(Object wrappedObject)
      Description copied from interface: PacketConstructor.Unwrapper
      Convert the given wrapped object to the equivalent net.minecraft.server object.

      Note that we may pass in a class instead of object - in that case, the unwrapper should return the equivalent NMS class.

      Specified by:
      unwrapItem in interface PacketConstructor.Unwrapper
      Parameters:
      wrappedObject - - wrapped object or class.
      Returns:
      The equivalent net.minecraft.server object or class.