mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Fixing a multitude of reported NPEs.
This commit is contained in:
parent
a2450d2d07
commit
aeaab43f44
@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
@ -40,7 +41,13 @@ public final class PartyAPI {
|
||||
* @return true if the player is in a party, false otherwise
|
||||
*/
|
||||
public static boolean inParty(Player player) {
|
||||
return UserManager.getPlayer(player).inParty();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return mcMMOPlayer.inParty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -215,6 +215,10 @@ public class EntityListener implements Listener {
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check for invincibility */
|
||||
if (mcMMOPlayer.getGodMode()) {
|
||||
event.setCancelled(true);
|
||||
|
@ -299,6 +299,11 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Item drop = event.getItem();
|
||||
ItemStack dropStack = drop.getItemStack();
|
||||
|
||||
@ -341,6 +346,10 @@ public class PlayerListener implements Listener {
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mcMMOPlayer.resetAbilityMode();
|
||||
BleedTimerTask.bleedOut(player);
|
||||
mcMMOPlayer.getProfile().save();
|
||||
|
@ -139,6 +139,11 @@ public final class CombatUtils {
|
||||
|
||||
private static void processArcheryCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event, Entity arrow) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ArcheryManager archeryManager = mcMMOPlayer.getArcheryManager();
|
||||
|
||||
if (archeryManager.canSkillShot()) {
|
||||
@ -312,6 +317,11 @@ public final class CombatUtils {
|
||||
|
||||
Player player = (Player) target;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
|
||||
|
||||
if (acrobaticsManager.canDodge(damager)) {
|
||||
|
Loading…
Reference in New Issue
Block a user