mirror of
https://github.com/PikaMug/Quests.git
synced 2025-01-18 06:11:36 +01:00
Fixed NPC's causing Questing problems when moving/killing
This commit is contained in:
parent
e8a4599791
commit
35244379a5
@ -354,29 +354,27 @@ 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();
|
||||||
|
if(plugin.citizens.getNPCRegistry().isNPC(player) == false){
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}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,20 +400,27 @@ 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();
|
||||||
|
if(plugin.citizens.getNPCRegistry().isNPC(player) == false){
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(player.getName());
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
if(quester.hasObjective("killPlayer"))
|
if(quester.hasObjective("killPlayer"))
|
||||||
quester.killPlayer(evt.getEntity().getName());
|
quester.killPlayer(evt.getEntity().getName());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}else if(damager instanceof Player){
|
}else if(damager instanceof Player){
|
||||||
|
|
||||||
Player player = (Player) damager;
|
Player player = (Player) damager;
|
||||||
|
if(plugin.citizens.getNPCRegistry().isNPC(player) == false){
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(player.getName());
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
if(quester.hasObjective("killPlayer"))
|
if(quester.hasObjective("killPlayer"))
|
||||||
quester.killPlayer(evt.getEntity().getName());
|
quester.killPlayer(evt.getEntity().getName());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,7 +488,10 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerMove(PlayerMoveEvent evt){
|
public void onPlayerMove(PlayerMoveEvent evt){
|
||||||
|
|
||||||
|
if(plugin.citizens.getNPCRegistry().isNPC(evt.getPlayer()) == false){
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||||
|
|
||||||
if(quester.hasObjective("reachLocation")){
|
if(quester.hasObjective("reachLocation")){
|
||||||
|
|
||||||
quester.reachLocation(evt.getTo());
|
quester.reachLocation(evt.getTo());
|
||||||
@ -493,3 +501,5 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user