Update version to v1.4.0

Updated to be compatible with new http server
Add all code headers
This commit is contained in:
2022-09-02 20:18:31 +08:00
parent b3bc0f051a
commit 623856ca99
23 changed files with 418 additions and 105 deletions

View File

@ -4,7 +4,7 @@ plugins {
} }
group 'com.github.jie65535.opencommand' group 'com.github.jie65535.opencommand'
version 'dev-1.3.0' version 'dev-1.4.0'
sourceCompatibility = 17 sourceCompatibility = 17
targetCompatibility = 17 targetCompatibility = 17

View File

@ -1,7 +1,23 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand; package com.github.jie65535.opencommand;
import com.github.jie65535.opencommand.socket.SocketClient; import com.github.jie65535.opencommand.socket.SocketClient;
import com.github.jie65535.opencommand.socket.SocketUtils;
import com.github.jie65535.opencommand.socket.packet.player.PlayerList; import com.github.jie65535.opencommand.socket.packet.player.PlayerList;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;

View File

@ -18,12 +18,43 @@
package com.github.jie65535.opencommand; package com.github.jie65535.opencommand;
public class OpenCommandConfig { public class OpenCommandConfig {
/**
* 控制台 Token
*/
public String consoleToken = ""; public String consoleToken = "";
/**
* 验证码过期时间单位秒
*/
public int codeExpirationTime_S = 60; public int codeExpirationTime_S = 60;
/**
* 临时Token过期时间单位秒
*/
public int tempTokenExpirationTime_S = 300; public int tempTokenExpirationTime_S = 300;
/**
* Token 最后使用过期时间单位小时
*/
public int tokenLastUseExpirationTime_H = 48; public int tokenLastUseExpirationTime_H = 48;
/**
* Socket 端口
*/
public int socketPort = 5746; public int socketPort = 5746;
/**
* Socket Token
*/
public String socketToken = ""; public String socketToken = "";
/**
* Socket 主机地址
*/
public String socketHost = "127.0.0.1"; public String socketHost = "127.0.0.1";
/**
* Socket 显示名称
*/
public String socketDisplayName = ""; public String socketDisplayName = "";
} }

View File

