mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-30 22:23:54 +01:00
Makes only authenticated players chat recipients that will be filtered
This commit is contained in:
parent
30cdf6b1e0
commit
fc87ea4eef
@ -57,16 +57,20 @@ public class AuthMePlayerListener implements Listener {
|
||||
* @param event AsyncPlayerChatEvent
|
||||
*/
|
||||
private void handleChat(AsyncPlayerChatEvent event) {
|
||||
if (Settings.isChatAllowed || Utils.checkAuth(event.getPlayer())) {
|
||||
if (Settings.isChatAllowed) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if(Utils.checkAuth(player)) {
|
||||
for (Player p : Utils.getOnlinePlayers()) {
|
||||
if (!PlayerCache.getInstance().isAuthenticated(p.getName())) {
|
||||
event.getRecipients().remove(p); // TODO: it should be configurable
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
Loading…
Reference in New Issue
Block a user