aboutsummaryrefslogtreecommitdiff
path: root/commands/claim.js
diff options
context:
space:
mode:
authorNinjune <enderknight537@gmail.com>2022-11-18 16:05:16 -0600
committerNinjune <enderknight537@gmail.com>2022-11-18 16:05:16 -0600
commit5e76b8b00ac668768f5295ac4b2cb7c79c71ee36 (patch)
tree08a2e7a4e7c46d35bfcafc8a27f29716a639889a /commands/claim.js
parent03e93ce21ad426d0e3d47301fa004a41053ce23f (diff)
downloadcoleweight-5e76b8b00ac668768f5295ac4b2cb7c79c71ee36.tar.gz
coleweight-5e76b8b00ac668768f5295ac4b2cb7c79c71ee36.tar.bz2
coleweight-5e76b8b00ac668768f5295ac4b2cb7c79c71ee36.zip
v1.6.2 Bug fixes
Diffstat (limited to 'commands/claim.js')
-rw-r--r--commands/claim.js18
1 files changed, 14 insertions, 4 deletions
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