Fixed NPC's causing Questing problems when moving/killing

This commit is contained in:
Blackvein 2012-10-10 15:25:05 -07:00
parent e8a4599791
commit 35244379a5

View File

@ -354,29 +354,27 @@ public class PlayerListener implements Listener {
Projectile p = (Projectile) damager;
if(p.getShooter() instanceof Player){
try{
Player player = (Player) p.getShooter();
if(plugin.citizens.getNPCRegistry().isNPC(player) == false){
Quester quester = plugin.getQuester(player.getName());
if(quester.hasObjective("killMob"))
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
}catch(Exception e){
//Do nothing, killer is an NPC
}
}
}
}else if(damager instanceof Player){
try{
if(plugin.citizens.getNPCRegistry().isNPC(damager) == false){
Player player = (Player) damager;
Quester quester = plugin.getQuester(player.getName());
if(quester.hasObjective("killMob"))
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
}catch (Exception e){
//Do nothing, killer is an NPC
}
}
}
}
@ -402,20 +400,27 @@ public class PlayerListener implements Listener {
if(p.getShooter() instanceof Player){
Player player = (Player) p.getShooter();
if(plugin.citizens.getNPCRegistry().isNPC(player) == false){
Quester quester = plugin.getQuester(player.getName());
if(quester.hasObjective("killPlayer"))
quester.killPlayer(evt.getEntity().getName());
}
}
}else if(damager instanceof Player){
Player player = (Player) damager;
if(plugin.citizens.getNPCRegistry().isNPC(player) == false){
Quester quester = plugin.getQuester(player.getName());
if(quester.hasObjective("killPlayer"))
quester.killPlayer(evt.getEntity().getName());
}
}
}
@ -483,7 +488,10 @@ public class PlayerListener implements Listener {
@EventHandler
public void onPlayerMove(PlayerMoveEvent evt){
if(plugin.citizens.getNPCRegistry().isNPC(evt.getPlayer()) == false){
Quester quester = plugin.getQuester(evt.getPlayer().getName());
if(quester.hasObjective("reachLocation")){
quester.reachLocation(evt.getTo());
@ -492,4 +500,6 @@ public class PlayerListener implements Listener {
}
}
}