3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/Spigot-API-Patches/0041-Add-source-to-PlayerExpChangeEvent.patch

58 Zeilen
1.7 KiB
Diff

2017-08-12 23:32:01 +02:00
From f824a6c4c45b5005fe1929e7fbf39d9eaf025074 Mon Sep 17 00:00:00 2001
2016-12-01 00:31:46 +01:00
From: AlphaBlend <whizkid3000@hotmail.com>
Date: Thu, 8 Sep 2016 08:47:08 -0700
Subject: [PATCH] Add source to PlayerExpChangeEvent
diff --git a/src/main/java/org/bukkit/event/player/PlayerExpChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerExpChangeEvent.java
index f37491d7..30882559 100644
2016-12-01 00:31:46 +01:00
--- a/src/main/java/org/bukkit/event/player/PlayerExpChangeEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerExpChangeEvent.java
2017-08-12 23:32:01 +02:00
@@ -1,21 +1,43 @@
2016-12-01 00:31:46 +01:00
package org.bukkit.event.player;
+import org.bukkit.entity.Entity; // Paper
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
+import javax.annotation.Nullable; // Paper
+
/**
* Called when a players experience changes naturally
*/
public class PlayerExpChangeEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
+ // Paper start
+ @Nullable
+ private final Entity source;
private int exp;
public PlayerExpChangeEvent(final Player player, final int expAmount) {
+ this(player, null, expAmount);
+ }
+
+ public PlayerExpChangeEvent(final Player player, @Nullable final Entity sourceEntity, final int expAmount) {
super(player);
+ source = sourceEntity;
exp = expAmount;
}
2017-08-12 23:32:01 +02:00
/**
2016-12-01 00:31:46 +01:00
+ * Get the source that provided the experience.
+ *
+ * @return The source of the experience
+ */
+ @Nullable
+ public Entity getSource() {
+ return source;
+ }
+ // Paper end
+
2017-08-12 23:32:01 +02:00
+ /**
2016-12-01 00:31:46 +01:00
* Get the amount of experience the player will receive
*
2017-08-12 23:32:01 +02:00
* @return The amount of experience
2016-12-01 00:31:46 +01:00
--
2017-08-12 23:32:01 +02:00
2.13.4
2016-12-01 00:31:46 +01:00