Paper/Spigot-API-Patches/0041-Add-source-to-PlayerExpChangeEvent.patch
Shane Freeder ffb572ce9a
Remove Ignore invalid Marker Icon ID's in maps
Spigot has patched this issue inside MapIcon, meaning that we no longer need to maintain this patch; Spigots patch also fixes #668 in that it will verify the length of the array, as well as protect against a negative type value being fetched from the array. Only real change is that Spigots patch returns a MapIcon.Type.PLAYER, instead of the RED_MARKER as originally PR'd by Aikar.
2017-04-22 15:52:56 +01:00

58 Zeilen
1.7 KiB
Diff

From 6b4ec223ad07f5f8c5392bf724acfa4b6765c1de Mon Sep 17 00:00:00 2001
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
--- a/src/main/java/org/bukkit/event/player/PlayerExpChangeEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerExpChangeEvent.java
@@ -1,21 +1,43 @@
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;
}
/**
+ * Get the source that provided the experience.
+ *
+ * @return The source of the experience
+ */
+ @Nullable
+ public Entity getSource() {
+ return source;
+ }
+ // Paper end
+
+ /**
* Get the amount of experience the player will receive
*
* @return The amount of experience
--
2.12.2