mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +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();
|
Player player = event.getPlayer();
|
||||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
|
|
||||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player, mcMMOPlayer.getProfile())) {
|
if (Misc.isNPCPlayer(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
|
||||||
|
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
ItemStack heldItem = player.getItemInHand();
|
ItemStack heldItem = player.getItemInHand();
|
||||||
|
|
||||||
@ -258,12 +258,12 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile profile = Users.getProfile(player);
|
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player, profile)) {
|
if (Misc.isNPCPlayer(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlayerProfile profile = Users.getProfile(player);
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -313,13 +313,13 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
|
|
||||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player, profile)) {
|
if (Misc.isNPCPlayer(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
|
||||||
|
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||||
ItemStack heldItem = player.getItemInHand();
|
ItemStack heldItem = player.getItemInHand();
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
|
|
||||||
|
@ -150,17 +150,13 @@ public class EntityListener implements Listener {
|
|||||||
if (livingEntity instanceof Player) {
|
if (livingEntity instanceof Player) {
|
||||||
Player player = (Player) entity;
|
Player player = (Player) entity;
|
||||||
|
|
||||||
if (!player.isOnline()) {
|
if (!player.isOnline() || Misc.isNPCPlayer(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
|
||||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player, profile)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for invincibility */
|
/* Check for invincibility */
|
||||||
if (profile.getGodMode()) {
|
if (profile.getGodMode()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -287,9 +283,8 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
Player player = (Player) entity;
|
Player player = (Player) entity;
|
||||||
PlayerProfile profile = Users.getProfile(player);
|
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player, profile)) {
|
if (Misc.isNPCPlayer(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,12 +57,13 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
|
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile profile = Users.getProfile(player);
|
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player, profile)) {
|
if (Misc.isNPCPlayer(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlayerProfile profile = Users.getProfile(player);
|
||||||
|
|
||||||
if (profile.getGodMode() && !Permissions.mcgod(player)) {
|
if (profile.getGodMode() && !Permissions.mcgod(player)) {
|
||||||
profile.toggleGodMode();
|
profile.toggleGodMode();
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Forbidden"));
|
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Forbidden"));
|
||||||
@ -170,12 +171,13 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile profile = Users.getProfile(player);
|
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player, profile)) {
|
if (Misc.isNPCPlayer(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlayerProfile profile = Users.getProfile(player);
|
||||||
|
|
||||||
profile.actualizeRespawnATS();
|
profile.actualizeRespawnATS();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,12 +329,13 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile profile = Users.getProfile(player);
|
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player, profile)) {
|
if (Misc.isNPCPlayer(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlayerProfile profile = Users.getProfile(player);
|
||||||
|
|
||||||
if (profile.getPartyChatMode()) {
|
if (profile.getPartyChatMode()) {
|
||||||
Party party = profile.getParty();
|
Party party = profile.getParty();
|
||||||
|
|
||||||
|
@ -102,15 +102,7 @@ public final class Misc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNPCPlayer(Player player) {
|
public static boolean isNPCPlayer(Player player) {
|
||||||
if (player == null || Users.getProfile(player) == null || player.hasMetadata("NPC")) {
|
if (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")) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user