Package com.github.theword.queqiao.tool
Class GlobalContext
java.lang.Object
com.github.theword.queqiao.tool.GlobalContext
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidexecuteReloadCommand(Object commandReturner) 执行全局重载命令static Configstatic com.google.gson.GsongetGson()static HandleApiServicestatic org.slf4j.Loggerstatic com.google.gson.JsonElement获取消息前缀的 JsonElementstatic Stringstatic Stringstatic WebsocketManagerstatic voidinit(boolean isModServer, String serverVersion, String serverType, HandleApiService handleApiImpl, HandleCommandReturnMessageService handleCommandReturnMessageImpl) static com.google.gson.JsonElementinitMessagePrefixJsonObject(String messagePrefixText) 初始化消息前缀 JsonObjectstatic booleanstatic void同时向所有已连接的 WebSocket 客户端和服务端广播事件static StringsendRconCommand(String command) 发送 Rcon 命令static voidstatic voidsetLogger(org.slf4j.Logger logger) static voidshutdown()关闭鹊桥static String翻译指定键值
-
Constructor Details
-
GlobalContext
public GlobalContext()
-
-
Method Details
-
init
public static void init(boolean isModServer, String serverVersion, String serverType, HandleApiService handleApiImpl, HandleCommandReturnMessageService handleCommandReturnMessageImpl) -
executeReloadCommand
执行全局重载命令1. 先重新读取配置文件
2. 加载翻译功能
3. 再重新连接所有 Websocket Client
4. 重连 Rcon
- Parameters:
commandReturner- 命令返回者
-
shutdown
public static void shutdown()关闭鹊桥 -
sendEvent
同时向所有已连接的 WebSocket 客户端和服务端广播事件- Parameters:
baseEvent- 事件对象
-
sendRconCommand
发送 Rcon 命令- Parameters:
command- 命令- Returns:
- 命令返回结果
- Throws:
IOException
-
initMessagePrefixJsonObject
初始化消息前缀 JsonObject自 0.6.0 开始,支持对 "" 前缀的处理,对 Json 更加智能的处理
- Returns:
- JsonElement 消息前缀
- Since:
- 0.6.0
-
isTranslationEnabled
public static boolean isTranslationEnabled() -
translate
翻译指定键值- Parameters:
key- 翻译键值args- 翻译参数- Returns:
- 翻译结果
- Since:
- 0.6.0
-
getConfig
-
setConfig
-
getLogger
public static org.slf4j.Logger getLogger() -
setLogger
public static void setLogger(org.slf4j.Logger logger) -
getWebsocketManager
-
getHandleApiService
-
getHandleCommandReturnMessageService
-
getServerVersion
-
getServerType
-
getGson
public static com.google.gson.Gson getGson() -
getMessagePrefixJsonObject
public static com.google.gson.JsonElement getMessagePrefixJsonObject()获取消息前缀的 JsonElement自 0.6.0 开始,返回类型从
JsonObject改为JsonElement- Returns:
- JsonElement 消息前缀
- Since:
- 0.6.0
-