[功能] 向 authme.admin.whitelistmessage

权限节点添加没有注册资格的玩家尝试入服的提醒
This commit is contained in:
Sattera
2023-06-24 18:47:26 +08:00
parent b1bee0967c
commit 110fc7266d
4 changed files with 10 additions and 0 deletions
@@ -7,6 +7,7 @@ import fr.xephi.authme.initialization.Reloadable;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages;
import fr.xephi.authme.output.ConsoleLoggerFactory;
import fr.xephi.authme.permission.AdminPermission;
import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.permission.PlayerStatePermission;
import fr.xephi.authme.service.AntiBotService;
@@ -87,6 +88,10 @@ public class OnJoinVerifier implements Reloadable {
public void checkWhitelist(String name, boolean isAuthAvailable) throws FailedVerificationException {
if (isAuthAvailable || permissionsManager.hasPermissionOffline(name, PlayerStatePermission.WHITELIST)) {
return;
} else {
bukkitService.getOnlinePlayers().stream()
.filter(player -> permissionsManager.hasPermission(player, AdminPermission.WHITELIST_MESSAGE))
.forEach(player -> messages.send(player, MessageKey.WHITELIST_KICK, name));
}
if (whiteListService.shouldKick()) {
throw new FailedVerificationException(MessageKey.KICK_WHITELIST);
@@ -199,6 +199,7 @@ public enum MessageKey {
/** [AntiBotService] AntiBot disabled after %m minutes! */
ANTIBOT_AUTO_DISABLED_MESSAGE("antibot.auto_disabled", "%m"),
WHITELIST_KICK("misc.whitelist_kick", "%p"),
/** The email address is already being used */
EMAIL_ALREADY_USED_ERROR("email.already_used"),