mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-22 04:37:42 +01:00
Merge remote-tracking branch 'origin/1018-playerjoinevent'
# Conflicts: # MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/ItemListener.java
This commit is contained in:
commit
59f1b4261b
@ -132,7 +132,7 @@ public class PlayerData {
|
||||
|
||||
/**
|
||||
* @return If the player hands are full i.e if the player is holding
|
||||
* two items in their hands, one being two handed
|
||||
* two items in their hands, one being two handed
|
||||
*/
|
||||
public boolean isEncumbered() {
|
||||
|
||||
@ -443,8 +443,7 @@ public class PlayerData {
|
||||
/**
|
||||
* Called when the corresponding MMOPlayerData has already been initialized.
|
||||
*/
|
||||
public static void load(@NotNull UUID player) {
|
||||
|
||||
public static PlayerData load(@NotNull UUID player) {
|
||||
/*
|
||||
* Double check they are online, for some reason even if this is fired
|
||||
* from the join event the player can be offline if they left in the
|
||||
@ -454,7 +453,7 @@ public class PlayerData {
|
||||
PlayerData playerData = new PlayerData(MMOPlayerData.get(player));
|
||||
data.put(player, playerData);
|
||||
playerData.updateInventory();
|
||||
return;
|
||||
return playerData;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -463,6 +462,7 @@ public class PlayerData {
|
||||
*/
|
||||
PlayerData playerData = data.get(player);
|
||||
playerData.rpgPlayer = MMOItems.plugin.getRPG().getInfo(playerData);
|
||||
return playerData;
|
||||
}
|
||||
|
||||
public static Collection<PlayerData> getLoaded() {
|
||||
|
@ -31,13 +31,13 @@ import java.util.*;
|
||||
public class PlayerListener implements Listener {
|
||||
private final Map<Player, List<ItemStack>> deathItems = new HashMap<>();
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void loadPlayerData(PlayerJoinEvent event) {
|
||||
MMOItems.plugin.getRecipes().refreshRecipeBook(event.getPlayer());
|
||||
PlayerData.load(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void savePlayerData(PlayerQuitEvent event) {
|
||||
PlayerData.get(event.getPlayer()).save(true);
|
||||
}
|
||||
@ -48,7 +48,6 @@ public class PlayerListener implements Listener {
|
||||
@SuppressWarnings("InstanceofIncompatibleInterface")
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onDeathForUpgradeLoss(@NotNull PlayerDeathEvent event) {
|
||||
|
||||
// No
|
||||
if (event instanceof Cancellable) { if (((Cancellable) event).isCancelled()) { return; } }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user