diff --git a/src/endstone_core/permissions/permissible_base.cpp b/src/endstone_core/permissions/permissible_base.cpp index c13c6defc..b2a88848b 100644 --- a/src/endstone_core/permissions/permissible_base.cpp +++ b/src/endstone_core/permissions/permissible_base.cpp @@ -171,12 +171,14 @@ void PermissibleBase::calculateChildPermissions(const std::unordered_map(parent_, name, attachment, value); plugin_manager.subscribeToPermission(name, parent_); - auto *perm = plugin_manager.getPermission(name); if (perm != nullptr) { calculateChildPermissions(perm->getChildren(), !value, attachment); } diff --git a/src/endstone_core/player.cpp b/src/endstone_core/player.cpp index 0640e866e..c6cccf515 100644 --- a/src/endstone_core/player.cpp +++ b/src/endstone_core/player.cpp @@ -429,14 +429,15 @@ void EndstonePlayer::updateCommands() const AvailableCommandsPacket packet = registry.serializeAvailableCommands(); auto &command_map = server_.getCommandMap(); - for (auto &data : packet.commands) { - auto name = data.name; + for (auto it = packet.commands.begin(); it != packet.commands.end();) { + auto &name = it->name; auto *command = command_map.getCommand(name); - if (command && command->isRegistered() && command->testPermissionSilently(*static_cast(this))) { + if (command && command->isRegistered() && command->testPermissionSilently(*static_cast(this)) && + it->permission_level <= CommandPermissionLevel::GameDirectors) { + ++it; continue; } - data.command_flag |= (CommandFlag::HiddenFromPlayer | CommandFlag::HiddenFromBlock); - data.permission_level = CommandPermissionLevel::Internal; + it = packet.commands.erase(it); } getHandle().sendNetworkPacket(packet);