mirror of
https://github.com/PikaMug/Quests.git
synced 2025-01-03 06:57:58 +01:00
Fixed NPC's causing Questing problems when moving/killing
This commit is contained in:
parent
e8a4599791
commit
35244379a5
@ -354,28 +354,26 @@ public class PlayerListener implements Listener {
|
|||||||
Projectile p = (Projectile) damager;
|
Projectile p = (Projectile) damager;
|
||||||
if(p.getShooter() instanceof Player){
|
if(p.getShooter() instanceof Player){
|
||||||
|
|
||||||
try{
|
|
||||||
Player player = (Player) p.getShooter();
|
Player player = (Player) p.getShooter();
|
||||||
Quester quester = plugin.getQuester(player.getName());
|
if(plugin.citizens.getNPCRegistry().isNPC(player) == false){
|
||||||
if(quester.hasObjective("killMob"))
|
|
||||||
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
|
|
||||||
}catch(Exception e){
|
|
||||||
//Do nothing, killer is an NPC
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
|
if(quester.hasObjective("killMob"))
|
||||||
|
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(damager instanceof Player){
|
}else if(damager instanceof Player){
|
||||||
|
|
||||||
try{
|
if(plugin.citizens.getNPCRegistry().isNPC(damager) == false){
|
||||||
|
|
||||||
Player player = (Player) damager;
|
Player player = (Player) damager;
|
||||||
Quester quester = plugin.getQuester(player.getName());
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
if(quester.hasObjective("killMob"))
|
if(quester.hasObjective("killMob"))
|
||||||
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
|
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
|
||||||
}catch (Exception e){
|
|
||||||
//Do nothing, killer is an NPC
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -402,19 +400,26 @@ public class PlayerListener implements Listener {
|
|||||||
if(p.getShooter() instanceof Player){
|
if(p.getShooter() instanceof Player){
|
||||||
|
|
||||||
Player player = (Player) p.getShooter();
|
Player player = (Player) p.getShooter();
|
||||||
Quester quester = plugin.getQuester(player.getName());
|
if(plugin.citizens.getNPCRegistry().isNPC(player) == false){
|
||||||
if(quester.hasObjective("killPlayer"))
|
|
||||||
quester.killPlayer(evt.getEntity().getName());
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
|
if(quester.hasObjective("killPlayer"))
|
||||||
|
quester.killPlayer(evt.getEntity().getName());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(damager instanceof Player){
|
}else if(damager instanceof Player){
|
||||||
|
|
||||||
Player player = (Player) damager;
|
Player player = (Player) damager;
|
||||||
Quester quester = plugin.getQuester(player.getName());
|
if(plugin.citizens.getNPCRegistry().isNPC(player) == false){
|
||||||
if(quester.hasObjective("killPlayer"))
|
|
||||||
quester.killPlayer(evt.getEntity().getName());
|
|
||||||
|
|
||||||
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
|
if(quester.hasObjective("killPlayer"))
|
||||||
|
quester.killPlayer(evt.getEntity().getName());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -483,10 +488,15 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerMove(PlayerMoveEvent evt){
|
public void onPlayerMove(PlayerMoveEvent evt){
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
if(plugin.citizens.getNPCRegistry().isNPC(evt.getPlayer()) == false){
|
||||||
if(quester.hasObjective("reachLocation")){
|
|
||||||
|
|
||||||
quester.reachLocation(evt.getTo());
|
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||||
|
|
||||||
|
if(quester.hasObjective("reachLocation")){
|
||||||
|
|
||||||
|
quester.reachLocation(evt.getTo());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user