random events: fix npe on login

on login, interactingChanged fires once with both player and target
set to null.
This commit is contained in:
dekvall
2019-10-23 00:04:54 +02:00
parent bfe21fa6a2
commit 1b60dbb575

View File

@@ -118,7 +118,11 @@ public class RandomEventPlugin extends Plugin
// Check that the npc is interacting with the player and the player isn't interacting with the npc, so
// that the notification doesn't fire from talking to other user's randoms
if (target != player || player.getInteracting() == source || !(source instanceof NPC) || !EVENT_NPCS.contains(((NPC) source).getId()))
if (player == null
|| target != player
|| player.getInteracting() == source
|| !(source instanceof NPC)
|| !EVENT_NPCS.contains(((NPC) source).getId()))
{
return;
}