mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-03-13 13:30:06 +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
|
* @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() {
|
public boolean isEncumbered() {
|
||||||
|
|
||||||
@ -443,8 +443,7 @@ public class PlayerData {
|
|||||||
/**
|
/**
|
||||||
* Called when the corresponding MMOPlayerData has already been initialized.
|
* 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
|
* 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
|
* 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));
|
PlayerData playerData = new PlayerData(MMOPlayerData.get(player));
|
||||||
data.put(player, playerData);
|
data.put(player, playerData);
|
||||||
playerData.updateInventory();
|
playerData.updateInventory();
|
||||||
return;
|
return playerData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -463,6 +462,7 @@ public class PlayerData {
|
|||||||
*/
|
*/
|
||||||
PlayerData playerData = data.get(player);
|
PlayerData playerData = data.get(player);
|
||||||
playerData.rpgPlayer = MMOItems.plugin.getRPG().getInfo(playerData);
|
playerData.rpgPlayer = MMOItems.plugin.getRPG().getInfo(playerData);
|
||||||
|
return playerData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Collection<PlayerData> getLoaded() {
|
public static Collection<PlayerData> getLoaded() {
|
||||||
|
@ -31,13 +31,13 @@ import java.util.*;
|
|||||||
public class PlayerListener implements Listener {
|
public class PlayerListener implements Listener {
|
||||||
private final Map<Player, List<ItemStack>> deathItems = new HashMap<>();
|
private final Map<Player, List<ItemStack>> deathItems = new HashMap<>();
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void savePlayerData(PlayerQuitEvent event) {
|
public void savePlayerData(PlayerQuitEvent event) {
|
||||||
PlayerData.get(event.getPlayer()).save(true);
|
PlayerData.get(event.getPlayer()).save(true);
|
||||||
}
|
}
|
||||||
@ -48,7 +48,6 @@ public class PlayerListener implements Listener {
|
|||||||
@SuppressWarnings("InstanceofIncompatibleInterface")
|
@SuppressWarnings("InstanceofIncompatibleInterface")
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onDeathForUpgradeLoss(@NotNull PlayerDeathEvent event) {
|
public void onDeathForUpgradeLoss(@NotNull PlayerDeathEvent event) {
|
||||||
|
|
||||||
// No
|
// No
|
||||||
if (event instanceof Cancellable) { if (((Cancellable) event).isCancelled()) { return; } }
|
if (event instanceof Cancellable) { if (((Cancellable) event).isCancelled()) { return; } }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user