mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-12 12:24:35 +01:00
Improve remote command execution response results
- Ensure that commands return specific messages instead of fixed strings after execution
This commit is contained in:
@@ -40,11 +40,11 @@ public class RemoteHandler implements Handler {
|
||||
|
||||
// Check admin key
|
||||
if (token.equals(adminKey)) {
|
||||
Nebula.getCommandManager().invoke(null, command);
|
||||
var commandResult = Nebula.getCommandManager().invoke(null, command);
|
||||
Nebula.getLogger().warn("\u001B[38;2;252;186;3mRemote Server (Using Admin Key) sent command: /" + command + "\u001B[0m");
|
||||
ctx.status(200);
|
||||
ctx.contentType(ContentType.APPLICATION_JSON);
|
||||
ctx.result("{\"Code\":200,\"Data\":{},\"Msg\":\"Command executed\"}");
|
||||
ctx.result("{\"Code\":200,\"Data\":{},\"Msg\":\"" + commandResult.getMessage() + "\"}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -78,11 +78,11 @@ public class RemoteHandler implements Handler {
|
||||
Nebula.getLogger().info("Remote Player Request [" + player.getUid() + "]: " + finalCommand);
|
||||
|
||||
// Execute as console (null sender) but targeting the player
|
||||
Nebula.getCommandManager().invoke(null, finalCommand);
|
||||
var commandResult = Nebula.getCommandManager().invoke(null, finalCommand);
|
||||
|
||||
ctx.status(200);
|
||||
ctx.contentType(ContentType.APPLICATION_JSON);
|
||||
ctx.result("{\"Code\":200,\"Data\":{},\"Msg\":\"Command executed\"}");
|
||||
ctx.result("{\"Code\":200,\"Data\":{},\"Msg\":\"" + commandResult.getMessage() + "\"}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user