aboutsummaryrefslogtreecommitdiff
path: root/commands
diff options
context:
space:
mode:
authorNinjune <enderknight537@gmail.com>2022-10-26 22:45:52 -0500
committerNinjune <enderknight537@gmail.com>2022-10-26 22:45:52 -0500
commite55e71c8c2ee5fc6541eed04e9b684c6167e8f07 (patch)
tree4bb43bc3aa158a2aa207470b37bc36556081f63a /commands
parentf83001bc4a3543cdcd594001e7e6a7aeea749ba1 (diff)
downloadcoleweight-e55e71c8c2ee5fc6541eed04e9b684c6167e8f07.tar.gz
coleweight-e55e71c8c2ee5fc6541eed04e9b684c6167e8f07.tar.bz2
coleweight-e55e71c8c2ee5fc6541eed04e9b684c6167e8f07.zip
1.5.0 Release
Diffstat (limited to 'commands')
-rw-r--r--commands/help.js18
-rw-r--r--commands/leaderboard.js44
-rw-r--r--commands/reload.js11
-rw-r--r--commands/setkey.js21
-rw-r--r--commands/spiral.js42
-rw-r--r--commands/throne.js34
-rw-r--r--commands/toggle.js9
-rw-r--r--commands/update.js7
8 files changed, 186 insertions, 0 deletions
diff --git a/commands/help.js b/commands/help.js
new file mode 100644
index 0000000..c554294
--- /dev/null
+++ b/commands/help.js
@@ -0,0 +1,18 @@
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+export function help()
+{
+ ChatLib.chat("")
+ ChatLib.chat(`${PREFIX}&b/cw [username] => Gets coleweight`)
+ ChatLib.chat(`${PREFIX}&b/cw help => This menu.`)
+ ChatLib.chat(`${PREFIX}&b/cw gui => Change gui location`)
+ ChatLib.chat(`${PREFIX}&b/cw toggle => Toggle gui (gui is only active when mining)`)
+ ChatLib.chat(`${PREFIX}&b/cw setkey (key) => Sets API key (can also use /api new)`)
+ ChatLib.chat(`${PREFIX}&b/cw reload => Reloads the gui.`)
+ ChatLib.chat(`${PREFIX}&b/cw throne => Guide for setting up waypoints for throne.`)
+ ChatLib.chat(`${PREFIX}&b/cw spiral => Guide for setting up waypoints for spiral.`)
+ ChatLib.chat(`${PREFIX}&b/cw leaderboard => Gets leaderboard within a specific range (like 20 40)`)
+ ChatLib.chat(`${PREFIX}&b/fetchdiscord (username) => Gets discord of username (if linked)`)
+ ChatLib.chat("")
+} \ No newline at end of file
diff --git a/commands/leaderboard.js b/commands/leaderboard.js
new file mode 100644
index 0000000..2b2699f
--- /dev/null
+++ b/commands/leaderboard.js
@@ -0,0 +1,44 @@
+import axios from "../../axios"
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+export function leaderboard(arg2, arg3)
+{
+ if(arg2 != undefined && parseInt(arg2) == arg2 && !isNaN(parseInt(arg2, 10)))
+ {
+ if(arg3 == undefined && parseInt(arg2) == arg2 && !isNaN(parseInt(arg2, 10)))
+ {
+ axios.get(`https://ninjune.dev/api/coleweight-leaderboard`)
+ .then(res => {
+ for(let i = 0; i < arg2; i++)
+ {
+ ChatLib.chat(`&a${res.data[i].rank}. &b${res.data[i].name}: &f${res.data[i].coleweight}`)
+ }
+ })
+ .catch(err => {
+ ChatLib.chat(`${PREFIX}&4Error! &eApi might be down.`)
+ })
+ }
+ else if(parseInt(arg3) == arg3 && !isNaN(parseInt(arg3, 10)))
+ {
+ axios.get(`https://ninjune.dev/api/coleweight-leaderboard`)
+ .then(res => {
+ for(let i = arg2 - 1; i < arg3; i++)
+ {
+ ChatLib.chat(`&a${res.data[i].rank}. &b${res.data[i].name}: &f${res.data[i].coleweight}`)
+ }
+ })
+ .catch(err => {
+ ChatLib.chat(`${PREFIX}&4Error! &eApi might be down.`)
+ })
+ }
+ else
+ {
+ ChatLib.chat(`${PREFIX}&ePlease enter an integer! (how many positions) (or a range ie. '20 40')`)
+ }
+ }
+else
+{
+ ChatLib.chat(`${PREFIX}&ePlease enter an integer! (how many positions) (or a range ie. '20 40')`)
+}
+}
diff --git a/commands/reload.js b/commands/reload.js
new file mode 100644
index 0000000..1c5fcc0
--- /dev/null
+++ b/commands/reload.js
@@ -0,0 +1,11 @@
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+export function reload()
+{
+ constants.upTimeTrack = false
+ constants.stepsSinceLast = 0
+ constants.cwValues = []
+ constants.uptime = 0
+ ChatLib.chat(`${PREFIX}Reloaded!`)
+} \ No newline at end of file
diff --git a/commands/setkey.js b/commands/setkey.js
new file mode 100644
index 0000000..8024c0f
--- /dev/null
+++ b/commands/setkey.js
@@ -0,0 +1,21 @@
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+export function setkey(arg2)
+{
+ if(arg2 == undefined) { ChatLib.chat(`${PREFIX}&eRequires an argument!`); return; }
+ else key = arg2
+
+ constants.data.api_key = key
+ constants.data.save()
+ axios.get(`https://api.hypixel.net/key?key=${constants.data.api_key}`)
+ .then(res => {
+ if(res.data.success == true)
+ ChatLib.chat(`${PREFIX}&aSuccsessfully set api key!`)
+ else
+ ChatLib.chat(`${PREFIX}&eKey is not valid!`)
+ })
+ .catch(err => {
+ ChatLib.chat(`${PREFIX}&eKey is not valid!`)
+ })
+} \ No newline at end of file
diff --git a/commands/spiral.js b/commands/spiral.js
new file mode 100644
index 0000000..122ee08
--- /dev/null
+++ b/commands/spiral.js
@@ -0,0 +1,42 @@
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+export function spiral(arg2)
+{
+ if(arg2 != "toggle")
+ {
+ new TextComponent(`${PREFIX}&bGo to the place in &3this&b picture and do /cw spiral toggle`)
+ .setClickAction("open_url")
+ .setClickValue("https://i.imgur.com/dyL30GD.png")
+ .chat()
+ }
+ else
+ {
+ if(constants.spiralValues[0] == undefined)
+ {
+ let startPos = [Player.getX(), Player.getY(), Player.getZ()]
+ constants.spiralValues.push([startPos[0]+2, startPos[1]-3, startPos[2]+14])
+ constants.spiralValues.push([startPos[0]+3, startPos[1]-21, startPos[2]+6])
+ constants.spiralValues.push([startPos[0]+6, startPos[1]-23, startPos[2]-1])
+ constants.spiralValues.push([startPos[0]+19, startPos[1]+4, startPos[2]-5])
+ constants.spiralValues.push([startPos[0]+21, startPos[1]-7, startPos[2]])
+ constants.spiralValues.push([startPos[0]+25, startPos[1]-35, startPos[2]-8])
+ constants.spiralValues.push([startPos[0]+39, startPos[1]-36, startPos[2]])
+ constants.spiralValues.push([startPos[0]+52, startPos[1]-24, startPos[2]+1])
+ constants.spiralValues.push([startPos[0]+48, startPos[1]+3, startPos[2]+3])
+ constants.spiralValues.push([startPos[0]+47, startPos[1]+4, startPos[2]+22])
+ constants.spiralValues.push([startPos[0]+55, startPos[1]-8, startPos[2]+42])
+ constants.spiralValues.push([startPos[0]+46, startPos[1]-11, startPos[2]+49])
+ constants.spiralValues.push([startPos[0]+26, startPos[1]+5, startPos[2]+39])
+ constants.spiralValues.push([startPos[0]+20, startPos[1]+3, startPos[2]+41])
+ constants.spiralValues.push([startPos[0]+8, startPos[1]-23, startPos[2]+32])
+ constants.spiralValues.push([startPos[0]+4, startPos[1]-23, startPos[2]+28])
+ ChatLib.chat(`${PREFIX}&bSpiral waypoints turned on!`)
+ }
+ else
+ {
+ constants.spiralValues = []
+ ChatLib.chat(`${PREFIX}&bSpiral waypoints turned off!`)
+ }
+ }
+} \ No newline at end of file
diff --git a/commands/throne.js b/commands/throne.js
new file mode 100644
index 0000000..697304d
--- /dev/null
+++ b/commands/throne.js
@@ -0,0 +1,34 @@
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+export function throne(arg2)
+{
+ if(arg2 != "toggle")
+ {
+ ChatLib.chat(`${PREFIX}&bGo to the throne and sit on the back block then run /cw throne toggle.`)
+ }
+ else
+ {
+ if(constants.throneValues[0] == undefined)
+ {
+ let startPos = [Player.getX()-24, Player.getY()+6, Player.getZ()-59] // calculated below values at a weird start so adjusting them
+ constants.throneValues.push([startPos[0]+8, startPos[1]+2, startPos[2]-5])
+ constants.throneValues.push([startPos[0]+11, startPos[1]-35, startPos[2]-3])
+ constants.throneValues.push([startPos[0]+2, startPos[1]-34, startPos[2]-4])
+ constants.throneValues.push([startPos[0]+-2, startPos[1]-1, startPos[2]+49])
+ constants.throneValues.push([startPos[0]+2, startPos[1]-13, startPos[2]+52])
+ constants.throneValues.push([startPos[0]+27, startPos[1]-9, startPos[2]+51])
+ constants.throneValues.push([startPos[0]+38, startPos[1]-15, startPos[2]+47])
+ constants.throneValues.push([startPos[0]+41, startPos[1]-44, startPos[2]+46])
+ constants.throneValues.push([startPos[0]+50, startPos[1]-28, startPos[2]+38])
+ constants.throneValues.push([startPos[0]+49, startPos[1]-31, startPos[2]+1])
+ constants.throneValues.push([startPos[0]+50, startPos[1]-1, startPos[2]+10])
+ ChatLib.chat(`${PREFIX}&bThrone waypoints turned on!`)
+ }
+ else
+ {
+ constants.throneValues = []
+ ChatLib.chat(`${PREFIX}&bThrone waypoints turned off!`)
+ }
+ }
+} \ No newline at end of file
diff --git a/commands/toggle.js b/commands/toggle.js
new file mode 100644
index 0000000..a5e0ec2
--- /dev/null
+++ b/commands/toggle.js
@@ -0,0 +1,9 @@
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+export function toggle()
+{
+ constants.data.cwToggle = !constants.data.cwToggle
+ constants.data.save()
+ ChatLib.chat(`${PREFIX}&bSet gui to: &3${constants.data.cwToggle}`)
+} \ No newline at end of file
diff --git a/commands/update.js b/commands/update.js
new file mode 100644
index 0000000..708757f
--- /dev/null
+++ b/commands/update.js
@@ -0,0 +1,7 @@
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+export function update()
+{
+ ChatLib.chat(`${PREFIX}&bTBA`)
+} \ No newline at end of file