Removed isNPCPlayer, isNPCEntity is identical

This commit is contained in:
bm01 2013-02-19 01:46:50 +01:00
parent 519485f155
commit ad68f50b14
8 changed files with 27 additions and 36 deletions

View File

@ -103,7 +103,7 @@ public class BlockListener implements Listener {
public void onBlockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@ -139,7 +139,7 @@ public class BlockListener implements Listener {
Player player = event.getPlayer();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@ -223,7 +223,7 @@ public class BlockListener implements Listener {
Player player = event.getPlayer();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@ -252,7 +252,7 @@ public class BlockListener implements Listener {
Player player = event.getPlayer();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@ -318,7 +318,7 @@ public class BlockListener implements Listener {
Player player = event.getPlayer();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}

View File

@ -160,7 +160,7 @@ public class EntityListener implements Listener {
if (livingEntity instanceof Player) {
Player player = (Player) entity;
if (!player.isOnline() || Misc.isNPCPlayer(player)) {
if (!player.isOnline() || Misc.isNPCEntity(player)) {
return;
}
@ -296,7 +296,7 @@ public class EntityListener implements Listener {
if (entity instanceof Player) {
Player player = (Player) entity;
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@ -352,7 +352,7 @@ public class EntityListener implements Listener {
public void onEntityTame(EntityTameEvent event) {
Player player = (Player) event.getOwner();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}

View File

@ -73,7 +73,7 @@ public class PlayerListener implements Listener {
Player player = event.getEntity();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@ -97,7 +97,7 @@ public class PlayerListener implements Listener {
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
Player player = event.getPlayer();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@ -125,7 +125,7 @@ public class PlayerListener implements Listener {
if (event.getResult() == Result.ALLOWED) {
Player player = event.getPlayer();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@ -157,7 +157,7 @@ public class PlayerListener implements Listener {
public void onPlayerFish(PlayerFishEvent event) {
Player player = event.getPlayer();
if (Misc.isNPCPlayer(player) || !Permissions.fishing(player)) {
if (Misc.isNPCEntity(player) || !Permissions.fishing(player)) {
return;
}
@ -192,7 +192,7 @@ public class PlayerListener implements Listener {
Player player = event.getPlayer();
Item item = event.getItem();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@ -212,7 +212,7 @@ public class PlayerListener implements Listener {
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@ -251,7 +251,7 @@ public class PlayerListener implements Listener {
public void onPlayerRespawn(PlayerRespawnEvent event) {
Player player = event.getPlayer();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@ -267,7 +267,7 @@ public class PlayerListener implements Listener {
public void onPlayerInteractLowest(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@ -321,7 +321,7 @@ public class PlayerListener implements Listener {
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@ -407,7 +407,7 @@ public class PlayerListener implements Listener {
public void onPlayerChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}

View File

@ -53,7 +53,7 @@ public abstract class AcrobaticsEventHandler {
protected boolean isFatal(int damage) {
Player player = manager.getMcMMOPlayer().getPlayer();
if (Misc.isNPCPlayer(player) || player.getHealth() - damage < 1) {
if (Misc.isNPCEntity(player) || player.getHealth() - damage < 1) {
return true;
}

View File

@ -56,7 +56,7 @@ public class MiningManager extends SkillManager{
* @param event Event whose explosion is being processed
*/
public void blastMiningDropProcessing(EntityExplodeEvent event) {
if (Misc.isNPCPlayer(mcMMOPlayer.getPlayer())) {
if (Misc.isNPCEntity(mcMMOPlayer.getPlayer())) {
return;
}
@ -93,7 +93,7 @@ public class MiningManager extends SkillManager{
* @param event Event whose explosion radius is being changed
*/
public void biggerBombs(ExplosionPrimeEvent event) {
if (Misc.isNPCPlayer(mcMMOPlayer.getPlayer())) {
if (Misc.isNPCEntity(mcMMOPlayer.getPlayer())) {
return;
}

View File

@ -26,7 +26,7 @@ public class SmeltingManager extends SkillManager {
public void fuelEfficiency(FurnaceBurnEvent event) {
Player player = mcMMOPlayer.getPlayer();
if (Misc.isNPCPlayer(player) || !Permissions.fuelEfficiency(player)) {
if (Misc.isNPCEntity(player) || !Permissions.fuelEfficiency(player)) {
return;
}
@ -38,7 +38,7 @@ public class SmeltingManager extends SkillManager {
public void smeltProcessing(FurnaceSmeltEvent event) {
Player player = mcMMOPlayer.getPlayer();
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}

View File

@ -65,7 +65,7 @@ public final class CombatTools {
if (attacker instanceof Player) {
Player player = (Player) attacker;
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@ -193,7 +193,7 @@ public final class CombatTools {
if (wolf.isTamed() && wolf.getOwner() instanceof Player) {
Player master = (Player) wolf.getOwner();
if (Misc.isNPCPlayer(master)) {
if (Misc.isNPCEntity(master)) {
return;
}
@ -256,7 +256,7 @@ public final class CombatTools {
if (targetIsPlayer) {
Player player = (Player) target;
if (Misc.isNPCPlayer(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@ -295,7 +295,7 @@ public final class CombatTools {
* @param event The event to run the archery checks on.
*/
private static void archeryCheck(Player shooter, LivingEntity target, EntityDamageByEntityEvent event) {
if (Misc.isNPCPlayer(shooter)) {
if (Misc.isNPCEntity(shooter)) {
return;
}

View File

@ -6,7 +6,6 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
@ -38,14 +37,6 @@ public final class Misc {
return false;
}
public static boolean isNPCPlayer(Player player) {
if (player == null || player.hasMetadata("NPC")) {
return true;
}
return false;
}
/**
* Get the upgrade tier of the item in hand.
*