You've already forked AstralRinth
forked from didirus/AstralRinth
fix: broken jump right in for worlds (#4227)
* fix: broken jump right in for worlds * revert: Worlds.vue change
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import type { GameVersion } from '@modrinth/ui'
|
||||||
import { GAME_MODES, HeadingLink, injectNotificationManager } from '@modrinth/ui'
|
import { GAME_MODES, HeadingLink, injectNotificationManager } from '@modrinth/ui'
|
||||||
import type { Dayjs } from 'dayjs'
|
import type { Dayjs } from 'dayjs'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
@@ -10,11 +11,14 @@ import { trackEvent } from '@/helpers/analytics'
|
|||||||
import { process_listener, profile_listener } from '@/helpers/events'
|
import { process_listener, profile_listener } from '@/helpers/events'
|
||||||
import { get_all } from '@/helpers/process'
|
import { get_all } from '@/helpers/process'
|
||||||
import { kill, run } from '@/helpers/profile'
|
import { kill, run } from '@/helpers/profile'
|
||||||
|
import { get_game_versions } from '@/helpers/tags'
|
||||||
import type { GameInstance } from '@/helpers/types'
|
import type { GameInstance } from '@/helpers/types'
|
||||||
import {
|
import {
|
||||||
get_profile_protocol_version,
|
get_profile_protocol_version,
|
||||||
get_recent_worlds,
|
get_recent_worlds,
|
||||||
getWorldIdentifier,
|
getWorldIdentifier,
|
||||||
|
hasServerQuickPlaySupport,
|
||||||
|
hasWorldQuickPlaySupport,
|
||||||
type ProtocolVersion,
|
type ProtocolVersion,
|
||||||
refreshServerData,
|
refreshServerData,
|
||||||
type ServerData,
|
type ServerData,
|
||||||
@@ -37,6 +41,7 @@ const theme = useTheming()
|
|||||||
const jumpBackInItems = ref<JumpBackInItem[]>([])
|
const jumpBackInItems = ref<JumpBackInItem[]>([])
|
||||||
const serverData = ref<Record<string, ServerData>>({})
|
const serverData = ref<Record<string, ServerData>>({})
|
||||||
const protocolVersions = ref<Record<string, ProtocolVersion | null>>({})
|
const protocolVersions = ref<Record<string, ProtocolVersion | null>>({})
|
||||||
|
const gameVersions = ref<GameVersion[]>(await get_game_versions().catch(() => []))
|
||||||
|
|
||||||
const MIN_JUMP_BACK_IN = 3
|
const MIN_JUMP_BACK_IN = 3
|
||||||
const MAX_JUMP_BACK_IN = 6
|
const MAX_JUMP_BACK_IN = 6
|
||||||
@@ -255,7 +260,14 @@ onUnmounted(() => {
|
|||||||
? serverData[item.world.address].refreshing && !serverData[item.world.address].status
|
? serverData[item.world.address].refreshing && !serverData[item.world.address].status
|
||||||
: undefined
|
: undefined
|
||||||
"
|
"
|
||||||
supports-quick-play
|
:supports-server-quick-play="
|
||||||
|
item.world.type === 'server' &&
|
||||||
|
hasServerQuickPlaySupport(gameVersions, item.instance.game_version || '')
|
||||||
|
"
|
||||||
|
:supports-world-quick-play="
|
||||||
|
item.world.type === 'singleplayer' &&
|
||||||
|
hasWorldQuickPlaySupport(gameVersions, item.instance.game_version || '')
|
||||||
|
"
|
||||||
:server-status="
|
:server-status="
|
||||||
item.world.type === 'server' ? serverData[item.world.address].status : undefined
|
item.world.type === 'server' ? serverData[item.world.address].status : undefined
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -336,17 +336,21 @@ const messages = defineMessages({
|
|||||||
<ButtonStyled v-else>
|
<ButtonStyled v-else>
|
||||||
<button
|
<button
|
||||||
v-tooltip="
|
v-tooltip="
|
||||||
world.type == 'server' && !supportsServerQuickPlay
|
world.type === 'server'
|
||||||
? formatMessage(messages.noServerQuickPlay)
|
? !supportsServerQuickPlay
|
||||||
: world.type == 'singleplayer' && !supportsWorldQuickPlay
|
? formatMessage(messages.noServerQuickPlay)
|
||||||
? formatMessage(messages.noSingleplayerQuickPlay)
|
: playingOtherWorld
|
||||||
: playingOtherWorld || locked
|
|
||||||
? formatMessage(messages.gameAlreadyOpen)
|
? formatMessage(messages.gameAlreadyOpen)
|
||||||
: !serverStatus
|
: !serverStatus
|
||||||
? formatMessage(messages.noContact)
|
? formatMessage(messages.noContact)
|
||||||
: serverIncompatible
|
: serverIncompatible
|
||||||
? formatMessage(messages.incompatibleServer)
|
? formatMessage(messages.incompatibleServer)
|
||||||
: null
|
: null
|
||||||
|
: !supportsWorldQuickPlay
|
||||||
|
? formatMessage(messages.noSingleplayerQuickPlay)
|
||||||
|
: playingOtherWorld || locked
|
||||||
|
? formatMessage(messages.gameAlreadyOpen)
|
||||||
|
: null
|
||||||
"
|
"
|
||||||
:disabled="
|
:disabled="
|
||||||
playingOtherWorld ||
|
playingOtherWorld ||
|
||||||
|
|||||||
Reference in New Issue
Block a user