Let the PlayerData load before trying to update items on player join

- Fixes a NPE on the players first join with items that need updated
This commit is contained in:
HexedHero 2021-10-26 04:49:05 +00:00
parent 279b008122
commit 6e2fb4c19d
2 changed files with 191 additions and 190 deletions

View File

@ -36,7 +36,7 @@ import java.util.Map;
public class PlayerListener implements Listener { public class PlayerListener implements Listener {
private final Map<Player, ArrayList<ItemStack>> deathItems = new HashMap<>(); private final Map<Player, ArrayList<ItemStack>> deathItems = new HashMap<>();
@EventHandler @EventHandler(priority = EventPriority.NORMAL)
public void loadPlayerData(PlayerJoinEvent event) { public void loadPlayerData(PlayerJoinEvent event) {
MMOItems.plugin.getRecipes().refreshRecipeBook(event.getPlayer()); MMOItems.plugin.getRecipes().refreshRecipeBook(event.getPlayer());
PlayerData.load(event.getPlayer()); PlayerData.load(event.getPlayer());

View File

@ -14,6 +14,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
@ -56,7 +57,7 @@ public class UpdaterManager implements Listener {
/** /**
* Updates a player inventory when joining * Updates a player inventory when joining
*/ */
@EventHandler @EventHandler(priority = EventPriority.HIGH)
public void updateOnJoin(PlayerJoinEvent event) { public void updateOnJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();