1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-29 04:18:07 +01:00

Merge pull request #1725 from FireML/fix-event

Fix NPEs for JobsExpGainEvent
This commit is contained in:
Zrips 2024-04-15 12:46:41 +03:00 committed by GitHub
commit abd04d9653
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 9 deletions

View File

@ -1453,7 +1453,8 @@ public final class Jobs extends JavaPlugin {
payment.set(CurrencyType.MONEY, jobsPrePaymentEvent.getAmount());
payment.set(CurrencyType.POINTS, jobsPrePaymentEvent.getPoints());
JobsExpGainEvent jobsExpGainEvent = new JobsExpGainEvent(payment.getOfflinePlayer(), job, expPayment);
JobsExpGainEvent jobsExpGainEvent = new JobsExpGainEvent(payment.getOfflinePlayer(), job, expPayment,
block, ent, victim, info);
Bukkit.getServer().getPluginManager().callEvent(jobsExpGainEvent);
// If event is canceled, don't do anything
if (jobsExpGainEvent.isCancelled())

View File

@ -24,16 +24,11 @@ public final class JobsExpGainEvent extends BaseEvent implements Cancellable {
private boolean cancelled = false;
public JobsExpGainEvent(OfflinePlayer offlinePlayer, Job job, double exp) {
this.offlinePlayer = offlinePlayer;
this.job = job;
this.exp = exp;
}
public JobsExpGainEvent(OfflinePlayer offlinePlayer, Job job, double exp, Block block,
Entity entity, LivingEntity living, ActionInfo info) {
this(offlinePlayer, job, exp);
this.offlinePlayer = offlinePlayer;
this.job = job;
this.exp = exp;
this.block = block;
this.entity = entity;
this.living = living;