This commit is contained in:
ljacqu 2015-11-24 23:32:54 +01:00
commit 0065a6a827
2 changed files with 10 additions and 4 deletions

View File

@ -57,11 +57,17 @@ public class AuthMePlayerListener implements Listener {
* @param event AsyncPlayerChatEvent
*/
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 (Settings.isChatAllowed) {
return;
}
Player player = event.getPlayer();
if (Utils.checkAuth(player)) {
return;
}
@ -214,7 +220,7 @@ public class AuthMePlayerListener implements Listener {
*/
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerJoin(PlayerJoinEvent event) {
if (event.getPlayer() == null) {
if (event.getPlayer() == null || Utils.isNPC(event.getPlayer())) {
return;
}
@ -250,7 +256,7 @@ public class AuthMePlayerListener implements Listener {
public void onPreLogin(AsyncPlayerPreLoginEvent event) {
final String name = event.getName().toLowerCase();
final Player player = Utils.getPlayer(name);
if (player == null) {
if (player == null || Utils.isNPC(player)) {
return;
}

View File

@ -130,7 +130,7 @@ public final class Utils {
// TODO: Move to a Manager
public static boolean checkAuth(Player player) {
if (player == null || Utils.isUnrestricted(player)) {
if (player == null || Utils.isUnrestricted(player) || Utils.isNPC(player)) {
return true;
}