邮箱校验拒绝时显示允许的后缀列表:新增getAllowedSuffixHint()方法,3处校验点全部附带提示

This commit is contained in:
2026-07-18 18:42:16 +08:00
parent 3f7f7f6c33
commit c6e4e0a520
2 changed files with 33 additions and 0 deletions
@@ -256,6 +256,33 @@ public class ConfigManager {
return true;
}
/**
* 获取允许的邮箱后缀提示信息
* @return 如 "允许的后缀: @qq.com, @163.com" 或空字符串
*/
public String getAllowedSuffixHint() {
String mode = getEmailValidationMode();
if ("默认".equals(mode)) return "";
String suffixList = getEmailSuffixList();
if (suffixList == null || suffixList.trim().isEmpty()) return "";
String[] suffixes = suffixList.split("[,;\\n]+");
StringBuilder sb = new StringBuilder();
for (String s : suffixes) {
String t = s.trim();
if (!t.isEmpty()) {
if (sb.length() > 0) sb.append(", ");
sb.append("@").append(t);
}
}
if (sb.length() == 0) return "";
if ("白名单".equals(mode)) {
return "§7允许的后缀: " + sb.toString();
} else if ("黑名单".equals(mode)) {
return "§7以下后缀被禁止: " + sb.toString();
}
return "";
}
public void saveSmtp() {
File file = new File(dataFolder, "SMTP设置.txt");
List<String> L = new ArrayList<>();
+6
View File
@@ -6055,6 +6055,8 @@ public class Main extends JavaPlugin
} else if ("黑名单".equals(mode)) {
p2.sendMessage("§c该邮箱后缀被禁止使用");
}
String hint = config.getAllowedSuffixHint();
if (!hint.isEmpty()) p2.sendMessage(hint);
return true;
}
String oldEmail = (String) db.getField(
@@ -6175,6 +6177,8 @@ public class Main extends JavaPlugin
} else if ("黑名单".equals(mode)) {
p2.sendMessage("§c该邮箱后缀被禁止使用");
}
String hint = config.getAllowedSuffixHint();
if (!hint.isEmpty()) p2.sendMessage(hint);
return true;
}
String oldEmail = (String) db.getField(
@@ -6814,6 +6818,8 @@ public class Main extends JavaPlugin
} else if ("黑名单".equals(mode)) {
p2.sendMessage("§c该邮箱后缀被禁止使用");
}
String hint = config.getAllowedSuffixHint();
if (!hint.isEmpty()) p2.sendMessage(hint);
return true;
}
String oldEmail = (String) db.getField(