Improve command system

This commit is contained in:
Melledy
2025-11-25 23:09:20 -08:00
parent fd8e8925ca
commit 2acd506245
19 changed files with 175 additions and 172 deletions

View File

@@ -23,27 +23,11 @@ public class HandlerPlayerSignatureEdit extends NetHandler {
// Check if we need to handle a command
if (signature.charAt(0) == '!' || signature.charAt(0) == '/') {
String commandLabel = signature.toLowerCase().trim();
if (commandLabel.startsWith("!") || commandLabel.startsWith("/")) {
commandLabel = commandLabel.substring(1).split(" ")[0];
}
Nebula.getCommandManager().invoke(session.getPlayer(), signature);
// If this is the remote command, return the message
if ("remote".equals(commandLabel)) {
String remoteMessage = emu.nebula.command.commands.RemoteKeyCommand.getLastMessage();
if (remoteMessage != null) {
return session.encodeMsg(
NetMsgId.player_signature_edit_failed_ack,
Error.newInstance().setCode(119902).addArguments("\n" + remoteMessage)
);
}
}
var result = Nebula.getCommandManager().invoke(session.getPlayer(), signature);
return session.encodeMsg(
NetMsgId.player_signature_edit_failed_ack,
Error.newInstance().setCode(119902).addArguments("\nCommand Success")
Error.newInstance().setCode(119902).addArguments("\nCommand Result: " + result.getMessage())
);
}