2020-04-02 23:07:06 +02:00
|
|
|
From d021eefa33645c6ad7cb1bf140a9f7602ccc6704 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
|
2020-04-02 23:07:06 +02:00
|
|
|
index c99c9281e..7c340f539 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
|
2019-03-20 01:28:15 +01: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;
|
2019-03-20 01:28:15 +01:00
|
|
|
import org.jetbrains.annotations.NotNull;
|
2016-12-01 00:31:46 +01:00
|
|
|
|
2019-03-20 01:28:15 +01:00
|
|
|
+import org.jetbrains.annotations.Nullable; // Paper
|
2016-12-01 00:31:46 +01:00
|
|
|
+
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
2019-03-20 01:28:15 +01:00
|
|
|
public PlayerExpChangeEvent(@NotNull final Player player, final int expAmount) {
|
2016-12-01 00:31:46 +01:00
|
|
|
+ this(player, null, expAmount);
|
|
|
|
+ }
|
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ public PlayerExpChangeEvent(@NotNull final Player player, @Nullable final Entity sourceEntity, final int expAmount) {
|
2016-12-01 00:31:46 +01:00
|
|
|
super(player);
|
|
|
|
+ source = sourceEntity;
|
|
|
|
exp = expAmount;
|
|
|
|
}
|
|
|
|
|
2018-03-10 14:07:40 +01: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
|
|
|
|
+
|
2018-03-10 14:07:40 +01:00
|
|
|
/**
|
2016-12-01 00:31:46 +01:00
|
|
|
* Get the amount of experience the player will receive
|
|
|
|
*
|
|
|
|
--
|
2020-04-02 23:07:06 +02:00
|
|
|
2.25.1
|
2016-12-01 00:31:46 +01:00
|
|
|
|