simplify if checks

This commit is contained in:
David Markowitz 2024-04-03 04:04:02 -07:00
parent 02847c6849
commit 6c2f113604

View File

@ -123,18 +123,14 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& chat, Entity*
if (entity->GetGMLevel() >= commandHandle.requiredLevel) {
if (commandHandle.requiredLevel > eGameMasterLevel::CIVILIAN) Database::Get()->InsertSlashCommandUsage(entity->GetObjectID(), input);
commandHandle.handle(entity, sysAddr, args);
} else {
} else if (entity->GetGMLevel() != eGameMasterLevel::CIVILIAN) {
// We don't need to tell civilians they aren't high enough level
if (entity->GetGMLevel() != eGameMasterLevel::CIVILIAN) {
error = "You are not high enough GM level to use \"" + command + "\"";
}
}
} else {
} else if (entity->GetGMLevel() == eGameMasterLevel::CIVILIAN) {
// We don't need to tell civilians commands don't exist
if (entity->GetGMLevel() == eGameMasterLevel::CIVILIAN) {
error = "Command " + command + " does not exist!";
}
}
if (!error.empty()) {
GameMessages::SendSlashCommandFeedbackText(entity, GeneralUtils::ASCIIToUTF16(error));