diff --git a/resources/scripts/components/server/features/JavaVersionModalFeature.tsx b/resources/scripts/components/server/features/JavaVersionModalFeature.tsx index 80d8cc2871..1783a3b89a 100644 --- a/resources/scripts/components/server/features/JavaVersionModalFeature.tsx +++ b/resources/scripts/components/server/features/JavaVersionModalFeature.tsx @@ -12,6 +12,7 @@ import useWebsocketEvent from '@/plugins/useWebsocketEvent'; import Can from '@/components/elements/Can'; import getServerStartup from '@/api/swr/getServerStartup'; import InputSpinner from '@/components/elements/InputSpinner'; +import { usePermissions } from '@/plugins/usePermissions'; const MATCH_ERRORS = [ 'minecraft 1.17 requires running the server with java 16 or above', @@ -31,14 +32,20 @@ const JavaVersionModalFeature = () => { const { clearFlashes, clearAndAddHttpError } = useFlash(); const { instance } = ServerContext.useStoreState(state => state.socket); - const { data, isValidating, mutate } = getServerStartup(uuid, undefined, { revalidateOnMount: false }); + const hasPermission = usePermissions('startup.docker-image'); + + const { data, isValidating, mutate } = hasPermission + ? getServerStartup(uuid, undefined, { revalidateOnMount: false }) + : { data: undefined, isValidating: false, mutate: undefined }; useEffect(() => { if (!visible) return; - mutate().then(value => { - setSelectedVersion(Object.values(value?.dockerImages || [])[0] || ''); - }); + if (mutate) { + mutate().then((value) => { + setSelectedVersion(Object.values(value?.dockerImages || [])[0] || ''); + }); + } }, [visible]); useWebsocketEvent(SocketEvent.CONSOLE_OUTPUT, data => {