aboutsummaryrefslogtreecommitdiff
path: root/commands
diff options
context:
space:
mode:
authorNinjune <enderknight537@gmail.com>2022-11-23 11:50:54 -0600
committerNinjune <enderknight537@gmail.com>2022-11-23 11:50:54 -0600
commit9bb7bf0b2f4dbc9269b0e5fa446d8480b814fe20 (patch)
tree56837d423243990da63152d0e9c119189f1d121b /commands
parent5e76b8b00ac668768f5295ac4b2cb7c79c71ee36 (diff)
downloadcoleweight-9bb7bf0b2f4dbc9269b0e5fa446d8480b814fe20.tar.gz
coleweight-9bb7bf0b2f4dbc9269b0e5fa446d8480b814fe20.tar.bz2
coleweight-9bb7bf0b2f4dbc9269b0e5fa446d8480b814fe20.zip
v1.6.4 forgot to push lmao
Diffstat (limited to 'commands')
-rw-r--r--commands/claim.js47
-rw-r--r--commands/help.js1
-rw-r--r--commands/markingLobbies.js17
-rw-r--r--commands/yog.js63
4 files changed, 115 insertions, 13 deletions
diff --git a/commands/claim.js b/commands/claim.js
index cb691f3..5abeda8 100644
--- a/commands/claim.js
+++ b/commands/claim.js
@@ -2,7 +2,7 @@ import axios from "../../axios"
import settings from "../settings"
import constants from "../util/constants"
const PREFIX = constants.PREFIX
-
+const serverId = java.util.UUID.randomUUID().toString().replace("-", "")
export function claim(structure)
{
@@ -23,33 +23,59 @@ export function claim(structure)
ChatLib.chat(`${PREFIX}&cPlease enter the structure you wish to claim! (&3throne&c or &3spiral&c)`)
return
}
-
- axios.get(`https://ninjune.dev/api/claim?type=${structure}&id=${constants.serverData.server}&key=${constants.data.api_key}`)
+
+ axios.get(`https://ninjune.dev/api/claim?type=${structure}&lobby=${constants.serverData.server}&method=auth&username=${Player.getName()}&serverID=${serverId}`)
.then(res => {
if(res.data.success)
ChatLib.chat(`${PREFIX}&aSuccessfully claimed ${constants.serverData.server} as your server!`)
else
- ChatLib.chat(`${PREFIX}&cError: ${res.data.reason}`)
+ {
+ ChatLib.chat(`${PREFIX}&cError: ${res.data.reason}.`)
+ if(res.data.code == 501)
+ {
+ ChatLib.chat(`${PREFIX}&cError: Not logged into the auth server. Try running the command again.`)
+ Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId)
+ }
+ }
})
.catch(err => {
ChatLib.chat(`${PREFIX}&cError: ${err}`)
})
- // key is used above to verify that the player trying to claim the lobby is the intended player, don't know a better way of doing this.
+
}
+register('gameLoad', (event) => {
+ Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId)
+})
register('worldLoad', () => {
if(!settings.claiming) return
+ axios.get(`https://ninjune.dev/api/unclaim?method=auth&username=${Player.getName()}&serverID=${serverId}`)
+ .then(res => {
+ if(settings.debug && !res.data.success)
+ ChatLib.chat("Unclaim: " + res.data.reason)
+ if(res.data.code == 501)
+ Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId)
+ })
+ .catch(err => {
+ if(settings.debug)
+ ChatLib.chat(`${PREFIX}&cError: ${err}`)
+ })
+ // unclaims the lobby, isn't needed but will allow another player to claim lobby after claimer leaves.
setTimeout(() => {
+ const NetHandlerPlayClient = Client.getConnection(),
+ PlayerMap = NetHandlerPlayClient.func_175106_d() // getPlayerInfoMap
+
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) => {
+ PlayerMap.filter(player => player.func_178853_c() /* getResponseTime */ > 0 && !player.func_178845_a()/* getGameProfile */.name.startsWith("!")).forEach((PlayerMP) => {
+ let player = PlayerMP.func_178845_a()/* getGameProfile */.name
+
res.data.structures.forEach((structure) => {
- if (player.getName() == structure.player)
+ if (player == 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.
})
@@ -61,9 +87,4 @@ register('worldLoad', () => {
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/help.js b/commands/help.js
index 3c20b01..1157c65 100644
--- a/commands/help.js
+++ b/commands/help.js
@@ -15,6 +15,7 @@ export function help()
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 yog => Guide for setting up waypoints for yogs.`)
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("")
diff --git a/commands/markingLobbies.js b/commands/markingLobbies.js
new file mode 100644
index 0000000..6db976e
--- /dev/null
+++ b/commands/markingLobbies.js
@@ -0,0 +1,17 @@
+import settings from "../settings"
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+let lobbies = []
+
+export function clearLobbies()
+{
+ lobbies = []
+}
+
+register('chat', (server) => {
+ if(!settings.lobbyMarking) return
+ if(lobbies.indexOf(server) > 0)
+ ChatLib.chat(`${PREFIX}&aYou've been in this lobby!`)
+ else
+ lobbies.push(server)
+}).setCriteria(/Sending to server ([A-Za-z0-9]+)\.\.\./g) \ No newline at end of file
diff --git a/commands/yog.js b/commands/yog.js
new file mode 100644
index 0000000..15a3d9b
--- /dev/null
+++ b/commands/yog.js
@@ -0,0 +1,63 @@
+import constants from "../util/constants"
+
+const PREFIX = constants.PREFIX
+let yogWaypoints = []
+
+export function yog(arg2)
+{
+ const WAYPOINTNAME = "Yog"
+
+ if(arg2 != "toggle")
+ {
+ new TextComponent(`${PREFIX}&bGo to the leftmost corner of the topaz crystal facing bal close to bal then do /cw yog toggle.`)
+ .chat()
+ }
+ else
+ {
+ if(yogWaypoints[0] == undefined)
+ {
+ let startPos = [Player.getX(), Player.getY(), Player.getZ()],
+ x = startPos[0],
+ y = startPos[1],
+ z = startPos[2]
+
+ console.log(x + " " + y + " " + z)
+ yogWaypoints.push([x + 10, y - 7, z - 27])
+ yogWaypoints.push([x + 10, y - 7, z - 27])
+ yogWaypoints.push([x + 28, y - 8, z + 15])
+ yogWaypoints.push([x - 41, y - 3, z + 26])
+ yogWaypoints.push([x - 32, y - 3, z + 45])
+ yogWaypoints.push([x - 22, y - 3, z - 34])
+ yogWaypoints.push([x + 28, y - 8, z + 36])
+ yogWaypoints.push([x - 47, y - 3, z + 32])
+ yogWaypoints.push([x - 43, y - 1, z + 4])
+ yogWaypoints.push([x - 47, y + 2, z - 20])
+ yogWaypoints.push([x + 11, y - 13, z + 40])
+ yogWaypoints.push([x + 15, y - 13, z + 43])
+ yogWaypoints.push([x - 44, y + 2, z - 29])
+ yogWaypoints.push([x + 33, y - 4, z - 15])
+ yogWaypoints.push([x - 6, y - 4, z - 34])
+ yogWaypoints.push([x + 19, y - 12, z + 35])
+ yogWaypoints.push([x + 16, y - 9, z - 15])
+ ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned on!`)
+ }
+ else
+ {
+ yogWaypoints = []
+ ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned off!`)
+ }
+ }
+}
+
+register("renderWorld", () => {
+ if(yogWaypoints.length < 1) return
+ yogWaypoints.forEach((waypoint) => {
+ Tessellator.drawString(Math.floor((Math.abs(parseInt(Player.getX()) - waypoint[0]) + Math.abs(parseInt(Player.getY()) - waypoint[1]) + Math.abs(parseInt(Player.getZ()) - waypoint[2]))/3) + "m", waypoint[0], waypoint[1], waypoint[2])
+ })
+})
+
+register("worldLoad", () => {
+ yogWaypoints = []
+})
+
+export default "" \ No newline at end of file