Ensure UUID is not null before script, fixes #2127

This commit is contained in:
PikaMug 2023-06-19 23:45:10 -04:00
parent 3eb180a36e
commit d76082d484

View File

@ -31,6 +31,10 @@ public class DenizenTrigger {
} }
if (plugin.getDependencies().getDenizenApi().containsScript(scriptName)) { if (plugin.getDependencies().getDenizenApi().containsScript(scriptName)) {
if (plugin.getDependencies().getCitizens() != null) { if (plugin.getDependencies().getCitizens() != null) {
if (uuid == null) {
plugin.getLogger().severe("NPC UUID was null for Denizen script named " + scriptName);
return false;
}
final NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getByUniqueId(uuid); final NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getByUniqueId(uuid);
plugin.getDependencies().getDenizenApi().runTaskScript(scriptName, quester.getPlayer(), npc); plugin.getDependencies().getDenizenApi().runTaskScript(scriptName, quester.getPlayer(), npc);
} else { } else {