diff --git a/scripts/main.js b/scripts/main.js index e3a58ae..557c726 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -2,7 +2,7 @@ import { system, world } from "@minecraft/server"; import utils from "utils"; import { websocket } from "@minecraft/server-net"; import { InitPlayer } from "entities/player"; -import { roomCode } from "properties"; +import { interval, roomCode } from "properties"; class LagoonAddons { constructor() { this.timer = 0; @@ -42,7 +42,7 @@ class LagoonAddons { async clock() { this.timer++; // 1 seconde - if (this.timer % 20 === 0) { + if (this.timer % interval === 0) { if (this.ws.isOpen) { const players = world.getAllPlayers().map((p) => { return { diff --git a/scripts/properties.js b/scripts/properties.js index 951d594..b02c45f 100644 --- a/scripts/properties.js +++ b/scripts/properties.js @@ -1 +1,2 @@ export const roomCode = 'ROOM_CODE'; +export const interval = 20; // Interval in ticks at which positions will be sent to the server. (Min: 10) diff --git a/src/main.ts b/src/main.ts index 1202d2c..a2773da 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,7 +2,7 @@ import { system, world } from "@minecraft/server"; import utils from "utils"; import { websocket, WebSocketClient } from "@minecraft/server-net"; import { InitPlayer } from "entities/player"; -import { roomCode } from "properties"; +import { interval, roomCode } from "properties"; class LagoonAddons { @@ -53,7 +53,7 @@ class LagoonAddons { this.timer++; // 1 seconde - if (this.timer % 20 === 0) { + if (this.timer % interval === 0) { if (this.ws.isOpen) { const players: {x: number, y: number, z: number, code: string, muted: boolean}[] = world.getAllPlayers().map((p) => { diff --git a/src/properties.ts b/src/properties.ts index 660b614..411086b 100644 --- a/src/properties.ts +++ b/src/properties.ts @@ -1 +1,2 @@ -export const roomCode = 'ROOM_CODE'; \ No newline at end of file +export const roomCode = 'ROOM_CODE'; +export const interval = 20; // Interval in ticks at which positions will be sent to the server. (Min: 10) \ No newline at end of file