Class Request


  • public final class Request
    extends Object
    An incoming packet from the Crowd Control TCP server which represents an effect to be played.
    See Also:
    Response
    • Method Detail

      • fromJSON

        @NotNull
        @CheckReturnValue
        public static @NotNull Request fromJSON​(@NotNull
                                                @NotNull String json)
                                         throws com.google.gson.JsonSyntaxException
        Creates a Request object from JSON.
        Parameters:
        json - input json data from the Crowd Control TCP server
        Returns:
        a new Request object
        Throws:
        com.google.gson.JsonSyntaxException - the JSON failed to be parsed
      • getId

        @CheckReturnValue
        public int getId()
        Gets the ID of the incoming packet. Corresponds to a unique transaction.
        Returns:
        packet ID
      • getMessage

        public String getMessage()
        Gets the message from the incoming packet.
        Returns:
        message
      • getEffect

        @NotNull
        @CheckReturnValue
        public @NotNull String getEffect()
        Gets the name of the effect to play.
        Returns:
        effect name
      • getParameters

        @NotNull
        @CheckReturnValue
        public @NotNull Object[] getParameters()
        Gets the arguments supplied by the C# Crowd Control pack
        Returns:
        effect parameters
      • getViewer

        @NotNull
        @CheckReturnValue
        public @NotNull String getViewer()
        Gets the name of the viewer who triggered the effect.
        Returns:
        viewer name
      • getCost

        @Nullable
        @CheckReturnValue
        public @Nullable Integer getCost()
        Gets the cost of the effect specified in this Request.
        Returns:
        effect cost
      • getType

        @NotNull
        @CheckReturnValue
        public @NotNull Request.Type getType()
        Gets the Type of the request.
        Returns:
        request type
      • getTargets

        public Request.Target @NotNull [] getTargets()
        Gets the streamers being targeted by this effect. An empty array suggests that all players may be targeted.
        Returns:
        possibly empty array of Request.Target
      • isGlobal

        public boolean isGlobal()
        Determines if this Request is triggering an effect for all users.
        Returns:
        if the triggered effect is global