Skip to content

Commit

Permalink
Update specialMayorCommand.js
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonCodess committed Dec 24, 2024
1 parent add2b56 commit 6e7e6fc
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions src/minecraft/commands/specialMayorCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,30 @@ const yearMs = yearLength * monthMs;

const yearZero = 1560275700000;

const currentSkyblockYear = timeToSkyblockYear(Date.now());

var yearsUntilSpecial = 0;
var diffSkyblockYear = currentSkyblockYear;
var specialMayor = "";


function timeToSkyblockYear(time) {
return Math.floor((time - yearZero) / yearMs) + 1;
}

function getSpecialMayor(skyblockYear) {
if (diffSkyblockYear % 24 == 8){
specialMayor = "Derpy";
} else if (diffSkyblockYear % 24 == 16){
specialMayor = "Jerry";
} else if (diffSkyblockYear % 24 == 0){
specialMayor = "Scorpius";
} else {
specialMayor = "Error!";
}
return specialMayor;
}

class SpecialMayorCommand extends minecraftCommand {
constructor(minecraft) {
super(minecraft);
Expand All @@ -35,22 +54,6 @@ class SpecialMayorCommand extends minecraftCommand {

async onCommand() {
try {
const currentSkyblockYear = timeToSkyblockYear(Date.now());
var yearsUntilSpecial = 0;
var diffSkyblockYear = currentSkyblockYear;
var specialMayor = "";
function getSpecialMayor(skyblockYear) {
if (diffSkyblockYear % 24 == 8){
specialMayor = "Derpy";
} else if (diffSkyblockYear % 24 == 16){
specialMayor = "Jerry";
} else if (diffSkyblockYear % 24 == 0){
specialMayor = "Scorpius";
} else {
specialMayor = "Error!";
}
return specialMayor;
}

if (currentSkyblockYear % 8 == 0){
specialMayor = getSpecialMayor(currentSkyblockYear);
Expand Down

0 comments on commit 6e7e6fc

Please sign in to comment.