mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-15 07:05:51 +01:00
Merge pull request #957 from AlessioDP/master
Check whether Parties players are null
This commit is contained in:
commit
2ff88a425d
@ -29,31 +29,49 @@ public class PartiesListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPartyCreate(BukkitPartiesPartyPostCreateEvent event) {
|
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
|
@EventHandler
|
||||||
public void onPartyDeleteEvent(BukkitPartiesPartyPostDeleteEvent event) {
|
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
|
@EventHandler
|
||||||
public void onPlayerJoinEvent(BukkitPartiesPlayerPostJoinEvent event) {
|
public void onPlayerJoinEvent(BukkitPartiesPlayerPostJoinEvent event) {
|
||||||
if (event.isInvited()) {
|
if (event.isInvited() && event.getInviter() != null) {
|
||||||
Player i = Bukkit.getServer().getPlayer(event.getInviter());
|
Player i = Bukkit.getServer().getPlayer(event.getInviter());
|
||||||
|
if (i != null) {
|
||||||
i.sendMessage(ChatColor.GREEN + Lang.get(i, "questPartiesInvite").replace("<player>", i.getName()));
|
i.sendMessage(ChatColor.GREEN + Lang.get(i, "questPartiesInvite").replace("<player>", i.getName()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
|
Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
|
||||||
|
if (p != null) {
|
||||||
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questPartiesJoin").replace("<player>", p.getName()));
|
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questPartiesJoin").replace("<player>", p.getName()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerLeaveEvent(BukkitPartiesPlayerPostLeaveEvent event) {
|
public void onPlayerLeaveEvent(BukkitPartiesPlayerPostLeaveEvent event) {
|
||||||
if (event.isKicked()) {
|
if (event.isKicked() && event.getKicker() != null) {
|
||||||
Player k = Bukkit.getServer().getPlayer(event.getKicker().getPlayerUUID());
|
Player k = Bukkit.getServer().getPlayer(event.getKicker().getPlayerUUID());
|
||||||
|
if (k != null) {
|
||||||
k.sendMessage(ChatColor.RED + Lang.get(k, "questPartiesKicked").replace("<player>", k.getName()));
|
k.sendMessage(ChatColor.RED + Lang.get(k, "questPartiesKicked").replace("<player>", k.getName()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
|
Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
|
||||||
|
if (p != null) {
|
||||||
p.sendMessage(ChatColor.RED + Lang.get(p, "questPartiesLeave").replace("<player>", p.getName()));
|
p.sendMessage(ChatColor.RED + Lang.get(p, "questPartiesLeave").replace("<player>", p.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user