From c555b4197b50fe380879a45528b143b4685f7618 Mon Sep 17 00:00:00 2001 From: Robin Date: Wed, 10 May 2023 14:52:32 +0000 Subject: [PATCH] Remove unable to update groups catch (#3360) --- modules/Core/classes/Misc/CoreApiErrors.php | 1 - .../endpoints/UpdateGroupsEndpoint.php | 20 ++++++++----------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/modules/Core/classes/Misc/CoreApiErrors.php b/modules/Core/classes/Misc/CoreApiErrors.php index 9b0cb5ab7b..a5b1d0c40b 100644 --- a/modules/Core/classes/Misc/CoreApiErrors.php +++ b/modules/Core/classes/Misc/CoreApiErrors.php @@ -36,7 +36,6 @@ class CoreApiErrors { public const ERROR_USER_ALREADY_ACTIVE = 'core:user_already_active'; public const ERROR_UNABLE_TO_UPDATE_USERNAME = 'core:unable_to_update_username'; - public const ERROR_UNABLE_TO_UPDATE_GROUPS = 'core:unable_to_update_groups'; public const ERROR_INTEGRATION_IDENTIFIER_ERRORS = 'core:integration_identifier_errors'; public const ERROR_INTEGRATION_USERNAME_ERRORS = 'core:integration_username_errors'; diff --git a/modules/Core/includes/endpoints/UpdateGroupsEndpoint.php b/modules/Core/includes/endpoints/UpdateGroupsEndpoint.php index 279a1ee57f..4a8fe0f396 100644 --- a/modules/Core/includes/endpoints/UpdateGroupsEndpoint.php +++ b/modules/Core/includes/endpoints/UpdateGroupsEndpoint.php @@ -16,20 +16,16 @@ public function execute(Nameless2API $api): void { $group_sync_log = []; if (Util::getSetting('mc_integration') && $server_id == Util::getSetting('group_sync_mc_server')) { - try { - $integration = Integrations::getInstance()->getIntegration('Minecraft'); - - foreach ($_POST['player_groups'] as $uuid => $groups) { - $integrationUser = new IntegrationUser($integration, str_replace('-', '', $uuid), 'identifier'); - if ($integrationUser->exists()) { - $log = $this->updateGroups($integrationUser, $groups['groups']); - if (count($log)) { - $group_sync_log[] = $log; - } + $integration = Integrations::getInstance()->getIntegration('Minecraft'); + + foreach ($_POST['player_groups'] as $uuid => $groups) { + $integrationUser = new IntegrationUser($integration, str_replace('-', '', $uuid), 'identifier'); + if ($integrationUser->exists()) { + $log = $this->updateGroups($integrationUser, $groups['groups']); + if (count($log)) { + $group_sync_log[] = $log; } } - } catch (Exception $e) { - $api->throwError(CoreApiErrors::ERROR_UNABLE_TO_UPDATE_GROUPS, $e->getMessage(), 500); } $api->returnArray(array_merge(['message' => $api->getLanguage()->get('api', 'groups_updates_successfully')], ['log' => $group_sync_log]));