Class RetrieverType<T>

java.lang.Object
xyz.gmitch215.socketmc.retriever.RetrieverType<T>
Type Parameters:
T - The type of the retriever
All Implemented Interfaces:
Serializable

public final class RetrieverType<T> extends Object implements Serializable

Represents a type of retriever. They are used to retrieve data from the client. Any data element can be null.

Example:


 SocketPlayer sp = ...
 SocketRetriever retriever = sp.getRetriever();

 // Enum Retriever Type
 RetrieverType<Window> window = RetriverType.WINDOW;

 // Params: RetrieverType<T>, Consumer<T>
 retriever.request(window, w -> {
     // Check if null
     if (w == null) return;

     // Retrieved window object is passed to consumer
     int x = w.getHeight();
 }
 
See Also:
  • Field Details

    • CURRENT_WINDOW

      public static final RetrieverType<Window> CURRENT_WINDOW
      A retriever for the client's window information.
    • OPERATING_SYSTEM

      public static final RetrieverType<OS> OPERATING_SYSTEM
      A retriever for the client's operating system information.
    • PAUSED

      public static final RetrieverType<Boolean> PAUSED
      A retriever for whether the client's game is paused.
    • FPS

      public static final RetrieverType<Integer> FPS
      A retriever for the client's frames per second.
    • GPU_UTILIZATION

      public static final RetrieverType<Double> GPU_UTILIZATION
      A retriever for the client's percentage of GPU usage, between 0.0 to 1.0.
    • LAUNCH_VERSION

      public static final RetrieverType<String> LAUNCH_VERSION
      A retriever for the client's launched version.
    • VERSION_TYPE

      public static final RetrieverType<String> VERSION_TYPE
      A retriever for the client's current version.
    • LAST_INPUT_TYPE

      public static final RetrieverType<InputType> LAST_INPUT_TYPE
      A retriever for the client's last input type.
    • AVAILABLE_PROCESSORS

      public static final RetrieverType<Integer> AVAILABLE_PROCESSORS
      A retriever for the client's available processors on its JVM.
    • PLUGIN_PERMISSIONS

      public static final RetrieverType<Map<SocketPlugin,Set<ModPermission>>> PLUGIN_PERMISSIONS
      A retriever for the permissions the client has for each plugin.
    • FREE_MEMORY

      public static final RetrieverType<Long> FREE_MEMORY
      A retriever for the client's free memory on its JVM.
    • TOTAL_MEMORY

      public static final RetrieverType<Long> TOTAL_MEMORY
      A retriever for the client's total memory on its JVM.
    • MAX_MEMORY

      public static final RetrieverType<Long> MAX_MEMORY
      A retriever for the client's maximum memory on its JVM.
    • COMMAND_HISTORY

      public static final RetrieverType<String[]> COMMAND_HISTORY
      A retriever for the client's command history.
    • HIDDEN_PLAYERS

      public static final RetrieverType<UUID[]> HIDDEN_PLAYERS
      A retriever for the client's hidden players on their social interaction screen.
  • Method Details

    • getId

      @NotNull public @NotNull String getId()
      Gets the ID of the retriever.
      Returns:
      The ID of the retriever
    • getType

      @NotNull public @NotNull Class<T> getType()
      Gets the type of the retriever.
      Returns:
      The type of the retriever
    • getPermission

      @NotNull public @NotNull ModPermission getPermission()
      Gets the permission required to use this retriever.
      Returns:
      Retriever Permission
    • equals

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

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

      @NotNull public static @NotNull ModPermission getPermission(@NotNull @NotNull String id)
      Gets the permission required to use a retriever by its ID.
      Parameters:
      id - Retriever Type ID
      Returns:
      Retriever Permission
    • toByteArray

      public byte[] toByteArray()
      Converts the retriever type to a byte array.
      Returns:
      Byte Array Representation
    • fromByteArray

      @NotNull public static @NotNull RetrieverType<?> fromByteArray(byte[] bytes)
      Converts a byte array to a retriever type.
      Parameters:
      bytes - The byte array to convert
      Returns:
      The retriever type
    • values

      @NotNull public static <T> @NotNull RetrieverType<T>[] values(@NotNull @NotNull Class<T> type)
      Gets all the retriever types of a specific type.
      Type Parameters:
      T - The type of the retriever
      Parameters:
      type - The type of the retriever
      Returns:
      All Retriever Types of the specified type
    • values

      @NotNull public static @NotNull RetrieverType<?>[] values()
      Gets all the retriever types.
      Returns:
      All Retriever Types