From 0601ab0e407e93724974b5c072e518f30a00022f Mon Sep 17 00:00:00 2001 From: DNx5 Date: Thu, 26 Nov 2015 07:03:22 +0700 Subject: [PATCH] Remove unauthenticated chat recipients only authenticated players can see the chat --- .../fr/xephi/authme/listener/AuthMePlayerListener.java | 4 ++-- src/main/java/fr/xephi/authme/util/Utils.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 60c8c773..644b13ab 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -59,8 +59,8 @@ public class AuthMePlayerListener implements Listener { private void handleChat(AsyncPlayerChatEvent event) { Player player = event.getPlayer(); for (Player p : Utils.getOnlinePlayers()) { - if (p != player && !PlayerCache.getInstance().isAuthenticated(p.getName())) { - event.getRecipients().remove(p); + if (!PlayerCache.getInstance().isAuthenticated(p.getName())) { + event.getRecipients().remove(p); // TODO: it should be configurable } } diff --git a/src/main/java/fr/xephi/authme/util/Utils.java b/src/main/java/fr/xephi/authme/util/Utils.java index 327fc43d..7d9808be 100644 --- a/src/main/java/fr/xephi/authme/util/Utils.java +++ b/src/main/java/fr/xephi/authme/util/Utils.java @@ -139,7 +139,7 @@ public final class Utils { } if (!Settings.isForcedRegistrationEnabled) { - // TODO ljacqu 20151123: Use a setter to retrieve things from AuthMe + // TODO ljacqu 20151123: Use a getter to retrieve things from AuthMe if (!plugin.database.isAuthAvailable(player.getName())) { return true; } @@ -162,16 +162,16 @@ public final class Utils { * @param w String * @param pl Player */ - public static void packCoords(double x, double y, double z, String w, - final Player pl) { + public static void packCoords(double x, double y, double z, String w, final Player pl) { World theWorld; if (w.equals("unavailableworld")) { theWorld = pl.getWorld(); } else { theWorld = Bukkit.getWorld(w); } - if (theWorld == null) + if (theWorld == null) { theWorld = pl.getWorld(); + } final World world = theWorld; final Location loc = new Location(world, x, y, z);