mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-25 01:58:28 +01:00
Removed unwanted profile check in isNPCPlayer
Is the profile is null, it may be our fault, and because of this check we would never know about it.
This commit is contained in:
parent
97d47c19b7
commit
f51bdad6b4
@ -138,13 +138,13 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
|
||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||
|
||||
if (Misc.isNPCPlayer(player, mcMMOPlayer.getProfile())) {
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
|
||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||
Block block = event.getBlock();
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
|
||||
@ -258,12 +258,12 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
|
||||
if (Misc.isNPCPlayer(player, profile)) {
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
Block block = event.getBlock();
|
||||
|
||||
/*
|
||||
@ -313,13 +313,13 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
|
||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||
|
||||
if (Misc.isNPCPlayer(player, profile)) {
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
|
||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
Block block = event.getBlock();
|
||||
|
||||
|
@ -150,17 +150,13 @@ public class EntityListener implements Listener {
|
||||
if (livingEntity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
|
||||
if (!player.isOnline()) {
|
||||
if (!player.isOnline() || Misc.isNPCPlayer(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
|
||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||
|
||||
if (Misc.isNPCPlayer(player, profile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check for invincibility */
|
||||
if (profile.getGodMode()) {
|
||||
event.setCancelled(true);
|
||||
@ -287,9 +283,8 @@ public class EntityListener implements Listener {
|
||||
|
||||
if (entity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
|
||||
if (Misc.isNPCPlayer(player, profile)) {
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -57,12 +57,13 @@ public class PlayerListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
|
||||
if (Misc.isNPCPlayer(player, profile)) {
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
|
||||
if (profile.getGodMode() && !Permissions.mcgod(player)) {
|
||||
profile.toggleGodMode();
|
||||
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Forbidden"));
|
||||
@ -170,12 +171,13 @@ public class PlayerListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
|
||||
if (Misc.isNPCPlayer(player, profile)) {
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
|
||||
profile.actualizeRespawnATS();
|
||||
}
|
||||
|
||||
@ -327,12 +329,13 @@ public class PlayerListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
|
||||
if (Misc.isNPCPlayer(player, profile)) {
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
|
||||
if (profile.getPartyChatMode()) {
|
||||
Party party = profile.getParty();
|
||||
|
||||
|
@ -102,15 +102,7 @@ public final class Misc {
|
||||
}
|
||||
|
||||
public static boolean isNPCPlayer(Player player) {
|
||||
if (player == null || Users.getProfile(player) == null || player.hasMetadata("NPC")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isNPCPlayer(Player player, PlayerProfile profile) {
|
||||
if (player == null || profile == null || player.hasMetadata("NPC")) {
|
||||
if (player == null || player.hasMetadata("NPC")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user