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.
This commit is contained in:
drtshock 2015-12-06 12:30:40 -08:00
parent 1a701e69ca
commit 6fc19b92eb
1 changed files with 5 additions and 0 deletions

View File

@ -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();
}
}