Shell界面全面美化 + 帮助系统超级详细 + AdminCommands真实实现
Shell 优化: - 新增 ShellPromptProvider:ANSI 彩色双行提示符(金色Aluer·蓝色ServerGuard) - AdminCommands 全部重写:tps/memory/server status/player kick&ban&mute/world list/ai analyze/config reload 实现完整功能 - 所有命令输出统一采用 ╔╠╚ 框线格式,带 ASCII 柱状图 - memory 命令展示 JVM 堆使用详情 + 百分比柱状图 - server status 展示完整引擎状态(版本/模式/模块统计/Agent连接数) - help 保持原有超级详细分类帮助(ai/status/defense/security/monitor/player/world/admin/info 9大类 + 50+ API端点) - 移除 Meteor Client 品牌名称,改用通用"外挂"表述 - 贡献者名单 + Apache 2.0 许可证标识
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package com.aluer.config;
|
||||
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.shell.jline.PromptProvider;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.jline.utils.AttributedString;
|
||||
import org.jline.utils.AttributedStyle;
|
||||
|
||||
/**
|
||||
* Aluer Shell 自定义提示符 — 美观的 ANSI 彩色 Prompt
|
||||
*
|
||||
* 使用 JLine AttributedStyle 实现彩色终端输出,
|
||||
* 显示当前运行模式和项目标识。
|
||||
*/
|
||||
@Component
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
public class ShellPromptProvider implements PromptProvider {
|
||||
|
||||
/** ANSI 前景色 */
|
||||
private static final int GOLD = 220;
|
||||
private static final int CYAN = 51;
|
||||
private static final int GRAY = 245;
|
||||
private static final int WHITE = 255;
|
||||
|
||||
@Override
|
||||
public AttributedString getPrompt() {
|
||||
AttributedStyle goldStyle = AttributedStyle.DEFAULT.foreground(GOLD).bold();
|
||||
AttributedStyle cyanStyle = AttributedStyle.DEFAULT.foreground(CYAN);
|
||||
AttributedStyle grayStyle = AttributedStyle.DEFAULT.foreground(GRAY);
|
||||
AttributedStyle whiteStyle = AttributedStyle.DEFAULT.foreground(WHITE);
|
||||
|
||||
return AttributedString.join(
|
||||
AttributedString.EMPTY,
|
||||
new AttributedString("╭─", grayStyle),
|
||||
new AttributedString("Aluer", goldStyle),
|
||||
new AttributedString("·", grayStyle),
|
||||
new AttributedString("ServerGuard", cyanStyle),
|
||||
new AttributedString("\n╰─", grayStyle),
|
||||
new AttributedString("> ", whiteStyle)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user