From 20f435cc3d2d275d1e89c0738170c35ed021f976 Mon Sep 17 00:00:00 2001 From: Feffy <74392505+FeffyLaffy@users.noreply.github.com> Date: Fri, 10 Jun 2022 15:23:52 +0800 Subject: [PATCH] change nickname with space (#12) --- src/command/cmd_nick.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/command/cmd_nick.cpp b/src/command/cmd_nick.cpp index 88d1588..08869ea 100644 --- a/src/command/cmd_nick.cpp +++ b/src/command/cmd_nick.cpp @@ -7,8 +7,11 @@ namespace command { ctx.server_peer->send_log(fmt::format("`4Usage: ``{}nickname ", ctx.prefix)); return; } - - ctx.server_peer->send_variant({ "OnNameChanged", ctx.args[0] }, ctx.local_player->get_net_id()); - ctx.server_peer->send_log(fmt::format("Display name changed to {}", ctx.args[0])); + std::string name{ ctx.args.front() }; + for (size_t i = 1; i < ctx.args.size(); ++i) { + name += " " + ctx.args[i]; + } + ctx.server_peer->send_variant({ "OnNameChanged", name }, ctx.local_player->get_net_id()); + ctx.server_peer->send_log(fmt::format("Display name changed to {}", name)); } -} \ No newline at end of file +}