Class AbstractWrapper

java.lang.Object
com.comphenix.protocol.wrappers.AbstractWrapper
Direct Known Subclasses:
IdCodecWrapper, IdCodecWrapper.Entry, LegacyDataWatcher, LegacyServerPing, ProtocolInfoWrapper, WrappedAttribute, WrappedAttributeModifier, WrappedBlockData, WrappedChatComponent, WrappedCodec, WrappedComponentStyle, WrappedDataResult, WrappedDataValue, WrappedDataWatcher.Serializer, WrappedDynamicOps, WrappedEnumEntityUseAction, WrappedGameProfile, WrappedIntHashMap, WrappedLevelChunkData.BlockEntityInfo, WrappedLevelChunkData.ChunkData, WrappedLevelChunkData.LightData, WrappedMessageSignature, WrappedNumberFormat, WrappedProfilePublicKey, WrappedProfilePublicKey.WrappedProfileKeyData, WrappedRegistrable, WrappedRemoteChatSessionData, WrappedSaltedSignature, WrappedSignedProperty, WrappedStatistic, WrappedStreamCodec, WrappedTeamParameters, WrappedVillagerData, WrappedWatchableObject

public abstract class AbstractWrapper extends Object
Represents a wrapper for an NMS object.
  • Field Details

    • handle

      protected Object handle
    • handleType

      protected Class<?> handleType
  • Constructor Details

    • AbstractWrapper

      public AbstractWrapper(Class<?> handleType)
      Construct a new NMS wrapper.
      Parameters:
      handleType - - the NMS handle type.
  • Method Details

    • setHandle

      protected void setHandle(Object handle)
      Set the underlying NMS object.
      Parameters:
      handle - - the NMS object.
      Throws:
      IllegalArgumentException - If the handle is NULL.
      IllegalArgumentException - If the handle is not assignable to getHandleType().
    • getHandle

      public Object getHandle()
      Retrieves the underlying NMS object.
      Returns:
      The underlying NMS object.
    • getHandleType

      public Class<?> getHandleType()
      Retrieve the type of the handle.
      Returns:
      The type of the handle.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object