Package dev.le_app.mcss_api_java
Class Task
java.lang.Object
dev.le_app.mcss_api_java.Task
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeName(String newName) Change the task namevoidDelete the task from the APIlongGet the interval information for the Task.getJob()getTime()Get the timing information for the Task.booleanbooleanbooleanCheck if the task repeats at the set interval/fixed timevoidrunTask()Manually run the taskvoidDisables the taskvoidEnables the taskvoidsetInterval(long newInterval) Change the interval of an Interval taskvoidsetPlayerRequirement(PlayerRequirement playerRequirement) voidsetRepeating(boolean repeat) Set the task to repeatvoid
-
Constructor Details
-
Task
protected Task(MCSSApi api, String GUID, String taskID, String taskName, boolean enabled) throws APIUnauthorizedException, IOException, APINotFoundException, APIInvalidTaskDetailsException, APINoServerAccessException
-
-
Method Details
-
getTaskID
- Returns:
- the Task ID
-
getTaskName
- Returns:
- the Task Name
-
getTaskType
- Returns:
- the Task Type
-
getTaskJobType
- Returns:
- the Task Job Type
-
getPlayerRequirement
- Returns:
- the Task Player Requirement
-
isEnabled
public boolean isEnabled()- Returns:
- the enabled status of the Task
-
isRepeating
public boolean isRepeating() throws APIUnauthorizedException, APINotFoundException, APIInvalidTaskDetailsException, IOException, APINoServerAccessExceptionCheck if the task repeats at the set interval/fixed time- Returns:
- true if the task repeats at the set interval/fixed time
- Throws:
APIUnauthorizedException- if the API key is invalidAPINotFoundException- if the server or task is not foundAPIInvalidTaskDetailsException- if the task has no timing informationIOException- if there is an error connecting to the serverAPINoServerAccessException
-
getTime
public LocalTime getTime() throws IOException, APIUnauthorizedException, APINotFoundException, APIInvalidTaskDetailsException, APINoServerAccessExceptionGet the timing information for the Task.- Returns:
- the timing information for the Task
- Throws:
IOException- if there is an error connecting to the serverAPIUnauthorizedException- if the API key is invalidAPINotFoundException- if the server or task is not foundAPIInvalidTaskDetailsException- if the task has no timing information, or if the task has an invalid timing informationAPINoServerAccessException
-
getInterval
public long getInterval() throws APIUnauthorizedException, APINotFoundException, APIInvalidTaskDetailsException, IOException, APINoServerAccessExceptionGet the interval information for the Task.- Returns:
- Long int of the interval in seconds
- Throws:
APIUnauthorizedException- if the API key is invalidAPINotFoundException- if the server or task is not foundAPIInvalidTaskDetailsException- if the task has no interval information, or if the task has an invalid interval informationIOException- if there is an error connecting to the serverAPINoServerAccessException
-
getJob
- Throws:
APINotFoundException
-
isDeleted
public boolean isDeleted()- Returns:
- true if the task has been deleted from the API
-
setEnabled
public void setEnabled() throws IOException, APINotFoundException, APIUnauthorizedException, APIInvalidTaskDetailsException, APINoServerAccessExceptionEnables the task- Throws:
IOException- if there is an error connecting to the serverAPINotFoundException- if the server returns a 404 response codeAPIUnauthorizedException- if the server returns a 401 response codeAPIInvalidTaskDetailsException- if the server returns a 409 response codeAPINoServerAccessException
-
setDisabled
public void setDisabled() throws IOException, APINotFoundException, APIUnauthorizedException, APIInvalidTaskDetailsException, APINoServerAccessExceptionDisables the task- Throws:
IOException- if there is an error connecting to the serverAPINotFoundException- if the server returns a 404 response codeAPIUnauthorizedException- if the server returns a 401 response codeAPIInvalidTaskDetailsException- if the server returns a 409 response codeAPINoServerAccessException
-
setInterval
public void setInterval(long newInterval) throws APIUnauthorizedException, APINotFoundException, APIInvalidTaskDetailsException, IOException, APINoServerAccessException Change the interval of an Interval task- Throws:
APIUnauthorizedException- if the API key is invalidAPINotFoundException- if the server or task is not foundAPIInvalidTaskDetailsException- if the task has no interval information, or if the task has an invalid interval informationIOException- if there is an error connecting to the serverAPINoServerAccessException
-
setTime
public void setTime(LocalTime newTime) throws APIUnauthorizedException, APINotFoundException, APIInvalidTaskDetailsException, IOException, APINoServerAccessException -
runTask
public void runTask() throws IOException, APINotFoundException, APIUnauthorizedException, APIInvalidTaskDetailsException, APINoServerAccessExceptionManually run the task- Throws:
IOException- if there is an error connecting to the serverAPINotFoundException- if the server returns a 404 response codeAPIUnauthorizedException- if the server returns a 401 response codeAPIInvalidTaskDetailsExceptionAPINoServerAccessException
-
setRepeating
public void setRepeating(boolean repeat) throws APIUnauthorizedException, APINotFoundException, APIInvalidTaskDetailsException, IOException, APINoServerAccessException Set the task to repeat- Parameters:
repeat- boolean of the new repeat value, true or false- Throws:
APIUnauthorizedException- if the API key is invalidAPINotFoundException- if the server or task is not foundAPIInvalidTaskDetailsException- if the task has no repeat information, or if the task has an invalid repeat informationIOException- if there is an error connecting to the serverAPINoServerAccessException
-
changeName
public void changeName(String newName) throws APIInvalidTaskDetailsException, APIUnauthorizedException, APINotFoundException, IOException, APINoServerAccessException Change the task name- Parameters:
newName- the new name for the task- Throws:
APIInvalidTaskDetailsException- if the server returns a 409 response codeAPIUnauthorizedException- if the server returns a 401 response codeAPINotFoundException- if the server returns a 404 response codeIOException- if there is an error connecting to the serverAPINoServerAccessException
-
setPlayerRequirement
public void setPlayerRequirement(PlayerRequirement playerRequirement) throws APIUnauthorizedException, APINotFoundException, APINoServerAccessException, APIInvalidTaskDetailsException, IOException -
deleteTask
public void deleteTask() throws IOException, APINotFoundException, APIUnauthorizedException, APINoServerAccessExceptionDelete the task from the API- Throws:
IOException- if there is an error connecting to the serverAPINotFoundException- if the server returns a 404 response codeAPIUnauthorizedException- if the server returns a 401 response codeAPINoServerAccessException
-