diff --git a/src/main/java/de/fanta/challenges/utils/ChatUtil.java b/src/main/java/de/fanta/challenges/utils/ChatUtil.java index 1e0a093..c0f1e1a 100644 --- a/src/main/java/de/fanta/challenges/utils/ChatUtil.java +++ b/src/main/java/de/fanta/challenges/utils/ChatUtil.java @@ -52,8 +52,20 @@ } public static void sendTitleToAll(String headline, String text, ChatColor textColor, int in, int time, int out, boolean pling) { + String tempheadline = headline; + String temptext = text; + + if (headline.equals("") || headline == null) { + tempheadline = " "; + } + + if (temptext.equals("") || temptext == null) { + temptext = " "; + } + + for (Player p : Bukkit.getOnlinePlayers()) { - p.sendTitle(ChatUtil.BLUE + headline, textColor + text, in, time, out); + p.sendTitle(ChatUtil.BLUE + tempheadline, textColor + temptext, in, time, out); if (pling) { p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1.0F, 2.0F); } @@ -65,7 +77,18 @@ } public static void sendTitleToPlayer(Player player, String headline, String text, ChatColor textColor, int in, int time, int out, boolean pling) { - player.sendTitle(ChatUtil.BLUE + headline, textColor + text, in, time, out); + String tempheadline = headline; + String temptext = text; + + if (headline.equals("") || headline == null) { + tempheadline = " "; + } + + if (temptext.equals("") || temptext == null) { + temptext = " "; + } + + player.sendTitle(ChatUtil.BLUE + tempheadline, textColor + temptext, in, time, out); if (pling) { player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1.0F, 2.0F); }