1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-29 04:18:07 +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.Signs.SignUtil;
import com.gamingmesh.jobs.api.JobsExpGainEvent;
import com.gamingmesh.jobs.api.JobsPaymentEvent;
import com.gamingmesh.jobs.commands.JobsCommands;
import com.gamingmesh.jobs.config.BossBarManager;
import com.gamingmesh.jobs.config.ConfigManager;
@ -751,7 +750,7 @@ public class Jobs {
}
if (amount == 0D && pointAmount == 0D)
return;
Jobs.getEconomy().pay(jPlayer, amount, pointAmount, 0.0);
if (Jobs.getGCManager().LoggingUse)
@ -882,7 +881,7 @@ public class Jobs {
Loging.recordToLog(jPlayer, info, amount, expAmount);
// JobsPayment event
JobsExpGainEvent JobsExpGainEvent = new JobsExpGainEvent(jPlayer.getPlayer(), expAmount);
JobsExpGainEvent JobsExpGainEvent = new JobsExpGainEvent(jPlayer.getPlayer(), prog.getJob(), expAmount);
Bukkit.getServer().getPluginManager().callEvent(JobsExpGainEvent);
// If event is canceled, don't do anything
if (JobsExpGainEvent.isCancelled())

View File

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

View File

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