From 6fc19b92ebcb20763bf01d8d87eaec69e36a3b31 Mon Sep 17 00:00:00 2001 From: drtshock Date: Sun, 6 Dec 2015 12:30:40 -0800 Subject: [PATCH] Turn off socialspy on login if player doesn't have the permission. This fixes the case where players had socialspy enabled, lost the permission for it (got demoted) and then someone had to manually check and disable it for them as described in #299. --- .../com/earth2me/essentials/EssentialsPlayerListener.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 69440b334..8f3de0618 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -284,6 +284,11 @@ public class EssentialsPlayerListener implements Listener { user.getBase().setWalkSpeed(0.2f); } + if (user.isSocialSpyEnabled() && !user.isAuthorized("essentials.socialspy")) { + user.setSocialSpyEnabled(false); + ess.getLogger().log(Level.INFO, "Set socialspy to false for {0} because they had it enabled without permission.", user.getName()); + } + user.stopTransaction(); } }