Class JobsHandler

java.lang.Object
me.fami6xx.rpuniverse.core.jobs.JobsHandler
All Implemented Interfaces:
org.bukkit.event.Listener

public class JobsHandler extends Object implements 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 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

      public Job getJobByName(String name)
      Get a job by its name
      Parameters:
      name - The name of the job
      Returns:
      The job
    • getJobTypeByName

      public JobType getJobTypeByName(String name)
      Get a job type by its name
      Parameters:
      name - The name of the job type
      Returns:
      The job type
    • removeJob

      public void removeJob(Job job)
      Remove a job
      Parameters:
      job - The job to remove
    • getJobs

      public List<Job> getJobs()
      Get the jobs
      Returns:
      The jobs
    • getJobTypes

      public List<JobType> getJobTypes()
      Get the job types
      Returns:
      The job types
    • addJob

      public void addJob(Job job)
      Add a job
      Parameters:
      job - The job to add
    • addJobType

      public void addJobType(JobType jobType)
      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

      public Job getJobByUUID(String uuid)
      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

      public void onWorkingStepLocationAdded(WorkingStepLocationAddedEvent event)
    • onSellStepLocationAdded

      public void onSellStepLocationAdded(SellStepLocationAddedEvent event)
    • onWorkingStepLocationRemoved

      public void onWorkingStepLocationRemoved(WorkingStepLocationRemovedEvent event)
    • onSellStepLocationRemoved

      public void onSellStepLocationRemoved(SellStepLocationRemovedEvent event)