mirror of https://github.com/PikaMug/Quests.git
Catch missing Citizens for kill IDs
This commit is contained in:
parent
e0bbbe7e90
commit
354c72ba4a
|
@ -3084,20 +3084,25 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
||||||
npcAmountsToKill = config.getIntegerList("quests." + questKey + ".stages.ordered."
|
npcAmountsToKill = config.getIntegerList("quests." + questKey + ".stages.ordered."
|
||||||
+ stageNum + ".npc-kill-amounts");
|
+ stageNum + ".npc-kill-amounts");
|
||||||
for (final int i : npcIdsToKill) {
|
for (final int i : npcIdsToKill) {
|
||||||
final NPC npc = CitizensAPI.getNPCRegistry().getById(i);
|
if (getDependencies().getCitizens() != null) {
|
||||||
if (npc != null) {
|
final NPC npc = CitizensAPI.getNPCRegistry().getById(i);
|
||||||
if (npcAmountsToKill.get(npcIdsToKill.indexOf(i)) > 0) {
|
if (npc != null) {
|
||||||
final UUID npcUuid = npc.getUniqueId();
|
if (npcAmountsToKill.get(npcIdsToKill.indexOf(i)) > 0) {
|
||||||
oStage.addNpcToKill(npcUuid);
|
final UUID npcUuid = npc.getUniqueId();
|
||||||
oStage.addNpcNumToKill(npcAmountsToKill.get(npcIdsToKill.indexOf(i)));
|
oStage.addNpcToKill(npcUuid);
|
||||||
questNpcUuids.add(npcUuid);
|
oStage.addNpcNumToKill(npcAmountsToKill.get(npcIdsToKill.indexOf(i)));
|
||||||
|
questNpcUuids.add(npcUuid);
|
||||||
|
} else {
|
||||||
|
throw new StageFormatException("npc-kill-amounts is not a positive number",
|
||||||
|
quest, stageNum);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new StageFormatException("npc-kill-amounts is not a positive number",
|
throw new StageFormatException("npc-ids-to-kill has invalid NPC ID of " + i, quest,
|
||||||
quest, stageNum);
|
stageNum);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new StageFormatException("npc-ids-to-kill has invalid NPC ID of " + i, quest,
|
throw new StageFormatException(
|
||||||
stageNum);
|
"Citizens not found for npc-ids-to-kill", quest, stageNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -34,10 +34,10 @@ public class ZnpcsListener implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onNPCInteract(final NPCInteractEvent event) {
|
public void onNPCInteract(final NPCInteractEvent event) {
|
||||||
|
if (plugin.getDependencies().getZnpcs() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (event.isLeftClick()) {
|
if (event.isLeftClick()) {
|
||||||
if (plugin.getDependencies().getZnpcs() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (plugin.getQuestFactory().getSelectingNpcs().contains(event.getPlayer().getUniqueId())) {
|
if (plugin.getQuestFactory().getSelectingNpcs().contains(event.getPlayer().getUniqueId())) {
|
||||||
if (event.getNpc() == null) {
|
if (event.getNpc() == null) {
|
||||||
plugin.getLogger().severe("ZNPC was null while selecting by left-click");
|
plugin.getLogger().severe("ZNPC was null while selecting by left-click");
|
||||||
|
@ -49,9 +49,6 @@ public class ZnpcsListener implements Listener {
|
||||||
+ "to fix this at https://github.com/gonalez/znpc-servers/issues/36");
|
+ "to fix this at https://github.com/gonalez/znpc-servers/issues/36");
|
||||||
}
|
}
|
||||||
} else if (event.isRightClick()) {
|
} else if (event.isRightClick()) {
|
||||||
if (plugin.getDependencies().getCitizens() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (plugin.getQuestFactory().getSelectingNpcs().contains(event.getPlayer().getUniqueId())) {
|
if (plugin.getQuestFactory().getSelectingNpcs().contains(event.getPlayer().getUniqueId())) {
|
||||||
if (event.getNpc() == null) {
|
if (event.getNpc() == null) {
|
||||||
plugin.getLogger().severe("ZNPC was null while selecting by right-click");
|
plugin.getLogger().severe("ZNPC was null while selecting by right-click");
|
||||||
|
|
Loading…
Reference in New Issue