mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-15 04:41:25 +01:00
Add source to PlayerExpChangeEvent
This commit is contained in:
parent
55dc3ff664
commit
df6649ed5d
@ -1,21 +1,43 @@
|
|||||||
package org.bukkit.event.player;
|
package org.bukkit.event.player;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity; // Paper
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable; // Paper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a players experience changes naturally
|
* Called when a players experience changes naturally
|
||||||
*/
|
*/
|
||||||
public class PlayerExpChangeEvent extends PlayerEvent {
|
public class PlayerExpChangeEvent extends PlayerEvent {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
// Paper start
|
||||||
|
@Nullable
|
||||||
|
private final Entity source;
|
||||||
private int exp;
|
private int exp;
|
||||||
|
|
||||||
public PlayerExpChangeEvent(@NotNull final Player player, final int expAmount) {
|
public PlayerExpChangeEvent(@NotNull final Player player, final int expAmount) {
|
||||||
|
this(player, null, expAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerExpChangeEvent(@NotNull final Player player, @Nullable final Entity sourceEntity, final int expAmount) {
|
||||||
super(player);
|
super(player);
|
||||||
|
source = sourceEntity;
|
||||||
exp = expAmount;
|
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
|
* Get the amount of experience the player will receive
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user