1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-03 14:58:34 +01:00

Include job in expGain event

This commit is contained in:
Zrips 2016-04-03 20:36:39 +03:00
parent c7875d9b4c
commit e394f045db
3 changed files with 12 additions and 5 deletions

View File

@ -33,7 +33,6 @@ import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Gui.GuiManager; import com.gamingmesh.jobs.Gui.GuiManager;
import com.gamingmesh.jobs.Signs.SignUtil; import com.gamingmesh.jobs.Signs.SignUtil;
import com.gamingmesh.jobs.api.JobsExpGainEvent; import com.gamingmesh.jobs.api.JobsExpGainEvent;
import com.gamingmesh.jobs.api.JobsPaymentEvent;
import com.gamingmesh.jobs.commands.JobsCommands; import com.gamingmesh.jobs.commands.JobsCommands;
import com.gamingmesh.jobs.config.BossBarManager; import com.gamingmesh.jobs.config.BossBarManager;
import com.gamingmesh.jobs.config.ConfigManager; import com.gamingmesh.jobs.config.ConfigManager;
@ -882,7 +881,7 @@ public class Jobs {
Loging.recordToLog(jPlayer, info, amount, expAmount); Loging.recordToLog(jPlayer, info, amount, expAmount);
// JobsPayment event // JobsPayment event
JobsExpGainEvent JobsExpGainEvent = new JobsExpGainEvent(jPlayer.getPlayer(), expAmount); JobsExpGainEvent JobsExpGainEvent = new JobsExpGainEvent(jPlayer.getPlayer(), prog.getJob(), expAmount);
Bukkit.getServer().getPluginManager().callEvent(JobsExpGainEvent); Bukkit.getServer().getPluginManager().callEvent(JobsExpGainEvent);
// If event is canceled, don't do anything // If event is canceled, don't do anything
if (JobsExpGainEvent.isCancelled()) if (JobsExpGainEvent.isCancelled())

View File

@ -5,14 +5,18 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import com.gamingmesh.jobs.container.Job;
public final class JobsExpGainEvent extends Event implements Cancellable { public final class JobsExpGainEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private OfflinePlayer offlinePlayer; private OfflinePlayer offlinePlayer;
private double exp; private double exp;
private Job job;
private boolean cancelled; private boolean cancelled;
public JobsExpGainEvent(OfflinePlayer offlinePlayer, double exp) { public JobsExpGainEvent(OfflinePlayer offlinePlayer, Job job, double exp) {
this.offlinePlayer = offlinePlayer; this.offlinePlayer = offlinePlayer;
this.job = job;
this.exp = exp; this.exp = exp;
} }
@ -20,6 +24,10 @@ public final class JobsExpGainEvent extends Event implements Cancellable {
return this.offlinePlayer; return this.offlinePlayer;
} }
public Job getJob() {
return this.job;
}
public double getExp() { public double getExp() {
return this.exp; return this.exp;
} }

View File

@ -1,7 +1,7 @@
name: Jobs name: Jobs
description: Jobs Plugin for the BukkitAPI description: Jobs Plugin for the BukkitAPI
main: com.gamingmesh.jobs.JobsPlugin main: com.gamingmesh.jobs.JobsPlugin
version: 3.1.2 version: 3.1.3
author: phrstbrn author: phrstbrn
softdepend: [Vault, CoreProtect, MythicMobs, McMMO] softdepend: [Vault, CoreProtect, MythicMobs, McMMO]
commands: commands: