!fixed AsyncPlayerDataLoadEvent

This commit is contained in:
Indyuce 2021-08-14 14:35:57 +02:00
parent 40fdcc4f28
commit 4f1084f80e
2 changed files with 30 additions and 1 deletions

View File

@ -0,0 +1,29 @@
package net.Indyuce.mmocore.api.event;
import net.Indyuce.mmocore.api.player.PlayerData;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
/**
* In order to create bukkit async events we must call
* the right constructor:
* <p>
* {@link Event#Event(boolean)} and have the boolean set to true
*/
public abstract class AsyncPlayerDataEvent extends Event {
private final PlayerData playerData;
public AsyncPlayerDataEvent(PlayerData playerData) {
super(true);
this.playerData = playerData;
}
public PlayerData getData() {
return playerData;
}
public Player getPlayer() {
return playerData.getPlayer();
}
}

View File

@ -3,7 +3,7 @@ package net.Indyuce.mmocore.api.event;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
public class AsyncPlayerDataLoadEvent extends PlayerDataEvent { public class AsyncPlayerDataLoadEvent extends AsyncPlayerDataEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
/** /**