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 TypeMethodDescriptionvoidattemptStart(UUID uuid, int surveyId, Consumer<StartResult> result) Attempts to start a survey for the target player.voidcancelSession(UUID uuid) Cancel a players survey session.voidCancels all sessions that are currently being executed.voidcancelSessions(int surveyId) Cancels the session of a particular survey.voidhandleResponse(UUID uuid, String response) Handles the response.booleanhasSession(UUID uuid) Check if the uuid has a survey session.voidshowQuestion(UUID uuid) Show the current question to the user.voidstartSession(UUID uuid, int surveyId, boolean previewMode) Will grab the survey async and attempt to start a session.voidstartSession(UUID uuid, int surveyId, boolean previewMode, Consumer<StartResult> result) Will grab the survey async and attempt to start a session.
-
Method Details
-
attemptStart
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. UsestartSession(UUID, int, boolean, Consumer)to override this.- Parameters:
uuid-surveyId-
-
startSession
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 playersurveyId- The target surveypreviewMode- If false no answers will be saved
-
startSession
Will grab the survey async and attempt to start a session. UsestartSession(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 playersurveyId- The target surveypreviewMode- If false no answers will be saved
-
hasSession
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
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 playerresponse- The response of the player
-
showQuestion
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
Cancel a players survey session.- Parameters:
uuid- The UUID of the target player
-