Interface ISurveySessionManager


public interface ISurveySessionManager
This manager class manages all survey sessions. This includes keeping track of all sessions, handling responses and finishing surveys when they have been completed. This class can be used to start, cancel and proceed surveys.
Since:
2.7.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    attemptStart(UUID uuid, int surveyId, Consumer<StartResult> result)
    Attempts to start a survey for the target player.
    void
    Cancel a players survey session.
    void
    Cancels all sessions that are currently being executed.
    void
    cancelSessions(int surveyId)
    Cancels the session of a particular survey.
    void
    handleResponse(UUID uuid, String response)
    Handles the response.
    boolean
    Check if the uuid has a survey session.
    void
    Show the current question to the user.
    void
    startSession(UUID uuid, int surveyId, boolean previewMode)
    Will grab the survey async and attempt to start a session.
    void
    startSession(UUID uuid, int surveyId, boolean previewMode, Consumer<StartResult> result)
    Will grab the survey async and attempt to start a session.
  • Method Details

    • attemptStart

      void attemptStart(UUID uuid, int surveyId, Consumer<StartResult> result)
      Attempts to start a survey for the target player. If the player already has a survey, or has no permission to start the survey the survey will not be started If the survey is NOT available or featured the survey will not be started. Use startSession(UUID, int, boolean, Consumer) to override this.
      Parameters:
      uuid -
      surveyId -
    • startSession

      void startSession(UUID uuid, int surveyId, boolean previewMode, Consumer<StartResult> result)
      Will grab the survey async and attempt to start a session. Currently there is no way to know if this actually started a session. If a survey has been completed already no new session will be made. If a survey session is currently going on the old one will be discarded.
      Parameters:
      uuid - The target player
      surveyId - The target survey
      previewMode - If false no answers will be saved
    • startSession

      void startSession(UUID uuid, int surveyId, boolean previewMode)
      Will grab the survey async and attempt to start a session. Use startSession(UUID, int, boolean, Consumer) )} if you want to know the result of the starting. If a survey has been completed already no new session will be made. If a survey session is currently going on the old one will be discarded.
      Parameters:
      uuid - The target player
      surveyId - The target survey
      previewMode - If false no answers will be saved
    • hasSession

      boolean hasSession(UUID uuid)
      Check if the uuid has a survey session.
      Parameters:
      uuid - The player UUID
      Returns:
      True if the user has a session.
    • cancelSessions

      void cancelSessions(int surveyId)
      Cancels the session of a particular survey. This might be used if changes are detected using the plugin channel.
      Parameters:
      surveyId - The survey ID
    • cancelSessions

      void cancelSessions()
      Cancels all sessions that are currently being executed. Used when reloading the plugin.
    • handleResponse

      void handleResponse(UUID uuid, String response)
      Handles the response. Certain strings have been reserved since they fulfil a functional purpose. These are: - 'NEXT_QUESTION' -> Triggers the next question in a select multiple
      Parameters:
      uuid - The UUID of the player
      response - The response of the player
    • showQuestion

      void showQuestion(UUID uuid)
      Show the current question to the user. Make sure the user HAS a session before using.
      Parameters:
      uuid - The UUID of the target player
    • cancelSession

      void cancelSession(UUID uuid)
      Cancel a players survey session.
      Parameters:
      uuid - The UUID of the target player