mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-15 07:05:51 +01:00
Added null checks to PartiesListener
This commit is contained in:
parent
60410f67c6
commit
20f1d2845b
@ -29,31 +29,49 @@ public class PartiesListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPartyCreate(BukkitPartiesPartyPostCreateEvent event) {
|
||||
Bukkit.getServer().getPlayer(event.getCreator().getPlayerUUID()).sendMessage(ChatColor.YELLOW + Lang.get("questPartiesCreate"));
|
||||
if (event.getCreator() != null) {
|
||||
Player p = Bukkit.getServer().getPlayer(event.getCreator().getPlayerUUID());
|
||||
if (p != null) {
|
||||
p.sendMessage(ChatColor.YELLOW + Lang.get("questPartiesCreate"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPartyDeleteEvent(BukkitPartiesPartyPostDeleteEvent event) {
|
||||
Bukkit.getServer().getPlayer(event.getCommandSender().getPlayerUUID()).sendMessage(ChatColor.RED + Lang.get("questPartiesDelete"));
|
||||
if (event.getCommandSender() != null) {
|
||||
Player p = Bukkit.getServer().getPlayer(event.getCommandSender().getPlayerUUID());
|
||||
if (p != null) {
|
||||
p.sendMessage(ChatColor.RED + Lang.get("questPartiesDelete"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoinEvent(BukkitPartiesPlayerPostJoinEvent event) {
|
||||
if (event.isInvited()) {
|
||||
if (event.isInvited() && event.getInviter() != null) {
|
||||
Player i = Bukkit.getServer().getPlayer(event.getInviter());
|
||||
i.sendMessage(ChatColor.GREEN + Lang.get(i, "questPartiesInvite").replace("<player>", i.getName()));
|
||||
if (i != null) {
|
||||
i.sendMessage(ChatColor.GREEN + Lang.get(i, "questPartiesInvite").replace("<player>", i.getName()));
|
||||
}
|
||||
}
|
||||
Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
|
||||
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questPartiesJoin").replace("<player>", p.getName()));
|
||||
if (p != null) {
|
||||
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questPartiesJoin").replace("<player>", p.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerLeaveEvent(BukkitPartiesPlayerPostLeaveEvent event) {
|
||||
if (event.isKicked()) {
|
||||
Player k = Bukkit.getServer().getPlayer(event.getKicker().getPlayerUUID());
|
||||
k.sendMessage(ChatColor.RED + Lang.get(k, "questPartiesKicked").replace("<player>", k.getName()));
|
||||
if (k != null) {
|
||||
k.sendMessage(ChatColor.RED + Lang.get(k, "questPartiesKicked").replace("<player>", k.getName()));
|
||||
}
|
||||
}
|
||||
Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
|
||||
p.sendMessage(ChatColor.RED + Lang.get(p, "questPartiesLeave").replace("<player>", p.getName()));
|
||||
if (p != null) {
|
||||
p.sendMessage(ChatColor.RED + Lang.get(p, "questPartiesLeave").replace("<player>", p.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user