[功能] 向 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

View File

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

View File

@ -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"),

View File

@ -67,6 +67,7 @@ misc:
accounts_owned_other: '玩家 %name 拥有 %count 个账户:'
whitelist_enabled: '&c*** 服务器已暂停注册 ***'
whitelist_disabled: '&a*** 服务器已开放注册 ***'
whitelist_kick: '&7玩家 &c%p &7请求加入服务器,但是被拒绝了.'
# Session messages
session:

View File

@ -184,6 +184,9 @@ permissions:
authme.bypassantibot:
description: Permission node to bypass AntiBot protection.
default: op
authme.whitelist:
description: Permission node to whitelist.
default: op
authme.bypasscountrycheck:
description: Permission to bypass the GeoIp country code check.
default: false