1. i get json file in this link https://api.hypixel.net/player?key=apikey&name=nick.
    so i find stats -> bedwars part in json(dict)
    but i cannot find content about level...
    plz help me.
    i want to get bedwars level in hypixel json api!.
     
    #1
  2. It's player.achievements.bedwars_level
     
    #2
    • Like Like x 1
  3. AgneCat

    AgneCat Well-Known Member

    DoppioDesu
    MVP+
    Messages:
    3,384
    How did you even got the file...
     
    #3
  4. #4
  5. Lagg

    Lagg Well-Known Member

    Lagg
    MVP+
    Messages:
    5,582
    You could also get the player's experience and then calculate it from that. Here's plancke's method for doing that (this gives a decimal btw)

    PHP:
    const BEDWARS_EXP_PER_PRESTIGE 489000;
    const 
    BEDWARS_LEVELS_PER_PRESTIGE 100;
    public static function 
    getBedwarsLevel($exp) {
            
    $prestige = (int)($exp GameUtils::BEDWARS_EXP_PER_PRESTIGE);
            
    $exp $exp GameUtils::BEDWARS_EXP_PER_PRESTIGE;
            if (
    $prestige 5) {
                
    $over $prestige 5;
                
    $exp += $over GameUtils::BEDWARS_EXP_PER_PRESTIGE;
                
    $prestige -= $over;
            }
            
    // first few levels are different
            
    if ($exp 500) {
                return 
    + ($prestige GameUtils::BEDWARS_LEVELS_PER_PRESTIGE);
            } else if (
    $exp 1500) {
                return 
    + ($prestige GameUtils::BEDWARS_LEVELS_PER_PRESTIGE);
            } else if (
    $exp 3500) {
                return 
    + ($prestige GameUtils::BEDWARS_LEVELS_PER_PRESTIGE);
            } else if (
    $exp 5500) {
                return 
    + ($prestige GameUtils::BEDWARS_LEVELS_PER_PRESTIGE);
            } else if (
    $exp 9000) {
                return 
    + ($prestige GameUtils::BEDWARS_LEVELS_PER_PRESTIGE);
            }
            
    $exp -= 9000;
            return (
    $exp 5000 4) + ($prestige GameUtils::BEDWARS_LEVELS_PER_PRESTIGE);
        }
     
    #5
    • Like Like x 2
  6. This is the preferred, more accurate method. Anything else is known to give incorrect information sometimes.
     
    #6
  7. (yes I know perfectly well that you hate bumps but I'll just leave this here in case anybody needs it.)
    the translation of the thing above in Java

    PHP:
        private static final int BEDWARS_EXP_PER_PRESTIGE 489000;
        private static final 
    int BEDWARS_LEVELS_PER_PRESTIGE 100;

        
    /**
         * Returns the player's precise BedWars level, and takes into consideration the required
         * experience required in the first 5 levels of each prestige.
         *
         * @param exp Experience of the player
         * @return The player's precise BedWars level
         */
        
    public static double getBedWarsLevel(double exp) {
            
    int prestige = (int) (exp BEDWARS_EXP_PER_PRESTIGE);
            
    exp exp BEDWARS_EXP_PER_PRESTIGE;
            if (
    prestige 5) {
                
    int over prestige 5;
                
    exp += over BEDWARS_EXP_PER_PRESTIGE;
                
    prestige -= over;
            }
            
    // first few levels are different
            
    if (exp 500) {
                return (
    prestige BEDWARS_LEVELS_PER_PRESTIGE);
            } else if (
    exp 1500) {
                return 
    + (prestige BEDWARS_LEVELS_PER_PRESTIGE);
            } else if (
    exp 3500) {
                return 
    + (prestige BEDWARS_LEVELS_PER_PRESTIGE);
            } else if (
    exp 5500) {
                return 
    + (prestige BEDWARS_LEVELS_PER_PRESTIGE);
            } else if (
    exp 9000) {
                return 
    + (prestige BEDWARS_LEVELS_PER_PRESTIGE);
            }
            
    exp -= 9000;
            return (
    exp 5000 4) + (prestige BEDWARS_LEVELS_PER_PRESTIGE);
        }
     
    #7
    • Like Like x 1

Share This Page