You've already forked AstralRinth
forked from didirus/AstralRinth
feat: seed rounding and string seeds (#4351)
* feat: seed rounding fix * chore: remove comment
This commit is contained in:
@@ -95,7 +95,10 @@
|
|||||||
:aria-labelledby="`property-label-${index}`"
|
:aria-labelledby="`property-label-${index}`"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="typeof property === 'number'" class="mt-2 w-full sm:w-[320px]">
|
<div
|
||||||
|
v-else-if="typeof property === 'number' && index !== 'level-seed' && index !== 'seed'"
|
||||||
|
class="mt-2 w-full sm:w-[320px]"
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
:id="`server-property-${index}`"
|
:id="`server-property-${index}`"
|
||||||
v-model.number="liveProperties[index]"
|
v-model.number="liveProperties[index]"
|
||||||
@@ -104,6 +107,18 @@
|
|||||||
:aria-labelledby="`property-label-${index}`"
|
:aria-labelledby="`property-label-${index}`"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
v-else-if="index === 'level-seed' || index === 'seed'"
|
||||||
|
class="mt-2 w-full sm:w-[320px]"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
:id="`server-property-${index}`"
|
||||||
|
v-model="liveProperties[index]"
|
||||||
|
type="text"
|
||||||
|
class="w-full rounded-xl border p-2"
|
||||||
|
:aria-labelledby="`property-label-${index}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div v-else-if="isComplexProperty(property)" class="mt-2 w-full sm:w-[320px]">
|
<div v-else-if="isComplexProperty(property)" class="mt-2 w-full sm:w-[320px]">
|
||||||
<textarea
|
<textarea
|
||||||
:id="`server-property-${index}`"
|
:id="`server-property-${index}`"
|
||||||
@@ -179,8 +194,14 @@ const { data: propsData, status } = await useAsyncData('ServerProperties', async
|
|||||||
|
|
||||||
if (value.toLowerCase() === 'true' || value.toLowerCase() === 'false') {
|
if (value.toLowerCase() === 'true' || value.toLowerCase() === 'false') {
|
||||||
value = value.toLowerCase() === 'true'
|
value = value.toLowerCase() === 'true'
|
||||||
} else if (!isNaN(value as any) && value !== '') {
|
} else {
|
||||||
value = Number(value)
|
const intLike = /^[-+]?\d+$/.test(value)
|
||||||
|
if (intLike) {
|
||||||
|
const n = Number(value)
|
||||||
|
if (Number.isSafeInteger(n)) {
|
||||||
|
value = n
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
properties[key.trim()] = value
|
properties[key.trim()] = value
|
||||||
@@ -196,6 +217,7 @@ watch(
|
|||||||
propsData,
|
propsData,
|
||||||
(newPropsData) => {
|
(newPropsData) => {
|
||||||
if (newPropsData) {
|
if (newPropsData) {
|
||||||
|
console.log(newPropsData)
|
||||||
liveProperties.value = JSON.parse(JSON.stringify(newPropsData))
|
liveProperties.value = JSON.parse(JSON.stringify(newPropsData))
|
||||||
originalProperties.value = JSON.parse(JSON.stringify(newPropsData))
|
originalProperties.value = JSON.parse(JSON.stringify(newPropsData))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user