From 5e76b8b00ac668768f5295ac4b2cb7c79c71ee36 Mon Sep 17 00:00:00 2001 From: Ninjune Date: Fri, 18 Nov 2022 16:05:16 -0600 Subject: v1.6.2 Bug fixes --- commands/claim.js | 18 ++++++++++++++---- commands/time.js | 4 ++-- 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'commands') diff --git a/commands/claim.js b/commands/claim.js index fc0bc57..cb691f3 100644 --- a/commands/claim.js +++ b/commands/claim.js @@ -41,19 +41,29 @@ export function claim(structure) register('worldLoad', () => { if(!settings.claiming) return setTimeout(() => { - console.log(constants.serverData.server) + if(settings.debug) console.log(constants.serverData.server) axios.get(`https://ninjune.dev/api/claim?claimedlobby=${constants.serverData.server}`) .then(res => { if(res.data.claimed) { + ChatLib.chat("here") World.getAllPlayers().forEach((player) => { - if (player.getName() == res.data.player) - ChatLib.chat(`${PREFIX}&cThe ${res.data.structure} in this lobby is claimed by ${res.data.player}.`) + res.data.structures.forEach((structure) => { + if (player.getName() == structure.player) + ChatLib.chat(`${PREFIX}&cThe ${structure.structure} in ${structure.server} is claimed by ${structure.player}.`) + //holy im so good at naming things, structure.structure I must be a genius. + }) }) } }) .catch(err => { - ChatLib.chat(`${PREFIX}Error: ${err}`) + if(!settings.debug) return + ChatLib.chat(`${PREFIX}&cError: ${err}`) }) }, 2000) +}) + +register('worldUnload', () => { + axios.get(`https://ninjune.dev/api/unclaim?claimedlobby=${constants.serverData.server}&key=${constants.data.api_key}`) + // unclaims the lobby, isn't needed but will allow another player to claim lobby after claimer leaves. key used to verify identity of unclaimer. }) \ No newline at end of file diff --git a/commands/time.js b/commands/time.js index 115964e..08aaada 100644 --- a/commands/time.js +++ b/commands/time.js @@ -1,10 +1,10 @@ import constants from "../util/constants" const PREFIX = constants.PREFIX - +let timerHr export function time() { - let timerHr = Math.floor(constants.timerdata.timer/60/60) + timerHr = Math.floor(constants.timerdata.timer/60/60) if(timerHr >= 1) ChatLib.chat(`${PREFIX}&aTimer (${constants.serverData.server}): &b${timerHr}h ${Math.floor(constants.timerdata.timer/60) - timerHr*60}m`) -- cgit