text: /* jshint esversion: 8 */
  /* THIS IS A TEST VERSION OF JSMC v1.6 */
  
  //ROUNDS THE NUMBER
  function roundNumber(rnum, rlength) {
    var newnumber = Math.round(rnum * Math.pow(10, rlength)) / Math.pow(10, rlength);
    return newnumber;
  }
  
  //CALCULATES NETWORK LEVEL
  function getLevel(exp) {
    const EXP_NEEDED = [100000, 150000, 250000, 500000, 750000, 1000000, 1250000, 1500000, 2000000, 2500000, 2500000, 2500000, 2500000, 2500000, 3000000];
    let level = 0;
    for (let i = 0; i <= 1000; i += 1) {
      let need = 0;
      if (i >= EXP_NEEDED.length) {
        need = EXP_NEEDED[EXP_NEEDED.length - 1];
      } else {
        need = EXP_NEEDED[i];
      }
      if ((exp - need) < 0) {
        return Math.round((level + (exp / need)) * 100) / 100;
      }
      level += 1;
      exp -= need;
    }
    return 1000;
  }
  
  //CALCULATES SKYWARS LEVEL
  function getSkyLevel(xp) {
    var xps = [0, 20, 70, 150, 250, 500, 1000, 2000, 3500, 6000, 10000, 15000];
    let exactLevel = 0
    if (xp >= 15000) {
      exactLevel = roundNumber((xp - 15000) / 10000 + 12, 2);
    } else {
      for (i = 0; i < xps.length; i++) {
        if (xp < xps[i]) {
          exactLevel = Math.floor(i + (xp - xps[i - 1]) / (xps[i] - xps[i - 1]));
          break;
        }
      }
    }
    return exactLevel;
  }
  
  //JSMC FUNCTION
  async function jsmc(a) {
    //ACCOUNT STATUS
    await fetch("https://api.gapple.pw/blocked/" + a).then(a => a.json()).then(e => {
      player = new Object({}),
        player.status = e.status,
        "blocked" == player.status && !1 === /^[a-zA-Z0-9_]{3,16}$/.test(a) && (player.status = "invalid"),
  
        //ACCOUNT TYPE
        fetch("https://api.gapple.pw/status/" + a).then(a => a.json()).then(e => {
          player.type = e.status,
  
            //BASIC PLAYER INFO
            fetch("https://playerdb.co/api/player/minecraft/" + a).then(a => a.json()).then(a => {
              if (a.error === true) {
                player.error = a.error
              } else {
                player.error = false;
              }
              player.username = a.data.player.username,
                player.uuid = a.data.player.id,
                player.id = a.data.player.raw_id,
                player.name_history = a.data.player.meta.name_history.reverse(),
                player.skin = `https://crafatar.com/skins/${player.id}`,
  
                //AVATAR RENDERS
                player.renders = new Object({}),
  
                player.renders.icon = `https://crafatar.com/avatars/${player.id}?overlay`,
  
                player.renders.avatar_1 = `https://crafatar.com/renders/body/${player.id}?overlay`,
                player.renders.avatar_2 = `https://visage.surgeplay.com/full/${player.id}`,
                player.renders.avatar_3 = `https://visage.surgeplay.com/frontfull/${player.id}?overlay`,
  
                player.renders.bust_1 = `https://visage.surgeplay.com/front/${player.id}`,
                player.renders.bust_2 = `https://visage.surgeplay.com/bust/${player.id}`,
  
                player.renders.head_1 = `https://crafatar.com/renders/head/${player.id}?overlay`,
                player.renders.head_2 = `https://visage.surgeplay.com/head/${player.id}`,
  
                //COSMETICS
                player.cosmetics = new Object({}),
  
                //CAPES
                player.cosmetics.cape = new Object({}),
                player.cosmetics.cape.official = `https://crafatar.com/capes/${player.id}`,
                player.cosmetics.cape.optifine = `https://api.gapple.pw/cors/optifine/${player.username}`,
                player.cosmetics.cape.labymod = `https://api.gapple.pw/cors/labymod/cape/${player.id}`,
                player.cosmetics.bandana = new Object({}),
  
                //BANDANAS
                player.cosmetics.bandana.labymod = `https://api.gapple.pw/cors/labymod/bandana/${player.id}`,
  
                //SERVERS
                player.servers = new Object({}),
  
                //HYPIXEL
                fetch("https://api.hypixel.net/player?key=63f20355-92d7-42d7-a2a5-6457160aa4eb&uuid=" + player.id).then(a => a.json()).then(a => {
                  player.servers.hypixel = new Object({}),
                    player.servers.hypixel.success = a.success,
                    null !== a.player && (player.servers.hypixel.rank = a.player.rank,
                      player.servers.hypixel.newPackageRank = a.player.newPackageRank,
                      player.servers.hypixel.monthlyPackageRank = a.player.monthlyPackageRank,
                      player.servers.hypixel.firstLogin = a.player.firstLogin,
                      player.servers.hypixel.lastLogin = a.player.lastLogin,
                      player.servers.hypixel.lastLogout = a.player.lastLogout,
                      player.servers.hypixel.networkExp = a.player.networkExp,
                      player.servers.hypixel.networkLevel = roundNumber((Math.sqrt((2 * player.servers.hypixel.networkExp) + 30625) / 50) - 2.5, 2),
                      player.servers.hypixel.karma = a.player.karma,
                      player.servers.hypixel.stats = a.player.stats);
                  if (player.servers.hypixel.stats.SkyWars !== undefined) {
                    player.servers.hypixel.stats.SkyWars.level = getSkyLevel(player.servers.hypixel.stats.SkyWars.skywars_experience);
                    player.servers.hypixel.stats.Bedwars.level = a.player.achievements.bedwars_level;
                  };
  
                  //HYPIXEL PLAYER STATUS
                  fetch("https://api.hypixel.net/status?key=63f20355-92d7-42d7-a2a5-6457160aa4eb&uuid=" + player.id).then(a => a.json()).then(a => {
                      player.servers.hypixel.online = a.session.online;
                    }),
  
                    //HYPIXEL GUILD
                    fetch("https://api.hypixel.net/guild?key=63f20355-92d7-42d7-a2a5-6457160aa4eb&player=" + player.id).then(a => a.json()).then(e => {
                      player.servers.hypixel.guild = new Object({});
                      player.servers.hypixel.guild.success = e.success;
                      if (e.guild !== null) {
                        player.servers.hypixel.guild.id = e.guild._id,
                          player.servers.hypixel.guild.name = e.guild.name,
                          player.servers.hypixel.guild.createdAt = e.guild.created,
                          player.servers.hypixel.guild.members = e.guild.members,
                          player.servers.hypixel.guild.ranks = e.guild.ranks,
                          player.servers.hypixel.guild.exp = e.guild.exp,
                          player.servers.hypixel.guild.level = roundNumber(getLevel(player.servers.hypixel.guild.exp), 0),
                          player.servers.hypixel.guild.tag = e.guild.tag,
                          player.servers.hypixel.guild.tagColor = e.guild.tagColor,
                          player.servers.hypixel.guild.coins = e.guild.coins,
                          player.servers.hypixel.guild.coinsEver = e.guild.coinsEver,
                          player.servers.hypixel.guild.expByGameType = e.guild.guildExpByGameType;
                      }
                      //HYPIXEL FRIENDS
                      player.servers.hypixel.friends = new Object({});
                      fetch("https://api.hypixel.net/friends?key=63f20355-92d7-42d7-a2a5-6457160aa4eb&uuid=" + player.id).then(a => a.json()).then(e => {
                        var friends = '';
                        var started = '';
                        for (var i = 0; i < e.records.length; i++) {
                          if (e.records[i].uuidSender !== e.uuid) {
                            friends += e.records[i].uuidSender + ",";
                          }
                          if (e.records[i].uuidReceiver !== e.uuid) {
                            friends += e.records[i].uuidReceiver + ",";
                          }
                          started += e.records[i].started + ",";
                        }
                        var friends_arr = friends.slice(0, -1).split(",");
                        var friends_rev = [];
                        var friends_length = friends_arr.length;
                        for (var a = friends_length - 1; a >= 0; a--) {
                          friends_rev.push(friends_arr[a]);
                        }
                        var started_arr = started.slice(0, -1).split(",");
                        var started_rev = [];
                        var started_length = started_arr.length;
                        for (var c = started_length - 1; c >= 0; c--) {
                          started_rev.push(started_arr[c]);
                        }
                        player.servers.hypixel.friends.uuid = JSON.parse(JSON.stringify(friends_rev)); //RETURNS THE USERS FRIENDS UUIDS
                        player.servers.hypixel.friends.timestamp = JSON.parse(JSON.stringify(started_rev)); //RETURNS WHEN THE USER BECAME FRIENDS WITH THE PERSON
                      });
                      //RUNS THE USERS CODE
                      code();
                    });
                }).catch(a => player.error = true); //CATCHES ERROR
            });
        });
    });
  }
  