Only send multiplayer messages if not blank, per #958

This commit is contained in:
PikaMug 2019-10-09 01:24:42 -04:00
parent 2ff88a425d
commit cfb3bf7d3d
2 changed files with 36 additions and 12 deletions

View File

@ -27,12 +27,16 @@ import me.blackvein.quests.util.Lang;
public class DungeonsListener implements Listener {
@EventHandler
public void onGroupCreate(DGroupCreateEvent event) {
event.getCreator().sendMessage(ChatColor.YELLOW + Lang.get("questDungeonsCreate"));
if (Lang.get("questDungeonsCreate").length() > 0) {
event.getCreator().sendMessage(ChatColor.YELLOW + Lang.get("questDungeonsCreate"));
}
}
@EventHandler
public void onGroupDisbandEvent(DGroupDisbandEvent event) {
event.getDisbander().sendMessage(ChatColor.RED + Lang.get("questDungeonsDisband"));
if (Lang.get("questDungeonsDisband").length() > 0) {
event.getDisbander().sendMessage(ChatColor.RED + Lang.get("questDungeonsDisband"));
}
}
@EventHandler
@ -41,8 +45,12 @@ public class DungeonsListener implements Listener {
Player i = event.getDGroup().getCaptain();
Player p = event.getDPlayer().getPlayer();
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()));
if (Lang.get("questDungeonsInvite").length() > 0) {
i.sendMessage(ChatColor.GREEN + Lang.get(i, "questDungeonsInvite").replace("<player>", p.getName()));
}
if (Lang.get("questDungeonsJoin").length() > 0) {
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questDungeonsJoin").replace("<player>", i.getName()));
}
}
}
}
@ -53,8 +61,12 @@ public class DungeonsListener implements Listener {
Player k = event.getDGroup().getCaptain();
Player p = event.getDPlayer().getPlayer();
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()));
if (Lang.get("questDungeonsKicked").length() > 0) {
k.sendMessage(ChatColor.RED + Lang.get(k, "questDungeonsKicked").replace("<player>", k.getName()));
}
if (Lang.get("questDungeonsLeave").length() > 0) {
p.sendMessage(ChatColor.RED + Lang.get(p, "questDungeonsLeave").replace("<player>", p.getName()));
}
}
}
}

View File

@ -32,7 +32,9 @@ public class PartiesListener implements Listener {
if (event.getCreator() != null) {
Player p = Bukkit.getServer().getPlayer(event.getCreator().getPlayerUUID());
if (p != null) {
p.sendMessage(ChatColor.YELLOW + Lang.get("questPartiesCreate"));
if (Lang.get("questPartiesCreate").length() > 0) {
p.sendMessage(ChatColor.YELLOW + Lang.get("questPartiesCreate"));
}
}
}
}
@ -42,7 +44,9 @@ public class PartiesListener implements Listener {
if (event.getCommandSender() != null) {
Player p = Bukkit.getServer().getPlayer(event.getCommandSender().getPlayerUUID());
if (p != null) {
p.sendMessage(ChatColor.RED + Lang.get("questPartiesDelete"));
if (Lang.get("questPartiesDelete").length() > 0) {
p.sendMessage(ChatColor.RED + Lang.get("questPartiesDelete"));
}
}
}
}
@ -52,12 +56,16 @@ public class PartiesListener implements Listener {
if (event.isInvited() && event.getInviter() != null) {
Player i = Bukkit.getServer().getPlayer(event.getInviter());
if (i != null) {
i.sendMessage(ChatColor.GREEN + Lang.get(i, "questPartiesInvite").replace("<player>", i.getName()));
if (Lang.get("questPartiesInvite").length() > 0) {
i.sendMessage(ChatColor.GREEN + Lang.get(i, "questPartiesInvite").replace("<player>", i.getName()));
}
}
}
Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
if (p != null) {
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questPartiesJoin").replace("<player>", p.getName()));
if (Lang.get("questPartiesJoin").length() > 0) {
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questPartiesJoin").replace("<player>", p.getName()));
}
}
}
@ -66,12 +74,16 @@ public class PartiesListener implements Listener {
if (event.isKicked() && event.getKicker() != null) {
Player k = Bukkit.getServer().getPlayer(event.getKicker().getPlayerUUID());
if (k != null) {
k.sendMessage(ChatColor.RED + Lang.get(k, "questPartiesKicked").replace("<player>", k.getName()));
if (Lang.get("questPartiesKicked").length() > 0) {
k.sendMessage(ChatColor.RED + Lang.get(k, "questPartiesKicked").replace("<player>", k.getName()));
}
}
}
Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
if (p != null) {
p.sendMessage(ChatColor.RED + Lang.get(p, "questPartiesLeave").replace("<player>", p.getName()));
if (Lang.get("questPartiesLeave").length() > 0) {
p.sendMessage(ChatColor.RED + Lang.get(p, "questPartiesLeave").replace("<player>", p.getName()));
}
}
}
}