@ -25,10 +25,8 @@ import emu.grasscutter.server.http.Router;
import emu.grasscutter.utils.Crypto; import emu.grasscutter.utils.Crypto;
import emu.grasscutter.utils.MessageHandler; import emu.grasscutter.utils.MessageHandler;
import emu.grasscutter.utils.Utils; import emu.grasscutter.utils.Utils;
import express.Express;
import express.http.Request;
import express.http.Response;
import io.javalin.Javalin; import io.javalin.Javalin;
import io.javalin.http.Context;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
@ -40,8 +38,8 @@ import java.util.Map;
public final class OpenCommandHandler implements Router { public final class OpenCommandHandler implements Router {
@Override @Override
public void applyRoutes(Express express, Javalin javalin) { public void applyRoutes(Javalin javalin) {
express.post("/opencommand/api", OpenCommandHandler::handle); javalin.post("/opencommand/api", OpenCommandHandler::handle);
} }
private static final Map<String, Integer> clients = new HashMap<>(); private static final Map<String, Integer> clients = new HashMap<>();
@ -49,25 +47,24 @@ public final class OpenCommandHandler implements Router {
private static final Map<String, Integer> codes = new HashMap<>(); private static final Map<String, Integer> codes = new HashMap<>();
private static final Int2ObjectMap<Date> codeExpireTime = new Int2ObjectOpenHashMap<>(); private static final Int2ObjectMap<Date> codeExpireTime = new Int2ObjectOpenHashMap<>();
public static void handle(Request request, Response response) { public static void handle(Context context) {
// Trigger cleanup action // Trigger cleanup action
cleanupExpiredData(); cleanupExpiredData();
var plugin = OpenCommandPlugin.getInstance(); var plugin = OpenCommandPlugin.getInstance();
var config = plugin.getConfig(); var config = plugin.getConfig();
var now = new Date(); var now = new Date();
var req = request.body(JsonRequest.class); var req = context.bodyAsClass(JsonRequest.class);
response.type("application/json");
if (req.action.equals("sendCode")) { if (req.action.equals("sendCode")) {
int playerId = (int) req.data; int playerId = (int) req.data;
var player = plugin.getServer().getPlayerByUid(playerId); var player = plugin.getServer().getPlayerByUid(playerId);
if (player == null) { if (player == null) {
response.json(new JsonResponse(404, "Player Not Found.")); context.json(new JsonResponse(404, "Player Not Found."));
} else { } else {
if (codeExpireTime.containsKey(playerId)) { if (codeExpireTime.containsKey(playerId)) {
var expireTime = codeExpireTime.get(playerId); var expireTime = codeExpireTime.get(playerId);
if (now.before(expireTime)) { if (now.before(expireTime)) {
response.json(new JsonResponse(403, "Requests are too frequent")); context.json(new JsonResponse(403, "Requests are too frequent"));
return; return;
} }
} }
@ -81,52 +78,52 @@ public final class OpenCommandHandler implements Router {
codes.put(token, code); codes.put(token, code);
clients.put(token, playerId); clients.put(token, playerId);
player.dropMessage("[Open Command] Verification code: " + code); player.dropMessage("[Open Command] Verification code: " + code);
response.json(new JsonResponse(token)); context.json(new JsonResponse(token));
} }
return; return;
} else if (req.action.equals("ping")) { } else if (req.action.equals("ping")) {
response.json(new JsonResponse()); context.json(new JsonResponse());
return; return;
} else if (req.action.equals("online")) { } else if (req.action.equals("online")) {
var p = new ArrayList<String>(); var p = new ArrayList<String>();
plugin.getServer().getPlayers().forEach((uid, player) -> p.add(player.getNickname())); plugin.getServer().getPlayers().forEach((uid, player) -> p.add(player.getNickname()));
response.json(new JsonResponse(200, "Success", new SocketData.OnlinePlayer(p))); context.json(new JsonResponse(200, "Success", new SocketData.OnlinePlayer(p)));
return; return;
} }
// token is required // token is required
if (req.token == null || req.token.isEmpty()) { if (req.token == null || req.token.isEmpty()) {
response.json(new JsonResponse(401, "Unauthorized")); context.json(new JsonResponse(401, "Unauthorized"));
return; return;
} }
var isConsole = req.token.equals(config.consoleToken); var isConsole = req.token.equals(config.consoleToken);
if (!isConsole && !clients.containsKey(req.token)) { if (!isConsole && !clients.containsKey(req.token)) {
response.json(new JsonResponse(401, "Unauthorized")); context.json(new JsonResponse(401, "Unauthorized"));
return; return;
} }
if (isConsole) { if (isConsole) {
if (req.action.equals("verify")) { if (req.action.equals("verify")) {
response.json(new JsonResponse()); context.json(new JsonResponse());
return; return;
} else if (req.action.equals("command")) { } else if (req.action.equals("command")) {
//noinspection SynchronizationOnLocalVariableOrMethodParameter //noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (plugin) { synchronized (plugin) {
try { try {
plugin.getLogger().info(String.format("IP: %s run command in console > %s", request.ip(), req.data)); plugin.getLogger().info(String.format("IP: %s run command in console > %s", context.ip(), req.data));
var resultCollector = new MessageHandler(); var resultCollector = new MessageHandler();
EventListeners.setConsoleMessageHandler(resultCollector); EventListeners.setConsoleMessageHandler(resultCollector);
CommandMap.getInstance().invoke(null, null, req.data.toString()); CommandMap.getInstance().invoke(null, null, req.data.toString());
response.json(new JsonResponse(resultCollector.getMessage())); context.json(new JsonResponse(resultCollector.getMessage()));
} catch (Exception e) { } catch (Exception e) {
plugin.getLogger().warn("Run command failed.", e); plugin.getLogger().warn("Run command failed.", e);
EventListeners.setConsoleMessageHandler(null); EventListeners.setConsoleMessageHandler(null);
response.json(new JsonResponse(500, "error", e.getLocalizedMessage())); context.json(new JsonResponse(500, "error", e.getLocalizedMessage()));
} }
} }
return; return;
} else if (req.action.equals("runmode")) { } else if (req.action.equals("runmode")) {
response.json(new JsonResponse(200, "Success", 0)); context.json(new JsonResponse(200, "Success", 0));
return; return;
} }
} else if (codes.containsKey(req.token)) { } else if (codes.containsKey(req.token)) {
@ -135,10 +132,10 @@ public final class OpenCommandHandler implements Router {
codes.remove(req.token); codes.remove(req.token);
// update token expire time // update token expire time
tokenExpireTime.put(req.token, new Date(now.getTime() + config.tokenLastUseExpirationTime_H * 60L * 60L * 1000L)); tokenExpireTime.put(req.token, new Date(now.getTime() + config.tokenLastUseExpirationTime_H * 60L * 60L * 1000L));
response.json(new JsonResponse()); context.json(new JsonResponse());
plugin.getLogger().info(String.format("Player %d has passed the verification, ip: %s", clients.get(req.token), request.ip())); plugin.getLogger().info(String.format("Player %d has passed the verification, ip: %s", clients.get(req.token), context.ip()));
} else { } else {
response.json(new JsonResponse(400, "Verification failed")); context.json(new JsonResponse(400, "Verification failed"));
} }
return; return;
} }
@ -150,7 +147,7 @@ public final class OpenCommandHandler implements Router {
var player = plugin.getServer().getPlayerByUid(playerId); var player = plugin.getServer().getPlayerByUid(playerId);
var command = req.data.toString(); var command = req.data.toString();
if (player == null) { if (player == null) {
response.json(new JsonResponse(404, "Player not found")); context.json(new JsonResponse(404, "Player not found"));
return; return;
} }
// Player MessageHandler do not support concurrency // Player MessageHandler do not support concurrency
@ -160,10 +157,10 @@ public final class OpenCommandHandler implements Router {
var resultCollector = new MessageHandler(); var resultCollector = new MessageHandler();
player.setMessageHandler(resultCollector); player.setMessageHandler(resultCollector);
CommandMap.getInstance().invoke(player, player, command); CommandMap.getInstance().invoke(player, player, command);
response.json(new JsonResponse(resultCollector.getMessage())); context.json(new JsonResponse(resultCollector.getMessage()));
} catch (Exception e) { } catch (Exception e) {
plugin.getLogger().warn("Run command failed.", e); plugin.getLogger().warn("Run command failed.", e);
response.json(new JsonResponse(500, "error", e.getLocalizedMessage())); context.json(new JsonResponse(500, "error", e.getLocalizedMessage()));
} finally { } finally {
player.setMessageHandler(null); player.setMessageHandler(null);
} }
@ -171,7 +168,7 @@ public final class OpenCommandHandler implements Router {
return; return;
} }
} }
response.json(new JsonResponse(403, "forbidden")); context.json(new JsonResponse(403, "forbidden"));
} }
private static void cleanupExpiredData() { private static void cleanupExpiredData() {

View File

@ -29,10 +29,8 @@ import com.github.jie65535.opencommand.socket.packet.player.PlayerEnum;
import emu.grasscutter.server.http.Router; import emu.grasscutter.server.http.Router;
import emu.grasscutter.utils.Crypto; import emu.grasscutter.utils.Crypto;
import emu.grasscutter.utils.Utils; import emu.grasscutter.utils.Utils;
import express.Express;
import express.http.Request;
import express.http.Response;
import io.javalin.Javalin; import io.javalin.Javalin;
import io.javalin.http.Context;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
@ -43,8 +41,8 @@ import java.util.Map;
public final class OpenCommandOnlyHttpHandler implements Router { public final class OpenCommandOnlyHttpHandler implements Router {
@Override @Override
public void applyRoutes(Express express, Javalin javalin) { public void applyRoutes(Javalin javalin) {
express.post("/opencommand/api", OpenCommandOnlyHttpHandler::handle); javalin.post("/opencommand/api", OpenCommandOnlyHttpHandler::handle);
} }
private static final Map<String, Integer> clients = new HashMap<>(); private static final Map<String, Integer> clients = new HashMap<>();
@ -52,25 +50,24 @@ public final class OpenCommandOnlyHttpHandler implements Router {
private static final Map<String, Integer> codes = new HashMap<>(); private static final Map<String, Integer> codes = new HashMap<>();
private static final Int2ObjectMap<Date> codeExpireTime = new Int2ObjectOpenHashMap<>(); private static final Int2ObjectMap<Date> codeExpireTime = new Int2ObjectOpenHashMap<>();
public static void handle(Request request, Response response) { public static void handle(Context context) {
// Trigger cleanup action // Trigger cleanup action
cleanupExpiredData(); cleanupExpiredData();
var plugin = OpenCommandPlugin.getInstance(); var plugin = OpenCommandPlugin.getInstance();
var config = plugin.getConfig(); var config = plugin.getConfig();
var now = new Date(); var now = new Date();
var req = request.body(JsonRequest.class); var req = context.bodyAsClass(JsonRequest.class);
response.type("application/json");
if (req.action.equals("sendCode")) { if (req.action.equals("sendCode")) {
int playerId = (int) req.data; int playerId = (int) req.data;
var player = SocketData.getPlayer(playerId); var player = SocketData.getPlayer(playerId);
if (player == null) { if (player == null) {
response.json(new JsonResponse(404, "Player Not Found.")); context.json(new JsonResponse(404, "Player Not Found."));
} else { } else {
if (codeExpireTime.containsKey(playerId)) { if (codeExpireTime.containsKey(playerId)) {
var expireTime = codeExpireTime.get(playerId); var expireTime = codeExpireTime.get(playerId);
if (now.before(expireTime)) { if (now.before(expireTime)) {
response.json(new JsonResponse(403, "Requests are too frequent")); context.json(new JsonResponse(403, "Requests are too frequent"));
return; return;
} }
} }
@ -84,39 +81,39 @@ public final class OpenCommandOnlyHttpHandler implements Router {
codes.put(token, code); codes.put(token, code);
clients.put(token, playerId); clients.put(token, playerId);
Player.dropMessage(playerId, "[Open Command] Verification code: " + code); Player.dropMessage(playerId, "[Open Command] Verification code: " + code);
response.json(new JsonResponse(token)); context.json(new JsonResponse(token));
} }
return; return;
} else if (req.action.equals("ping")) { } else if (req.action.equals("ping")) {
response.json(new JsonResponse()); context.json(new JsonResponse());
return; return;
} else if (req.action.equals("online")) { } else if (req.action.equals("online")) {
response.json(new JsonResponse(200, "Success", SocketData.getOnlinePlayer())); context.json(new JsonResponse(200, "Success", SocketData.getOnlinePlayer()));
return; return;
} }
// token is required // token is required
if (req.token == null || req.token.isEmpty()) { if (req.token == null || req.token.isEmpty()) {
response.json(new JsonResponse(401, "Unauthorized")); context.json(new JsonResponse(401, "Unauthorized"));
return; return;
} }
var isConsole = req.token.equals(config.consoleToken); var isConsole = req.token.equals(config.consoleToken);
if (!isConsole && !clients.containsKey(req.token)) { if (!isConsole && !clients.containsKey(req.token)) {
response.json(new JsonResponse(401, "Unauthorized")); context.json(new JsonResponse(401, "Unauthorized"));
return; return;
} }
if (isConsole) { if (isConsole) {
if (req.action.equals("verify")) { if (req.action.equals("verify")) {
response.json(new JsonResponse()); context.json(new JsonResponse());
return; return;
} else if (req.action.equals("command")) { } else if (req.action.equals("command")) {
var server = SocketServer.getClientInfoByUuid(req.server); var server = SocketServer.getClientInfoByUuid(req.server);
if (server == null) { if (server == null) {
response.json(new JsonResponse(404, "Server Not Found.")); context.json(new JsonResponse(404, "Server Not Found."));
return; return;
} }
plugin.getLogger().info(String.format("IP: %s run command in console > %s", request.ip(), req.data)); plugin.getLogger().info(String.format("IP: %s run command in console > %s", context.ip(), req.data));
var wait = new SocketDataWait<HttpPacket>(2000L) { var wait = new SocketDataWait<HttpPacket>(2000L) {
@Override @Override
public void run() { public void run() {
@ -135,16 +132,16 @@ public final class OpenCommandOnlyHttpHandler implements Router {
SocketServer.sendPacketAndWait(server.ip, new RunConsoleCommand(req.data.toString()), wait); SocketServer.sendPacketAndWait(server.ip, new RunConsoleCommand(req.data.toString()), wait);
var data = wait.getData(); var data = wait.getData();
if (data == null) { if (data == null) {
response.json(new JsonResponse(408, "Timeout")); context.json(new JsonResponse(408, "Timeout"));
return; return;
} }
response.json(new JsonResponse(data.code, data.message, data.data)); context.json(new JsonResponse(data.code, data.message, data.data));
return; return;
} else if (req.action.equals("server")) { } else if (req.action.equals("server")) {
response.json(new JsonResponse(200, "Success", SocketServer.getOnlineClient())); context.json(new JsonResponse(200, "Success", SocketServer.getOnlineClient()));
return; return;
} else if (req.action.equals("runmode")) { } else if (req.action.equals("runmode")) {
response.json(new JsonResponse(200, "Success", 1)); context.json(new JsonResponse(200, "Success", 1));
return; return;
} }
} else if (codes.containsKey(req.token)) { } else if (codes.containsKey(req.token)) {
@ -153,10 +150,10 @@ public final class OpenCommandOnlyHttpHandler implements Router {
codes.remove(req.token); codes.remove(req.token);
// update token expire time // update token expire time
tokenExpireTime.put(req.token, new Date(now.getTime() + config.tokenLastUseExpirationTime_H * 60L * 60L * 1000L)); tokenExpireTime.put(req.token, new Date(now.getTime() + config.tokenLastUseExpirationTime_H * 60L * 60L * 1000L));
response.json(new JsonResponse()); context.json(new JsonResponse());
plugin.getLogger().info(String.format("Player %d has passed the verification, ip: %s", clients.get(req.token), request.ip())); plugin.getLogger().info(String.format("Player %d has passed the verification, ip: %s", clients.get(req.token), context.ip()));
} else { } else {
response.json(new JsonResponse(400, "Verification failed")); context.json(new JsonResponse(400, "Verification failed"));
} }
return; return;
} }
@ -187,21 +184,21 @@ public final class OpenCommandOnlyHttpHandler implements Router {
player.data = command; player.data = command;
if (!SocketServer.sendUidPacketAndWait(playerId, player, socketDataWait)) { if (!SocketServer.sendUidPacketAndWait(playerId, player, socketDataWait)) {
response.json(new JsonResponse(404, "Player Not Found.")); context.json(new JsonResponse(404, "Player Not Found."));
return; return;
} }
HttpPacket httpPacket = socketDataWait.getData(); HttpPacket httpPacket = socketDataWait.getData();
if (httpPacket == null) { if (httpPacket == null) {
response.json(new JsonResponse(500, "error", "Wait timeout")); context.json(new JsonResponse(500, "error", "Wait timeout"));
return; return;
} }
response.json(new JsonResponse(httpPacket.code, httpPacket.message)); context.json(new JsonResponse(httpPacket.code, httpPacket.message));
return; return;
} }
} }
response.json(new JsonResponse(403, "forbidden")); context.json(new JsonResponse(403, "forbidden"));
} }
private static void cleanupExpiredData() { private static void cleanupExpiredData() {

View File

@ -26,11 +26,9 @@ import emu.grasscutter.server.event.HandlerPriority;
import emu.grasscutter.server.event.game.ReceiveCommandFeedbackEvent; import emu.grasscutter.server.event.game.ReceiveCommandFeedbackEvent;
import emu.grasscutter.server.event.player.PlayerJoinEvent; import emu.grasscutter.server.event.player.PlayerJoinEvent;
import emu.grasscutter.server.event.player.PlayerQuitEvent; import emu.grasscutter.server.event.player.PlayerQuitEvent;
import emu.grasscutter.utils.JsonUtils;
import java.io.File; import java.io.*;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public final class OpenCommandPlugin extends Plugin { public final class OpenCommandPlugin extends Plugin {
@ -42,10 +40,15 @@ public final class OpenCommandPlugin extends Plugin {
private OpenCommandConfig config; private OpenCommandConfig config;
private Grasscutter.ServerRunMode runMode = Grasscutter.ServerRunMode.HYBRID;
@Override @Override
public void onLoad() { public void onLoad() {
instance = this; instance = this;
// 加载配置
loadConfig(); loadConfig();
// 启动Socket
startSocket();
} }
@Override @Override
@ -54,7 +57,7 @@ public final class OpenCommandPlugin extends Plugin {
.priority(HandlerPriority.HIGH) .priority(HandlerPriority.HIGH)
.listener(EventListeners::onCommandResponse) .listener(EventListeners::onCommandResponse)
.register(this); .register(this);
if (Grasscutter.getConfig().server.runMode == Grasscutter.ServerRunMode.GAME_ONLY) { if (runMode == Grasscutter.ServerRunMode.GAME_ONLY) {
// 仅运行游戏服务器时注册玩家加入和离开事件 // 仅运行游戏服务器时注册玩家加入和离开事件
new EventHandler<>(PlayerJoinEvent.class) new EventHandler<>(PlayerJoinEvent.class)
.priority(HandlerPriority.HIGH) .priority(HandlerPriority.HIGH)
@ -64,7 +67,7 @@ public final class OpenCommandPlugin extends Plugin {
.priority(HandlerPriority.HIGH) .priority(HandlerPriority.HIGH)
.listener(EventListeners::onPlayerQuit) .listener(EventListeners::onPlayerQuit)
.register(this); .register(this);
} else if (Grasscutter.getConfig().server.runMode == Grasscutter.ServerRunMode.DISPATCH_ONLY) { } else if (runMode == Grasscutter.ServerRunMode.DISPATCH_ONLY) {
getHandle().addRouter(OpenCommandOnlyHttpHandler.class); getHandle().addRouter(OpenCommandOnlyHttpHandler.class);
} else { } else {
getHandle().addRouter(OpenCommandHandler.class); getHandle().addRouter(OpenCommandHandler.class);
@ -86,29 +89,32 @@ public final class OpenCommandPlugin extends Plugin {
if (!configFile.exists()) { if (!configFile.exists()) {
config = new OpenCommandConfig(); config = new OpenCommandConfig();
try (var file = new FileWriter(configFile)) { try (var file = new FileWriter(configFile)) {
file.write(Grasscutter.getGsonFactory().toJson(config)); file.write(JsonUtils.encode(config));
} catch (IOException e) { } catch (IOException e) {
getLogger().error("[OpenCommand] Unable to write to config file."); getLogger().error("[OpenCommand] Unable to write to config file.");
} catch (Exception e) { } catch (Exception e) {
getLogger().error("[OpenCommand] Unable to save config file."); getLogger().error("[OpenCommand] Unable to save config file.");
} }
} else { } else {
try (var file = new FileReader(configFile)) { try {
config = Grasscutter.getGsonFactory().fromJson(file, OpenCommandConfig.class); config = JsonUtils.loadToClass(configFile.getAbsolutePath(), OpenCommandConfig.class);
} catch (Exception exception) { } catch (Exception exception) {
config = new OpenCommandConfig(); config = new OpenCommandConfig();
getLogger().error("[OpenCommand] There was an error while trying to load the configuration from config.json. Please make sure that there are no syntax errors. If you want to start with a default configuration, delete your existing config.json."); getLogger().error("[OpenCommand] There was an error while trying to load the configuration from config.json. Please make sure that there are no syntax errors. If you want to start with a default configuration, delete your existing config.json.");
} }
} }
// 启动Socket try {
startSocket(); runMode = Grasscutter.getConfig().server.runMode;
} catch (Exception ex) {
getLogger().warn("[OpenCommand] Failed to load server configuration, default HYBRID mode is being used.");
}
} }
private void startSocket() { private void startSocket() {
if (Grasscutter.getConfig().server.runMode == Grasscutter.ServerRunMode.GAME_ONLY) { if (runMode == Grasscutter.ServerRunMode.GAME_ONLY) {
getLogger().info("[OpenCommand] Starting socket client..."); getLogger().info("[OpenCommand] Starting socket client...");
SocketClient.connectServer(); SocketClient.connectServer();
} else if (Grasscutter.getConfig().server.runMode == Grasscutter.ServerRunMode.DISPATCH_ONLY) { } else if (runMode == Grasscutter.ServerRunMode.DISPATCH_ONLY) {
getLogger().info("[OpenCommand] Starting socket server..."); getLogger().info("[OpenCommand] Starting socket server...");
try { try {
SocketServer.startServer(); SocketServer.startServer();

View File

@ -1,3 +1,20 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket; package com.github.jie65535.opencommand.socket;
public class ClientInfo { public class ClientInfo {

View File

@ -1,3 +1,20 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket; package com.github.jie65535.opencommand.socket;
import com.github.jie65535.opencommand.EventListeners; import com.github.jie65535.opencommand.EventListeners;
@ -8,6 +25,7 @@ import com.github.jie65535.opencommand.socket.packet.player.Player;
import com.github.jie65535.opencommand.socket.packet.player.PlayerList; import com.github.jie65535.opencommand.socket.packet.player.PlayerList;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.CommandMap; import emu.grasscutter.command.CommandMap;
import emu.grasscutter.utils.JsonUtils;
import emu.grasscutter.utils.MessageHandler; import emu.grasscutter.utils.MessageHandler;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -122,18 +140,17 @@ public class SocketClient {
@Override @Override
public void run() { public void run() {
//noinspection InfiniteLoopStatement
while (true) { while (true) {
try { try {
if (exit) { if (exit) {
return; return;
} }
String data = SocketUtils.readString(is); String data = SocketUtils.readString(is);
Packet packet = Grasscutter.getGsonFactory().fromJson(data, Packet.class); Packet packet = JsonUtils.decode(data, Packet.class);
switch (packet.type) { switch (packet.type) {
// 玩家类 // 玩家类
case Player: case Player:
var player = Grasscutter.getGsonFactory().fromJson(packet.data, Player.class); var player = JsonUtils.decode(packet.data, Player.class);
switch (player.type) { switch (player.type) {
// 运行命令 // 运行命令
case RunCommand -> { case RunCommand -> {
@ -170,7 +187,7 @@ public class SocketClient {
} }
break; break;
case RunConsoleCommand: case RunConsoleCommand:
var consoleCommand = Grasscutter.getGsonFactory().fromJson(packet.data, RunConsoleCommand.class); var consoleCommand = JsonUtils.decode(packet.data, RunConsoleCommand.class);
var plugin = OpenCommandPlugin.getInstance(); var plugin = OpenCommandPlugin.getInstance();
//noinspection SynchronizationOnLocalVariableOrMethodParameter //noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (plugin) { synchronized (plugin) {

View File

@ -1,3 +1,20 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket; package com.github.jie65535.opencommand.socket;
import com.github.jie65535.opencommand.socket.packet.player.PlayerList; import com.github.jie65535.opencommand.socket.packet.player.PlayerList;

View File

@ -1,3 +1,20 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket; package com.github.jie65535.opencommand.socket;
// 异步等待数据返回 // 异步等待数据返回

View File

@ -1,9 +1,26 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket; package com.github.jie65535.opencommand.socket;
import com.github.jie65535.opencommand.OpenCommandPlugin; import com.github.jie65535.opencommand.OpenCommandPlugin;
import com.github.jie65535.opencommand.socket.packet.*; import com.github.jie65535.opencommand.socket.packet.*;
import com.github.jie65535.opencommand.socket.packet.player.PlayerList; import com.github.jie65535.opencommand.socket.packet.player.PlayerList;
import emu.grasscutter.Grasscutter; import emu.grasscutter.utils.JsonUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import java.io.IOException; import java.io.IOException;
@ -190,13 +207,12 @@ public class SocketServer {
@Override @Override
public void run() { public void run() {
// noinspection InfiniteLoopStatement
while (true) { while (true) {
try { try {
String data = SocketUtils.readString(is); String data = SocketUtils.readString(is);
Packet packet = Grasscutter.getGsonFactory().fromJson(data, Packet.class); Packet packet = JsonUtils.decode(data, Packet.class);
if (packet.type == PacketEnum.AuthPacket) { if (packet.type == PacketEnum.AuthPacket) {
AuthPacket authPacket = Grasscutter.getGsonFactory().fromJson(packet.data, AuthPacket.class); AuthPacket authPacket = JsonUtils.decode(packet.data, AuthPacket.class);
if (authPacket.token.equals(token)) { if (authPacket.token.equals(token)) {
auth = true; auth = true;
displayName = authPacket.displayName; displayName = authPacket.displayName;
@ -217,12 +233,12 @@ public class SocketServer {
switch (packet.type) { switch (packet.type) {
// 缓存玩家列表 // 缓存玩家列表
case PlayerList -> { case PlayerList -> {
PlayerList playerList = Grasscutter.getGsonFactory().fromJson(packet.data, PlayerList.class); PlayerList playerList = JsonUtils.decode(packet.data, PlayerList.class);
SocketData.playerList.put(address, playerList); SocketData.playerList.put(address, playerList);
} }
// Http信息返回 // Http信息返回
case HttpPacket -> { case HttpPacket -> {
HttpPacket httpPacket = Grasscutter.getGsonFactory().fromJson(packet.data, HttpPacket.class); HttpPacket httpPacket = JsonUtils.decode(packet.data, HttpPacket.class);
var socketWait = socketDataWaitList.get(packet.packetID); var socketWait = socketDataWaitList.get(packet.packetID);
if (socketWait == null) { if (socketWait == null) {
mLogger.error("[OpenCommand] HttpPacket: " + packet.packetID + " not found"); mLogger.error("[OpenCommand] HttpPacket: " + packet.packetID + " not found");
@ -232,9 +248,7 @@ public class SocketServer {
socketDataWaitList.remove(packet.packetID); socketDataWaitList.remove(packet.packetID);
} }
// 心跳包 // 心跳包
case HeartBeat -> { case HeartBeat -> clientTimeout.put(address, 0);
clientTimeout.put(address, 0);
}
} }
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -1,9 +1,25 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket; package com.github.jie65535.opencommand.socket;
import com.github.jie65535.opencommand.OpenCommandPlugin;
import com.github.jie65535.opencommand.socket.packet.BasePacket; import com.github.jie65535.opencommand.socket.packet.BasePacket;
import com.github.jie65535.opencommand.socket.packet.Packet; import com.github.jie65535.opencommand.socket.packet.Packet;
import emu.grasscutter.Grasscutter; import emu.grasscutter.utils.JsonUtils;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -26,7 +42,7 @@ public class SocketUtils {
packet.type = bPacket.getType(); packet.type = bPacket.getType();
packet.data = bPacket.getPacket(); packet.data = bPacket.getPacket();
packet.packetID = UUID.randomUUID().toString(); packet.packetID = UUID.randomUUID().toString();
return Grasscutter.getGsonFactory().toJson(packet); return JsonUtils.encode(packet);
} }
/** /**
@ -43,7 +59,7 @@ public class SocketUtils {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
list.add(packet.packetID); list.add(packet.packetID);
list.add(Grasscutter.getGsonFactory().toJson(packet)); list.add(JsonUtils.encode(packet));
return list; return list;
} }
@ -59,7 +75,7 @@ public class SocketUtils {
packet.type = bPacket.getType(); packet.type = bPacket.getType();
packet.data = bPacket.getPacket(); packet.data = bPacket.getPacket();
packet.packetID = packetID; packet.packetID = packetID;
return Grasscutter.getGsonFactory().toJson(packet); return JsonUtils.encode(packet);
} }
/** /**
@ -117,8 +133,7 @@ public class SocketUtils {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
String s = new String(sByte); return new String(sByte);
return s;
} }
/** /**

View File

@ -1,6 +1,23 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket.packet; package com.github.jie65535.opencommand.socket.packet;
import emu.grasscutter.Grasscutter; import emu.grasscutter.utils.JsonUtils;
public class AuthPacket extends BasePacket { public class AuthPacket extends BasePacket {
public String token; public String token;
@ -13,7 +30,7 @@ public class AuthPacket extends BasePacket {
@Override @Override
public String getPacket() { public String getPacket() {
return Grasscutter.getGsonFactory().toJson(this); return JsonUtils.encode(this);
} }
@Override @Override

View File

@ -1,3 +1,20 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket.packet; package com.github.jie65535.opencommand.socket.packet;
// 基本数据包 // 基本数据包

View File

@ -1,6 +1,23 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket.packet; package com.github.jie65535.opencommand.socket.packet;
import emu.grasscutter.Grasscutter; import emu.grasscutter.utils.JsonUtils;
// 心跳包 // 心跳包
public class HeartBeat extends BasePacket { public class HeartBeat extends BasePacket {
@ -12,7 +29,7 @@ public class HeartBeat extends BasePacket {
@Override @Override
public String getPacket() { public String getPacket() {
return Grasscutter.getGsonFactory().toJson(this); return JsonUtils.encode(this);
} }
@Override @Override

View File

@ -1,6 +1,23 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket.packet; package com.github.jie65535.opencommand.socket.packet;
import emu.grasscutter.Grasscutter; import emu.grasscutter.utils.JsonUtils;
// http返回数据 // http返回数据
public class HttpPacket extends BasePacket { public class HttpPacket extends BasePacket {
@ -24,7 +41,7 @@ public class HttpPacket extends BasePacket {
@Override @Override
public String getPacket() { public String getPacket() {
return Grasscutter.getGsonFactory().toJson(this); return JsonUtils.encode(this);
} }
@Override @Override

View File

@ -1,3 +1,20 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket.packet; package com.github.jie65535.opencommand.socket.packet;
// 数据包结构 // 数据包结构

View File

@ -1,3 +1,20 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket.packet; package com.github.jie65535.opencommand.socket.packet;
// 数据包类型列表 // 数据包类型列表

View File

@ -1,6 +1,23 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket.packet; package com.github.jie65535.opencommand.socket.packet;
import emu.grasscutter.Grasscutter; import emu.grasscutter.utils.JsonUtils;
public class RunConsoleCommand extends BasePacket { public class RunConsoleCommand extends BasePacket {
public String command; public String command;
@ -11,7 +28,7 @@ public class RunConsoleCommand extends BasePacket {
@Override @Override
public String getPacket() { public String getPacket() {
return Grasscutter.getGsonFactory().toJson(this); return JsonUtils.encode(this);
} }
@Override @Override

View File

@ -1,9 +1,26 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket.packet.player; package com.github.jie65535.opencommand.socket.packet.player;
import com.github.jie65535.opencommand.socket.SocketServer; import com.github.jie65535.opencommand.socket.SocketServer;
import com.github.jie65535.opencommand.socket.packet.BasePacket; import com.github.jie65535.opencommand.socket.packet.BasePacket;
import com.github.jie65535.opencommand.socket.packet.PacketEnum; import com.github.jie65535.opencommand.socket.packet.PacketEnum;
import emu.grasscutter.Grasscutter; import emu.grasscutter.utils.JsonUtils;
// 玩家操作类 // 玩家操作类
public class Player extends BasePacket { public class Player extends BasePacket {
@ -13,7 +30,7 @@ public class Player extends BasePacket {
@Override @Override
public String getPacket() { public String getPacket() {
return Grasscutter.getGsonFactory().toJson(this); return JsonUtils.encode(this);
} }
@Override @Override

View File

@ -1,3 +1,20 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket.packet.player; package com.github.jie65535.opencommand.socket.packet.player;
// 玩家操作列表 // 玩家操作列表

View File

@ -1,9 +1,25 @@
/*
* gc-opencommand
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.opencommand.socket.packet.player; package com.github.jie65535.opencommand.socket.packet.player;
import com.github.jie65535.opencommand.socket.packet.BasePacket; import com.github.jie65535.opencommand.socket.packet.BasePacket;
import com.github.jie65535.opencommand.socket.packet.PacketEnum; import com.github.jie65535.opencommand.socket.packet.PacketEnum;
import emu.grasscutter.Grasscutter; import emu.grasscutter.utils.JsonUtils;
import emu.grasscutter.game.player.Player;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -18,7 +34,7 @@ public class PlayerList extends BasePacket {
@Override @Override
public String getPacket() { public String getPacket() {
return Grasscutter.getGsonFactory().toJson(this); return JsonUtils.encode(this);
} }
@Override @Override

View File

@ -1,7 +1,7 @@
{ {
"name": "opencommand-plugin", "name": "opencommand-plugin",
"description": "Open command interface for third-party clients", "description": "Open command interface for third-party clients",
"version": "dev-1.3.0", "version": "dev-1.4.0",
"mainClass": "com.github.jie65535.opencommand.OpenCommandPlugin", "mainClass": "com.github.jie65535.opencommand.OpenCommandPlugin",
"authors": ["jie65535"] "authors": ["jie65535"]
} }