This commit is contained in:
@@ -1269,6 +1269,11 @@ public class AIChatManager {
|
|||||||
private String sanitizeReply(String reply) {
|
private String sanitizeReply(String reply) {
|
||||||
if (reply == null || reply.isEmpty()) return reply;
|
if (reply == null || reply.isEmpty()) return reply;
|
||||||
String r = reply.trim();
|
String r = reply.trim();
|
||||||
|
// ★ 第84批:trim 后为空(纯空白/换行/空格)→ 返回婉拒,不广播空白
|
||||||
|
if (r.isEmpty()) {
|
||||||
|
plugin.getLogger().warning("[AI聊天] 输出守卫:回复为纯空白,拦截");
|
||||||
|
return fallbackDodge();
|
||||||
|
}
|
||||||
|
|
||||||
// 1. 代码围栏(强信号,一定是破甲了)
|
// 1. 代码围栏(强信号,一定是破甲了)
|
||||||
if (r.contains("```")) {
|
if (r.contains("```")) {
|
||||||
@@ -1470,7 +1475,13 @@ public class AIChatManager {
|
|||||||
if (first.has("message")) {
|
if (first.has("message")) {
|
||||||
JsonObject message = first.getAsJsonObject("message");
|
JsonObject message = first.getAsJsonObject("message");
|
||||||
if (message.has("content")) {
|
if (message.has("content")) {
|
||||||
return message.get("content").getAsString();
|
String content = message.get("content").getAsString();
|
||||||
|
if (content != null && !content.trim().isEmpty()) {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
// ★ 第84批:content 为空/空白 → 返回 null,让上层走失败分支
|
||||||
|
plugin.getLogger().warning("[AI聊天] 模型返回空 content,忽略");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1556,6 +1556,25 @@ public class CreditManager {
|
|||||||
+ " §7目标当前积分: §e" + formatScore(newScore));
|
+ " §7目标当前积分: §e" + formatScore(newScore));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// ★ 第84批:/credits <玩家名> clear — 管理员清空积分归零
|
||||||
|
if (arg1Lower.equals("clear")) {
|
||||||
|
boolean isAdmin;
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
isAdmin = plugin.isAdmin((Player) sender);
|
||||||
|
} else {
|
||||||
|
isAdmin = true; // 控台默认有权限
|
||||||
|
}
|
||||||
|
if (!isAdmin) {
|
||||||
|
sender.sendMessage("§c§l[信誉积分] §c权限不足");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
String clearTarget = args[0];
|
||||||
|
double oldScore = getScore(clearTarget);
|
||||||
|
setScore(clearTarget, DEFAULT_INIT_SCORE);
|
||||||
|
sender.sendMessage("§d§l[信誉积分] §f已将 " + clearTarget + " 的积分从 §e" + formatScore(oldScore)
|
||||||
|
+ " §7重置为初始值 §e" + DEFAULT_INIT_SCORE);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!isSubCommand && args.length >= 1) {
|
if (!isSubCommand && args.length >= 1) {
|
||||||
// 直接是玩家名 → 查询积分
|
// 直接是玩家名 → 查询积分
|
||||||
@@ -1668,30 +1687,6 @@ public class CreditManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ★ /credits user clear <玩家名> — 管理员清空积分归零到初始值
|
|
||||||
if (arg1.equals("clear")) {
|
|
||||||
if (args.length < 3) {
|
|
||||||
sender.sendMessage("§c用法: /credits user clear <玩家名>");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
boolean isAdmin;
|
|
||||||
if (sender instanceof Player) {
|
|
||||||
isAdmin = plugin.isAdmin((Player) sender);
|
|
||||||
} else {
|
|
||||||
isAdmin = true; // 控台默认有权限
|
|
||||||
}
|
|
||||||
if (!isAdmin) {
|
|
||||||
sender.sendMessage("§c§l[信誉积分] §c权限不足");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
String clearTarget = args[2];
|
|
||||||
double oldScore = getScore(clearTarget);
|
|
||||||
setScore(clearTarget, DEFAULT_INIT_SCORE);
|
|
||||||
sender.sendMessage("§d§l[信誉积分] §f已将 " + clearTarget + " 的积分从 §e" + formatScore(oldScore)
|
|
||||||
+ " §7重置为初始值 §e" + DEFAULT_INIT_SCORE);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// /credits user <玩家名> [give/remove <数值> [备注>] — 查积分或快捷加减分
|
// /credits user <玩家名> [give/remove <数值> [备注>] — 查积分或快捷加减分
|
||||||
String targetName = args[1];
|
String targetName = args[1];
|
||||||
// 检查是否有第三个参数 give/remove
|
// 检查是否有第三个参数 give/remove
|
||||||
|
|||||||
Reference in New Issue
Block a user