aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chat/grieferTrack.js62
-rw-r--r--chat/message.js36
-rw-r--r--commandManager.js110
-rw-r--r--commands/calculate/calcSpeed.js47
-rw-r--r--commands/calculate/calculate.js36
-rw-r--r--commands/calculate/hotmCalc.js66
-rw-r--r--commands/calculate/tick.js93
-rw-r--r--commands/claim.js103
-rw-r--r--commands/credits.js7
-rw-r--r--commands/fetchDiscord.js12
-rw-r--r--commands/help.js10
-rw-r--r--commands/reload.js11
-rw-r--r--commands/spiral.js2
-rw-r--r--commands/throne.js2
-rw-r--r--commands/tick.js64
-rw-r--r--data/collections.json87
-rw-r--r--data/hotm.json151
-rw-r--r--index.js149
-rw-r--r--metadata.json2
-rw-r--r--render/collectionGui.js64
-rw-r--r--render/cwGui.js178
-rw-r--r--render/dwarvenNotifier.js36
-rw-r--r--render/gemstoneMiningStats.js99
-rw-r--r--render/miningAbilities.js95
-rw-r--r--render/naturals.js37
-rw-r--r--render/tabList.js39
-rw-r--r--render/textGuiCreator.js20
-rw-r--r--settings.js156
-rw-r--r--util/constants.js28
-rw-r--r--util/grieferTrack.js47
-rw-r--r--util/helperFunctions.js352
-rw-r--r--util/updater.js35
32 files changed, 1720 insertions, 516 deletions
diff --git a/chat/grieferTrack.js b/chat/grieferTrack.js
new file mode 100644
index 0000000..2b745c3
--- /dev/null
+++ b/chat/grieferTrack.js
@@ -0,0 +1,62 @@
+import axios from "../../axios"
+import settings from "../settings"
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+let checkedPlayers = [],
+ griefers = []
+
+
+register("step", () => {
+ let date_ob = new Date(),
+ seconds = date_ob.getSeconds()
+
+ if(seconds == 0 || seconds == 15 || seconds == 30 || seconds == 45)
+ checkMMiners()
+}).setFps(1)
+
+
+register("worldLoad", () => {
+ checkedPlayers = []
+ setTimeout(() => {
+ checkMMiners()
+ }, 1500)
+})
+
+
+function checkMMiners()
+{
+ if (!settings.trackGriefers) return
+ try
+ {
+ const NetHandlerPlayClient = Client.getConnection(),
+ PlayerMap = NetHandlerPlayClient.func_175106_d() // getPlayerInfoMap
+
+ PlayerMap.filter(player => player.func_178853_c() > 0 && !player.func_178845_a().name.startsWith("!")).forEach((PlayerMP) => {
+ let player = PlayerMP.func_178845_a().name
+
+ if(!checkedPlayers.includes(player))
+ {
+ if(griefers.includes(player))
+ ChatLib.chat(`${PREFIX}&e'${player}' is a griefer!`)
+ checkedPlayers.push(player)
+ }
+ })
+ } catch(err) { if(settings.debug) console.log("grieferTrack trycatch: " + err) }
+
+ return checkedPlayers
+}
+
+
+register("gameLoad", () => {
+ axios.get(`https://ninjune.dev/api/mminers`)
+ .then(res => {
+ griefers = res.data.griefers
+ })
+ .catch(err => {
+ if(!settings.debug) return
+ ChatLib.chat(err)
+ })
+})
+
+
+export default "" \ No newline at end of file
diff --git a/chat/message.js b/chat/message.js
index 79b6be1..27cf78f 100644
--- a/chat/message.js
+++ b/chat/message.js
@@ -40,6 +40,17 @@ register("chat", (level, typeOfChat, hypixelRank, username, playerMessage, event
ChatLib.chat(newMessage)
}).setCriteria(/^(\[\d+\] )?((?:(?:Guild|Party|Co-op) > )|(?:\[:v:\] ))?(\[\w+\+{0,2}\] )?(\w{1,16})(?: \[\w{1,6}\])?: (.*)$/g)
+register("gameLoad", () => {
+ axios.get(`https://ninjune.dev/api/coleweight-leaderboard?length=500`)
+ .then(res => {
+ cwlbData = res.data
+ })
+ .catch(err => {
+ ChatLib.chat(err)
+ })
+})
+
+
register("messageSent", (origMessage, event) => { // emotes! this was fun to make :)
let commandState = 0,
command = "",
@@ -75,14 +86,21 @@ register("messageSent", (origMessage, event) => { // emotes! this was fun to mak
ChatLib.say(`${message}`)
})
-register("worldLoad", () => {
- axios.get(`https://ninjune.dev/api/coleweight-leaderboard?length=500`)
- .then(res => {
- cwlbData = res.data
- })
- .catch(err => {
- ChatLib.chat(err)
- })
-})
+
+// first time check
+register("step", () => {
+ if (constants.data.first_time)
+ {
+ constants.data.first_time = false
+ constants.data.save()
+ ChatLib.chat("")
+ new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bPlease Set Your Api Key By Doing /api new`)).chat()
+ new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bOr By Doing /cw setkey (key)`)).chat()
+ new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bView commands: /cw help`)).chat()
+ ChatLib.chat("")
+ }
+ if (constants.data.api_key == undefined || constants.data.api_key == "") return
+}).setFps(1);
+
export default "" \ No newline at end of file
diff --git a/commandManager.js b/commandManager.js
index cf28a8c..591676c 100644
--- a/commandManager.js
+++ b/commandManager.js
@@ -2,9 +2,9 @@ import { openTimerGui } from "./render/timerGui.js"
import { openPowderGui } from "./render/powertrackerGui"
import { openCoordsGui } from "./render/coordsGui.js"
import { openDowntimeGui } from "./render/downtimeGui.js"
-import { openCwGui } from "./render/cwGui"
+import { openCwGui, reloadColeweight } from "./render/cwGui"
+import { openCollectionGui, reloadCollection, trackCollection } from "./render/collectionGui"
import { help } from "./commands/help"
-import { reload } from "./commands/reload"
import { setkey } from "./commands/setkey"
import { spiral } from "./commands/spiral"
import { throne } from "./commands/throne"
@@ -14,27 +14,30 @@ import { update } from "./commands/update"
import { fetchDiscord } from "./commands/fetchDiscord"
import { findColeweight } from "./commands/findColeweight"
import { claim } from "./commands/claim"
-import { tick } from "./commands/tick"
import { time } from "./commands/time"
import { info } from "./commands/info"
+import { credits } from "./commands/credits"
import Settings from "./settings"
import constants from "./util/constants"
import { clearLobbies } from "./commands/markingLobbies"
import { divans } from "./commands/divans.js"
+import { calculate } from "./commands/calculate/calculate.js"
+import { openMiningAbilitiesGui } from "./render/miningAbilities.js"
-register("command", (arg, arg2, arg3) => {
- if (arg == undefined) {findColeweight(arg); return}
- switch(arg.toLowerCase())
+register("command", (...args) => {
+ console.log(args[0])
+ if (args[0] == undefined) {findColeweight(args[0]); return}
+ switch(args[0].toString().toLowerCase())
{
case "setkey":
- setkey(arg2)
+ setkey(args[1])
break
case "help":
help()
break
case "move":
- if (arg2 == undefined) {ChatLib.chat(`${constants.PREFIX}&cNot enough arguments.`); return}
- switch(arg2.toLowerCase())
+ if (args[1] == undefined) {ChatLib.chat(`${constants.PREFIX}&cNot enough arguments.`); return}
+ switch(args[1].toLowerCase())
{
case "coleweight":
openCwGui()
@@ -49,21 +52,37 @@ register("command", (arg, arg2, arg3) => {
case "downtime":
openDowntimeGui()
break
+ case "collection":
+ openCollectionGui()
+ break
+ case "miningabilities":
+ openMiningAbilitiesGui()
+ break
default:
ChatLib.chat(`${constants.PREFIX}&cNo such gui as '${arg2}'.`)
}
break
case "throne":
- throne(arg2)
+ throne(args[1])
break
case "spiral":
- spiral(arg2)
+ spiral(args[1])
break
case "reload":
- reload()
+ switch(args[1].toLowerCase())
+ {
+ case "coleweight":
+ reloadColeweight()
+ break
+ case "collection":
+ reloadCollection()
+ break
+ default:
+ ChatLib.chat(`${constants.PREFIX}&cNo such gui as '${args[1]}'.`)
+ }
break
case "leaderboard":
- leaderboard(arg2, arg3)
+ leaderboard(args[1], args[2])
break
case "update":
update()
@@ -73,14 +92,11 @@ register("command", (arg, arg2, arg3) => {
Settings.openGUI()
break
case "claim":
- claim(arg2)
+ claim(args[1])
break
case "powdertrackersync":
updateDisplay()
break
- case "tick":
- tick(arg2, arg3)
- break
case "time":
time()
break
@@ -91,37 +107,71 @@ register("command", (arg, arg2, arg3) => {
clearLobbies()
break
case "yog":
- yog(arg2)
+ yog(args[1])
break
case "divans":
case "divan":
- divans(arg2)
+ divans(args[1])
break
case "coord":
case "coords":
openCoordsGui()
break
+ case "credits":
+ credits()
+ break
+ case "track":
+ trackCollection(args[1])
+ break
+ case "calc":
+ case "calculate":
+ calculate(args.slice(1))
+ break
default:
- findColeweight(arg)
+ findColeweight(args[0])
}
}).setTabCompletions((args) => {
let output = [],
+ calculateOptions = ["tick", "ms2toprofessional", "hotmcalc", "calchotm"],
commands = ["setkey", "help", "move", "toggle", "throne", "spiral", "reload", "leaderboard",
- "settings", "claim", "tick", "time", "info", "clearlobbies", "yog", "divan", "coords"]
+ "settings", "claim", "time", "info", "clearlobbies", "yog", "divan", "coords", "credits", "track", "calculate"]
if(args[0].length == 0 || args[0] == undefined)
- output = commands
+ return output = commands
+
+ if(args[0] == "calc" || args[0] == "calculate")
+ {
+ if(args[1] == undefined) output = calculateOptions
+
+ else
+ {
+ calculateOptions.forEach(calculateOption => {
+ for(let char = 0; char < args[1].length; char++)
+ {
+ if(calculateOption[char] != args[1][char])
+ break
+ else if(char == args[1].length - 1)
+ output.push(calculateOption)
+ }
+ })
+ }
+ }
else
{
- for(let i = 0; i < commands.length; i++)
+
+ if(args[0] == undefined) output = commands
+
+ else
{
- for(let j = 0; j < args[0].length; j++)
- {
- if(commands[i][j] != args[0][j])
- break
- else if(j == args[0].length - 1)
- output.push(commands[i])
- }
+ commands.forEach(command => {
+ for(let char = 0; char < args[0].length; char++)
+ {
+ if(command[char] != args[0][char])
+ break
+ else if(char == args[0].length - 1)
+ output.push(command)
+ }
+ })
}
}
return output
diff --git a/commands/calculate/calcSpeed.js b/commands/calculate/calcSpeed.js
new file mode 100644
index 0000000..1b2eae6
--- /dev/null
+++ b/commands/calculate/calcSpeed.js
@@ -0,0 +1,47 @@
+import constants from "../../util/constants"
+import { parseNotatedInput } from "../../util/helperFunctions"
+const PREFIX = constants.PREFIX
+
+
+export function calcSpeed(powder)
+{
+ let speedLevels = 1,
+ professionalLevels = 1
+
+ if(powder == undefined || parseNotatedInput(powder) == "NI") return ChatLib.chat(constants.CALCULATEERRORMESSAGE)
+ powder = parseNotatedInput(powder)
+
+ while(powder > msPowder(speedLevels) + profPowder(professionalLevels))
+ {
+ if(ms2SpeedPerPowder(speedLevels + 1) > professionalSpeedPerPowder(professionalLevels + 1) && speedLevels < 50)
+ {
+ powder -= msPowder(speedLevels++)
+ }
+ else if (professionalLevels < 140)
+ {
+ powder -= profPowder(professionalLevels++)
+ }
+ else break
+ }
+ return ChatLib.chat(`&bGet &6&l${speedLevels} &bmining speed levels and &6&l${professionalLevels} &bprofessional levels.`)
+}
+
+function ms2SpeedPerPowder(miningSpeedLevel) // 40 speed per level
+{
+ return 40/msPowder(miningSpeedLevel)
+}
+
+function professionalSpeedPerPowder(professionalLevel) // 5 speed per level
+{
+ return 5/profPowder(professionalLevel)
+}
+
+function msPowder(miningSpeedLevel)
+{
+ return Math.floor(Math.pow(miningSpeedLevel+1, 3.2))
+}
+
+function profPowder(professionalLevel)
+{
+ return Math.floor(Math.pow(professionalLevel+1, 2.3))
+} \ No newline at end of file
diff --git a/commands/calculate/calculate.js b/commands/calculate/calculate.js
new file mode 100644
index 0000000..3d9d750
--- /dev/null
+++ b/commands/calculate/calculate.js
@@ -0,0 +1,36 @@
+import constants from "../../util/constants"
+import { hotmCalc } from "./hotmCalc"
+import { calcSpeed } from "./calcSpeed"
+import { tickCommand } from "./tick"
+import { helpCommand } from "../help"
+const PREFIX = constants.PREFIX
+
+
+export function calculate(args)
+{
+ switch(args[0].toLowerCase())
+ {
+ case "hotm":
+ case "hotmcalc":
+ case "calchotm":
+ hotmCalc(args[1], args[2], args[3])
+ break
+ case "tick":
+ tickCommand(args[1], args[2])
+ break
+ case "calcspeed":
+ case "speed":
+ calcSpeed(args[1])
+ break
+ case "help":
+ ChatLib.chat("&b--------------[ &a&l/cw calculate &b]--------------")
+ helpCommand("calculate tick", "Calculates tick data.", "(mining speed) (('r','jade', etc) || breaking power of block))")
+ helpCommand("calculate speed", "Calculates the ratio of mining speed 2 to professional with a certain amount of powder.", "(powder)")
+ helpCommand("calculate hotm", "Calculates powder between two levels of a certain perk.", "(perk) (minlevel) [maxlevel]")
+ ChatLib.chat("&b------------------------------------------")
+ return
+ default:
+ return ChatLib.chat(constants.CALCULATEERRORMESSAGE)
+ }
+}
+
diff --git a/commands/calculate/hotmCalc.js b/commands/calculate/hotmCalc.js
new file mode 100644
index 0000000..583b2b8
--- /dev/null
+++ b/commands/calculate/hotmCalc.js
@@ -0,0 +1,66 @@
+import constants from "../../util/constants"
+import { addCommas } from "../../util/helperFunctions"
+const PREFIX = constants.PREFIX
+
+
+export function hotmCalc(hotmName, minLevel, maxLevel)
+{
+ if(hotmName == undefined)
+ {
+ let hotmData = JSON.parse(FileLib.read("Coleweight", "data/hotm.json")).data
+
+ ChatLib.chat(`/cw calc hotm (hotmName listed below) (minLevel) [maxLevel]`)
+ for(let i = 0; i < hotmData.length; i++)
+ {
+ ChatLib.chat(hotmData[i].names[0])
+ }
+ return
+ }
+ if(maxLevel == undefined)
+ {
+ maxLevel = minLevel
+ minLevel = 1
+ }
+
+ if(minLevel != parseInt(minLevel) || maxLevel != parseInt(maxLevel)) return ChatLib.chat(constants.CALCULATEERRORMESSAGE)
+
+ minLevel = parseInt(minLevel)
+ maxLevel = parseInt(maxLevel)
+ let hotmObjectToFind = findHotmObject(hotmName)
+ if(hotmObjectToFind == undefined) return ChatLib.chat(`${PREFIX}&cDid not find HOTM perk with name '${hotmName}'!`)
+
+ maxLevel = (maxLevel < hotmObjectToFind.maxLevel ? maxLevel : hotmObjectToFind.maxLevel)
+
+ let powderSum = findCost(hotmObjectToFind.costFormula, minLevel, maxLevel),
+ reward = findReward(hotmObjectToFind.rewardFormula, minLevel, maxLevel)
+
+ ChatLib.chat("")
+ ChatLib.chat(`&6${hotmObjectToFind.nameStringed} ${minLevel} - ${maxLevel} &bwill cost &6&l${addCommas(Math.round(powderSum))} &6${hotmObjectToFind.powderType[0].toUpperCase() + hotmObjectToFind.powderType.slice(1)} &bpowder.`)
+ ChatLib.chat(`&6${hotmObjectToFind.nameStringed} ${minLevel} - ${maxLevel} &bwill give &6&l${addCommas(Math.round(reward * 100) / 100)} &bof whatever reward is listed.`)
+ ChatLib.chat("")
+}
+
+export function findHotmObject(hotmName)
+{
+ let hotmData = JSON.parse(FileLib.read("Coleweight", "data/hotm.json")).data
+
+ for(let i = 0; i < hotmData.length; i++)
+ {
+ if(hotmData[i].names.includes(hotmName))
+ return hotmData[i]
+ }
+}
+
+export function findCost(costFormula, minLevel, maxLevel)
+{
+ let powderSum = 0
+
+ for(let currentLevel = minLevel; currentLevel < maxLevel; currentLevel++) // finds cost
+ powderSum += eval(costFormula.replace("currentLevel", currentLevel))
+ return powderSum
+}
+
+export function findReward(rewardFormula, minLevel, maxLevel)
+{
+ return eval(rewardFormula.replace("Level", 1+maxLevel-minLevel))
+} \ No newline at end of file
diff --git a/commands/calculate/tick.js b/commands/calculate/tick.js
new file mode 100644
index 0000000..f8b2433
--- /dev/null
+++ b/commands/calculate/tick.js
@@ -0,0 +1,93 @@
+import constants from "../../util/constants"
+const PREFIX = constants.PREFIX
+
+export function tickCommand(speed, block)
+{
+ if(speed == undefined || parseInt(speed) != speed)
+ return ChatLib.chat(`${PREFIX}&cMining speed must be an integer!`)
+ if(block == undefined)
+ return ChatLib.chat(constants.CALCULATEERRORMESSAGE)
+ const ticks = findTick(speed, block)
+ if(ticks.err) return ChatLib.chat(`${PREFIX}&cBlock must be a gemstone or positive breaking power! (or starting letter of gemstone)`)
+
+
+ ChatLib.chat(`\n&bCurrently mining blocks in &6&l${Math.round(ticks.currentBlockTick)} ticks` +
+ `\n&bCurrently mining shards in &6&l${Math.round(ticks.currentShardTick)} ticks` +
+ `\n&bNext block tick will be at: &6&l${Math.round(ticks.nextBlockSpeed)} mining speed` +
+ `\n&bNext shard tick will be at: &6&l${Math.round(ticks.nextShardSpeed)} mining speed` +
+ `\n&bYou need &6&l${Math.round(ticks.nextBlockSpeed - speed)} mining speed&b to get the next block tick.` +
+ `\n&bYou need &6&l${Math.round(ticks.nextShardSpeed - speed)} mining speed&b to get the next shard tick.\n`)
+}
+
+
+export function findTick(speed, block)
+{
+ let ticks = {err: false},
+ strength = findStrength(block)
+
+ ticks.currentBlockTick = strength*30/speed
+ ticks.currentShardTick = (strength-200)*30/speed
+
+ if(strength < 1) return ticks.err = true
+
+
+ if(ticks.currentBlockTick < Math.floor(ticks.currentBlockTick) + 0.5)
+ ticks.nextBlockSpeed = strength*30/(Math.floor(ticks.currentBlockTick)-0.5)
+ else
+ ticks.nextBlockSpeed = strength*30/(Math.floor(ticks.currentBlockTick)+0.5)
+
+ if(ticks.currentShardTick < Math.floor(ticks.currentShardTick) + 0.5)
+ ticks.nextShardSpeed = strength*30/(Math.floor(ticks.currentShardTick)-0.5)
+ else
+ ticks.nextShardSpeed = strength*30/(Math.floor(ticks.currentShardTick)+0.5)
+
+ return ticks
+}
+
+function findStrength(block)
+{
+ let strength = -1
+
+ if(block == parseInt(block) && block > 5) // change if add block to tick speed blocks in settings
+ strength = block
+ else
+ {
+ switch(block.toString().toLowerCase())
+ {
+ case "0":
+ case "green_mithril":
+ strength = 800
+ break
+ case "1":
+ case "blue_mithril":
+ strength = 1500
+ break
+ case "2":
+ case "ruby":
+ case "r":
+ strength = 2500
+ break
+ case "3":
+ case "j":
+ case "jade":
+ case "a":
+ case "amber":
+ case "amethyst":
+ case "s":
+ case "sapphire":
+ strength = 3200
+ break
+ case "4":
+ case "t":
+ case "topaz":
+ case "o":
+ case "opal":
+ strength = 4000
+ case "5":
+ case "jasper":
+ strength = 5000
+ }
+ }
+
+ return strength
+}
diff --git a/commands/claim.js b/commands/claim.js
index ae20924..ef40b99 100644
--- a/commands/claim.js
+++ b/commands/claim.js
@@ -2,7 +2,10 @@ import axios from "../../axios"
import settings from "../settings"
import constants from "../util/constants"
const PREFIX = constants.PREFIX
+const path = `https://ninjune.dev`
const serverId = java.util.UUID.randomUUID().toString().replace("-", "")
+let claimedServers = []
+
export function claim(structure)
{
@@ -24,71 +27,91 @@ export function claim(structure)
return
}
- axios.get(`https://ninjune.dev/api/claim?type=${structure}&lobby=${constants.serverData.server}&username=${Player.getName()}&serverID=${serverId}`)
+ axios.get(`${path}/api/claim?type=${structure}&lobby=${constants.serverData.server}&username=${Player.getName()}&serverID=${serverId}`)
.then(res => {
if(res.data.success)
+ {
ChatLib.chat(`${PREFIX}&aSuccessfully claimed ${constants.serverData.server} as your server!`)
+ claimedServers.push({player: Player.getName(), server: constants.serverData.server, structure: structure})
+ return
+ }
else
{
- 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)
+ return Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId)
}
+ else
+ return ChatLib.chat(`${PREFIX}&cError: ${res.data.reason}.`)
}
})
.catch(err => {
- ChatLib.chat(`${PREFIX}&cError: ${err}`)
+ return ChatLib.chat(`${PREFIX}&cError: ${err}`)
})
-
}
+
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)
+ try
+ {
+ Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId)
+ }
+ catch(e) {}
+ getClaimed()
})
+
register('worldLoad', () => {
if(!settings.claiming) return
- axios.get(`https://ninjune.dev/api/unclaim?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.
+ getClaimed()
setTimeout(() => {
const NetHandlerPlayClient = Client.getConnection(),
PlayerMap = NetHandlerPlayClient.func_175106_d() // getPlayerInfoMap
-
+ let player
+
if(settings.debug) console.log(constants.serverData.server)
- axios.get(`https://ninjune.dev/api/claimed?serverID=${constants.serverData.server}&authServer=${serverId}&passedName=${Player.getName()}`)
- .then(res => {
- if(res.data.claimed)
- {
- 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
+
+ claimedServers.forEach((claimedServer) => {
+ PlayerMap.filter(player => player.func_178853_c() > 0 && !player.func_178845_a().name.startsWith("!")).forEach((PlayerMP) => {
+ player = PlayerMP.func_178845_a().name
- res.data.structures.forEach((structure) => {
- 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.
+ if (player == claimedServer.player && claimedServer.server == constants.serverData.server)
+ ChatLib.chat(`${PREFIX}&cThe ${claimedServer.structure} in ${claimedServer.server} is claimed by ${claimedServer.player}.`)
+ })
+
+ if (Player.getName() == claimedServer.player)
+ {
+ axios.get(`${path}/api/unclaim?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)
})
- })
- }
- else if (res.data.err && settings.debug)
- {
- ChatLib.chat("Check claim: " + res.data.reason)
- }
- })
- .catch(err => {
- if(!settings.debug) return
- ChatLib.chat(`${PREFIX}&cError: ${err}`)
+ .catch(err => {
+ if(settings.debug)
+ ChatLib.chat(`${PREFIX}&cError: ${err}`)
+ })
+ }
})
}, 2000)
-}) \ No newline at end of file
+})
+
+
+function getClaimed()
+{
+ axios.get(`${path}/api/claimed?authServer=${serverId}&passedName=${Player.getName()}`)
+ .then(res => {
+ 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)
+ return
+ }
+ claimedServers = []
+ res.data.forEach(server => {
+ claimedServers.push(server)
+ })
+ })
+}
diff --git a/commands/credits.js b/commands/credits.js
new file mode 100644
index 0000000..af4aa28
--- /dev/null
+++ b/commands/credits.js
@@ -0,0 +1,7 @@
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+export function credits()
+{
+ ChatLib.chat(`${PREFIX}&bCW was made by Ninjune#0670 (NinOnCubed).`)
+} \ No newline at end of file
diff --git a/commands/fetchDiscord.js b/commands/fetchDiscord.js
index f44c385..f254edb 100644
--- a/commands/fetchDiscord.js
+++ b/commands/fetchDiscord.js
@@ -6,14 +6,14 @@ export function fetchDiscord(arg)
{
if(arg == undefined) { ChatLib.chat(`${PREFIX}&eRequires a username!`); return }
- axios.get(`https://api.ashcon.app/mojang/v2/user/${arg}`)
- .then(res => {
- let uuid = res.data.uuid
+ axios.get(`https://api.mojang.com/users/profiles/minecraft/${arg}`)
+ .then(mojangRes => {
+ let uuid = mojangRes.data.id
axios.get(`https://api.hypixel.net/player?key=${constants.data.api_key}&uuid=${uuid}`)
- .then(res2 => {
- let discordMessage = new TextComponent(`${PREFIX}&a${res.data.username}'s Discord: `)
+ .then(hypixelRes => {
+ let discordMessage = new TextComponent(`${PREFIX}&a${mojangRes.data.name}'s Discord: `)
ChatLib.chat(discordMessage);
- ChatLib.chat(`&b${res2.data.player.socialMedia.links.DISCORD}`)
+ ChatLib.chat(`&b${hypixelRes.data.player.socialMedia.links.DISCORD}`)
})
.catch(err => {
ChatLib.chat(`${PREFIX}&eNo discord linked :( (or no key linked)`)
diff --git a/commands/help.js b/commands/help.js
index 05c5a04..8e06b51 100644
--- a/commands/help.js
+++ b/commands/help.js
@@ -7,14 +7,15 @@ export function help()
helpCommand("", "Gets Coleweight of specified user", "(username)")
helpCommand("help", "This menu.", "")
helpCommand("time", "Prints time on timer (timer gui doesn't have to be visible).", "")
- helpCommand("tick", "Shows tick data.", "(mining speed) (('r','jade', etc) || breaking power of block))")
+ helpCommand("calculate", "Calculates things. '/cw calculate help' for more info.", "")