From f83f8f88b7985bdd2e3a44d8865866fb81494bc7 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sat, 19 Nov 2016 20:29:42 +0100 Subject: [PATCH] Fixed player info --- .../java/buttondevteam/chat/ChatProcessing.java | 4 ++-- .../buttondevteam/chat/listener/PlayerListener.java | 13 +++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main/java/buttondevteam/chat/ChatProcessing.java b/src/main/java/buttondevteam/chat/ChatProcessing.java index 2555fc1..e72e40a 100644 --- a/src/main/java/buttondevteam/chat/ChatProcessing.java +++ b/src/main/java/buttondevteam/chat/ChatProcessing.java @@ -229,8 +229,8 @@ public class ChatProcessing { ? "\nDeaths: " + PlayerListener.AlphaDeaths : "")))) - .addExtra(new TellrawPart( - "For more, do /u info " + sender.getName()))))); + .addExtra(new TellrawPart("\nFor more, do /u info " + + sender.getName()))))); json.addExtra(new TellrawPart("> ")); long combinetime = System.nanoTime(); ChatFormatter.Combine(formatters, formattedmessage, json); diff --git a/src/main/java/buttondevteam/chat/listener/PlayerListener.java b/src/main/java/buttondevteam/chat/listener/PlayerListener.java index c06f1c5..4b6bd37 100644 --- a/src/main/java/buttondevteam/chat/listener/PlayerListener.java +++ b/src/main/java/buttondevteam/chat/listener/PlayerListener.java @@ -372,14 +372,11 @@ public class PlayerListener implements Listener { public void onGetInfo(TBMCPlayerGetInfoEvent e) { ChatPlayer cp = e.getPlayer().asPluginPlayer(ChatPlayer.class); e.addInfo("Minecraft name: " + cp.getPlayerName()); - e.addInfo("Reddit name: " + cp.getUserName()); - if (e.getTarget() == InfoTarget.MCCommand) - e.addInfo("/r/TheButton flair: " + cp.GetFormattedFlair()); - else { - final String flair = cp.GetFormattedFlair(true); - if (flair.length() > 0) - e.addInfo("/r/TheButton flair: " + flair); - } + if (cp.getUserName() != null && cp.getUserName().length() > 0) + e.addInfo("Reddit name: " + cp.getUserName()); + final String flair = cp.GetFormattedFlair(e.getTarget() != InfoTarget.MCCommand); + if (flair.length() > 0) + e.addInfo("/r/TheButton flair: " + flair); e.addInfo("Respect: " + (double) cp.getFCount() / (double) cp.getFDeaths()); } }