领地改名和入场退场消息接入URL过滤逻辑
- 领地改名:输入新名字前先检测URL,包含链接则拒绝且不计入改名次数 - 入场/退场消息:设置消息前先检测URL,包含链接则拒绝且不保存 - 复用ChatFilterManager.extractUrls()统一过滤逻辑
This commit is contained in:
@@ -1731,6 +1731,18 @@ public class AreaCLIManager {
|
||||
showAnnouncementManagement(p, landName, 1); // 返回主菜单,不再进入编辑子页面
|
||||
return true;
|
||||
}
|
||||
|
||||
// ★ URL过滤:包含链接则拒绝,不保存
|
||||
ChatFilterManager cf = plugin.getChatFilter();
|
||||
if (cf != null) {
|
||||
java.util.List<String> urls = cf.extractUrls(message);
|
||||
if (!urls.isEmpty()) {
|
||||
p.sendMessage(Component.text("§c消息不能包含链接!"));
|
||||
// 保持pending状态,允许用户重新输入
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
String value = message.equals("清空") ? "" : message;
|
||||
|
||||
// 保存到内存
|
||||
|
||||
@@ -9631,6 +9631,16 @@ public class AreaProtection implements Listener {
|
||||
if (plugin.areaCLIManager != null) plugin.areaCLIManager.showLandManage(p, landName, 1);
|
||||
return true;
|
||||
}
|
||||
// ★ URL过滤:包含链接则拒绝,不计入改名次数
|
||||
ChatFilterManager cf = plugin.getChatFilter();
|
||||
if (cf != null) {
|
||||
java.util.List<String> urls = cf.extractUrls(message);
|
||||
if (!urls.isEmpty()) {
|
||||
p.sendMessage(Component.text("§c领地名不能包含链接!"));
|
||||
pendingEffectInput.put(p.getUniqueId(), new String[]{landName, "rename_land"});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
String newName = message.trim();
|
||||
String error = renameLand(p, landName, newName);
|
||||
if (error != null) {
|
||||
|
||||
Reference in New Issue
Block a user