From 0da4a543e5e8e0c77a5b5bed47f1fbff0924f1f5 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Tue, 11 Apr 2017 21:11:07 +0200 Subject: [PATCH] Small fixes --- .../java/buttondevteam/chat/listener/PlayerListener.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/buttondevteam/chat/listener/PlayerListener.java b/src/main/java/buttondevteam/chat/listener/PlayerListener.java index 56a7c06..69682dc 100644 --- a/src/main/java/buttondevteam/chat/listener/PlayerListener.java +++ b/src/main/java/buttondevteam/chat/listener/PlayerListener.java @@ -328,7 +328,7 @@ public class PlayerListener implements Listener { final String flair = cp.GetFormattedFlair(e.getTarget() != InfoTarget.MCCommand); if (flair.length() > 0) e.addInfo("/r/TheButton flair: " + flair); - e.addInfo("Respect: " + (double) cp.FCount().get() / (double) cp.FDeaths().get()); + e.addInfo("Respect: " + (double) cp.FCount().getOrDefault(0) / (double) cp.FDeaths().getOrDefault(0)); } catch (Exception ex) { TBMCCoreAPI.SendException("Error while providing chat info for player " + e.getPlayer().getFileName(), ex); } @@ -337,6 +337,8 @@ public class PlayerListener implements Listener { @EventHandler public void onPlayerTBMCChat(TBMCChatEvent e) { try { + if (e.isCancelled()) + return; e.setCancelled(ChatProcessing.ProcessChat(e.getChannel(), e.getSender(), e.getMessage())); } catch (Exception ex) { for (Player p : Bukkit.getOnlinePlayers()) @@ -345,7 +347,6 @@ public class PlayerListener implements Listener { ? ((Player) e.getSender()).getDisplayName() : e.getSender().getName()) + "> " + e.getMessage()); TBMCCoreAPI.SendException("An error occured while processing a chat message!", ex); - e.setCancelled(true); } } }