Skip to content
montlikadani edited this page Dec 1, 2020 · 9 revisions

Events

JobsAreaSelectionEvent

The event is called when selected an area with the specified item.

Example

@EventHandler
public void onJobsAreaSelection(JobsAreaSelectionEvent event) {
    event.getPlayer().sendMessage("You have successfully selected the area in high and low location: " + event.getArea().getHighLoc() + " " + event.getArea().getLowLoc());
}

JobsChunkChangeEvent

The event is called when the chunk has changed.

Example

@EventHandler
public void onJobsChunkChange(JobsChunkChangeEvent event) {
    event.getPlayer().sendMessage("The new chunk is: " + event.getNewChunk());
}

JobsExpGainEvent

The event is called when a player gain exp from job.

Example

@EventHandler
public void onJobsExpGain(JobsExpGainEvent event) {
    event.getPlayer().sendMessage("You got " + event.getExp() + " amount exp in job " + event.getJob().getName());
}

JobsJoinEvent

The event is called when a player join to a specified job.

Example

@EventHandler
public void onJobsJoin(JobsJoinEvent event) {
    event.getPlayer().getPlayer().sendMessage("You have successfully joined to " + event.getJob().getName() + " job!");
}

JobsLeaveEvent

The event is called when a player left from a specified job.

Example

@EventHandler
public void onJobsLeave(JobsLeaveEvent event) {
    event.getPlayer().getPlayer().sendMessage("You have successfully left from " + event.getJob().getName() + " job!");
}

JobsLevelUpEvent

The event is called when a player leveled up in that job.

Example

@EventHandler
public void onJobsLevelUp(JobsLevelUpEvent event) {
    event.getPlayer().getPlayer().sendMessage("You have successfully leveled up in " + event.getJobName() + " job!");
}

JobsPaymentEvent

The event is called when calculating the payment.

Example

@EventHandler
public void onJobsPayment(JobsPaymentEvent event) {
    event.getPlayer().sendMessage("You got " + event.getAmount() + " money!");
}

JobsPrePaymentEvent

Event fired, before the payment calculation process should beginning.

Example

@EventHandler
public void onJobsPrePayment(JobsPrePaymentEvent e) {
    e.getPlayer().sendMessage("Payment event is cancelled in " + e.getJob().getName() + " job!");
    e.getPlayer().sendMessage("You not get any income for doing actions.");
    e.setCancelled(true);
}

JobsScheduleStartEvent

The event is called when started the schedule.

Example

@EventHandler
public void onJobsScheduleStart(JobsScheduleStartEvent ev) {
    if (e.getSchedule().isStarted()) {
        Bukkit.getLogger().log(Level.INFO, "The scheduler has started.");
    }
}

JobsScheduleStopEvent

The event is called when stopped the schedule.

Example

@EventHandler
public void onJobsScheduleStop(JobsScheduleStopEvent ev) {
    if (e.getSchedule().isStoped()) {
        Bukkit.getLogger().log(Level.INFO, "The scheduler has stopped.");
    }
}

Player information

To get players job information:

JobsPlayer jobsPlayer = Jobs.getPlayerManager().getJobsPlayer(player);

Then you can get things such as their log, left times, quests, total levels and more

To get players job list use:

List<JobProgression> jobs = Jobs.getPlayerManager().getJobsPlayer(player).getJobProgression();
for (JobProgression prog : jobs) {
  // Do your stuff here
}

Or this if player is offline:

List<JobProgression> jobs = Jobs.getPlayerManager().getJobsPlayerOffline(player).getJobProgression();
for (JobProgression prog : jobs) {
  // Do your stuff here
}

To get job list:

Jobs.getJobs();
Clone this wiki locally