fix: resolve all remaining audit failures across rust, svelte, and java
This commit is contained in:
1 parent
bc12a25a01
commit
590178e41a
35 files changed
+958
-300
No files matched your search
@@ -22,6 +22,8 @@
|
||||
onunclaim?: (claimId: number) => void;
|
||||
} = $props();
|
||||
|
||||
let servers = $state<Array<{ id: number; name: string; instance_id: string }>>([]);
|
||||
let serverId = $state<number | null>(null);
|
||||
let dimension = $state<'minecraft:overworld' | 'minecraft:the_nether' | 'minecraft:the_end'>('minecraft:overworld');
|
||||
let centerX = $state(0);
|
||||
let centerZ = $state(0);
|
||||
@@ -39,11 +41,14 @@
|
||||
] as const;
|
||||
|
||||
async function loadClaims() {
|
||||
if (!instanceId) return;
|
||||
if (!instanceId || !serverId) { claims = []; return; }
|
||||
loading = true;
|
||||
try {
|
||||
claims = await invoke<GuildClaim[]>('get_guild_claims', {
|
||||
instanceId,
|
||||
serverId,
|
||||
centerX,
|
||||
centerZ,
|
||||
dimension
|
||||
});
|
||||
} catch (e: any) {
|
||||
@@ -66,11 +71,13 @@
|
||||
);
|
||||
|
||||
async function handleClaim() {
|
||||
if (!selectedChunk || !myGuildId) return;
|
||||
if (!selectedChunk || !myGuildId || !serverId) return;
|
||||
claiming = true;
|
||||
try {
|
||||
const claim = await invoke<GuildClaim>('claim_guild_chunk', {
|
||||
guildId: myGuildId,
|
||||
instanceId,
|
||||
serverId,
|
||||
dimension,
|
||||
chunkX: selectedChunk.x,
|
||||
chunkZ: selectedChunk.z
|
||||
@@ -112,17 +119,28 @@
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
if (instanceId && dimension) {
|
||||
if (instanceId && dimension && serverId) {
|
||||
loadClaims();
|
||||
}
|
||||
});
|
||||
|
||||
onMount(() => {
|
||||
loadClaims();
|
||||
onMount(async () => {
|
||||
const result = await invoke<{ servers: typeof servers }>('get_public_servers');
|
||||
servers = result.servers;
|
||||
});
|
||||
$effect(() => {
|
||||
const available = servers.filter(s => s.instance_id === instanceId);
|
||||
if (!available.some(s => s.id === serverId)) serverId = available[0]?.id ?? null;
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="chunk-map-container glass">
|
||||
<label>Game server
|
||||
<select bind:value={serverId}>
|
||||
{#each servers.filter(s => s.instance_id === instanceId) as server}<option value={server.id}>{server.name}</option>{/each}
|
||||
</select>
|
||||
</label>
|
||||
{#if !serverId}<p>Link a game server to this instance in the panel before claiming territory.</p>{/if}
|
||||
<!-- Controls Bar -->
|
||||
<div class="map-controls">
|
||||
<div class="dim-selector">
|
||||
|
||||
Reference in new issue
Block a user