mirror of
https://github.com/redstrate/Kawari.git
synced 2025-06-30 11:47:45 +00:00
Log in-game and in the server when encountering an unknown command
Instead of printing nothing and you're just left scratching your head.
This commit is contained in:
parent
f07d16b949
commit
bb2cc9e0ec
2 changed files with 16 additions and 0 deletions
|
@ -13,6 +13,10 @@ function onCommandRequiredRankMissingError(additional_information, player)
|
||||||
player:send_message(string.format("%s\nAdditional information: %s", error_msg, additional_information))
|
player:send_message(string.format("%s\nAdditional information: %s", error_msg, additional_information))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function onUnknownCommandError(command_name, player)
|
||||||
|
player:send_message(string.format("Unknown command %s", command_name))
|
||||||
|
end
|
||||||
|
|
||||||
function split(input, separator)
|
function split(input, separator)
|
||||||
if separator == nil then
|
if separator == nil then
|
||||||
separator = '%s'
|
separator = '%s'
|
||||||
|
|
|
@ -564,6 +564,18 @@ async fn client_loop(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
} else {
|
||||||
|
tracing::info!("Unknown command {command_name}");
|
||||||
|
|
||||||
|
lua.scope(|scope| {
|
||||||
|
let connection_data = scope
|
||||||
|
.create_userdata_ref_mut(&mut lua_player)
|
||||||
|
.unwrap();
|
||||||
|
let func: Function =
|
||||||
|
lua.globals().get("onUnknownCommandError").unwrap();
|
||||||
|
func.call::<()>((command_name, connection_data)).unwrap();
|
||||||
|
Ok(())
|
||||||
|
}).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue