Package me.fami6xx.rpuniverse.core.jobs
Class JobsHandler
java.lang.Object
me.fami6xx.rpuniverse.core.jobs.JobsHandler
- All Implemented Interfaces:
org.bukkit.event.Listener
The JobsHandler is the main class for handling the jobs.
It is responsible for loading the jobs, saving the jobs, and handling the jobs handler.
The JobsHandler is a singleton class, so only one instance of it should be created.
The JobsHandler is also a listener for the PlayerJoinEvent. This means that the JobsHandler will also listen for the PlayerJoinEvent and update the jobs accordingly.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a jobvoidaddJobType(JobType jobType)Adds a JobType to the list of job types.getJobByName(String name)Get a job by its namegetJobByUUID(String uuid)Get a job by its UUIDgetJobs()Get the jobsgetJobTypeByName(String name)Get a job type by its nameGet the job typesvoidonPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event)voidvoidvoidvoidvoidRemove a jobvoidshutdown()Shutdown the JobsHandler.
-
Constructor Details
-
JobsHandler
public JobsHandler()Constructor for the JobsHandler. Initializes the jobs and job types. Also loads all the jobs.
-
-
Method Details
-
shutdown
public void shutdown()Shutdown the JobsHandler. Saves all the jobs. -
getJobByName
Get a job by its name- Parameters:
name- The name of the job- Returns:
- The job
-
getJobTypeByName
Get a job type by its name- Parameters:
name- The name of the job type- Returns:
- The job type
-
removeJob
Remove a job- Parameters:
job- The job to remove
-
getJobs
Get the jobs- Returns:
- The jobs
-
getJobTypes
Get the job types- Returns:
- The job types
-
addJob
Add a job- Parameters:
job- The job to add
-
addJobType
Adds a JobType to the list of job types.It is crucial that the JobType is added to the list of job types in your onEnable method, because when the server loads then jobs are loaded, and they need their JobTypes to be ready as soon as possible.
- Parameters:
jobType- the JobType to be added to the list of job types.
-
getJobByUUID
Get a job by its UUID- Parameters:
uuid- The UUID of the job- Returns:
- The job
-
onPlayerJoin
public void onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event) -
onWorkingStepLocationAdded
-
onSellStepLocationAdded
-
onWorkingStepLocationRemoved
-
onSellStepLocationRemoved
-