Check for null players on DungeonsXL join

This commit is contained in:
PikaMug 2019-04-16 22:46:17 -04:00
parent dc45761f17
commit 5f52a5b9d9

View File

@ -27,15 +27,19 @@ public class DungeonsListener implements Listener {
public void onPlayerJoinEvent(DPlayerJoinDGroupEvent event) {
Player i = event.getDGroup().getCaptain();
Player p = event.getDPlayer().getPlayer();
i.sendMessage(ChatColor.GREEN + Lang.get(i, "questDungeonsInvite").replace("<player>", p.getName()));
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questDungeonsJoin").replace("<player>", i.getName()));
if (i != null && p != null) {
i.sendMessage(ChatColor.GREEN + Lang.get(i, "questDungeonsInvite").replace("<player>", p.getName()));
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questDungeonsJoin").replace("<player>", i.getName()));
}
}
@EventHandler
public void onPlayerLeaveEvent(DPlayerLeaveDGroupEvent event) {
Player k = event.getDGroup().getCaptain();
Player p = event.getDPlayer().getPlayer();
k.sendMessage(ChatColor.RED + Lang.get(k, "questDungeonsKicked").replace("<player>", k.getName()));
p.sendMessage(ChatColor.RED + Lang.get(p, "questDungeonsLeave").replace("<player>", p.getName()));
if (k != null && p != null) {
k.sendMessage(ChatColor.RED + Lang.get(k, "questDungeonsKicked").replace("<player>", k.getName()));
p.sendMessage(ChatColor.RED + Lang.get(p, "questDungeonsLeave").replace("<player>", p.getName()));
}
}
}