• BASH, PYTHON > exploiter les statistiques de Minecraft

      Les statistiques de chaque parties enregistrées de Minecraft se trouvent dans /home/USER/.minecraft/saves/NOM-DU-MONDE/stats/UUID.json

      Bash

      Temps passé sur une partie :

      FICHIER=/home/toto/.minecraft/saves/nom_de_la_partie/stats/26ade5ac-aef8-4e76-937b-4ab33dba0c42.json
      TIME=$( cat "$FICHIER" | tr ',' '\n' | grep minecraft:play_time | sed "s|.*:||" ) ;
      H=$(( TIME / 20 / 60 / 60 ));
      M=$(( ( TIME-(H*60*60*20) ) / 20 / 60 ));
      S=$(( ( TIME-(H*60*60*20)-(M*60*20) ) / 20 ));
      echo "Vous avez joué $H h $M m $S s."

      Python

      import json
      json_file = open("/home/NOM_USER/.minecraft/saves/NOM_MONDE/stats/<UUID>.json")
      variables = json.load(json_file)
      json_file.close()
      print(variables["stats"])

       

      On peut faire variables["stats"]["minecraft:mined"]["minecraft:lily_of_the_valley"] et obtenir 1

      Ou simplement: {'stats': {'minecraft:mined': {'minecraft:lily_of_the_valley': 1}}}

       

      json.load() transforme du json en dictionnaire ou liste:

       

      stats = variables['stats']
      print(stats)
      mined = stats['minecraft:mined']
      print(mined)
      print(f"stone: {mined['minecraft:stone']}")

      LISTE DES STATS

      The resource locations of statistics are in form of A.B:C.D, in which:

      A is the namespace of statistic type.

      B is the path of statistic type.

      C is the namespace of statistic name.

      D is the path of statistic name.

       

      For both two namespaces, it can be omitted if it is minecraft. For example, the following four locations work the sam

      minecraft.mined:minecraft.stonemined:minecraft.stone - minecraft.mined:stone mined:stone

      types et noms

      General statistics, their type is called minecraft:custom.

      Items : minecraft:minedminecraft:brokenminecraft:craftedminecraft:usedminecraft:picked_up, and minecraft:dropped.

      Mob statistics, their types are minecraft:killed and minecraft:killed_by.

       

      Statistic type Description Resource location
      CUSTOM A multitude of generic statistics related to a player’s actions. Players’ statistics increase automatically when they perform the action relevant to the statistic names. 

      The statistic name for CUSTOM is used to specify the action for statistics. See #List of custom statistic names below.

      minecraft:custom
      BLOCK_MINED Statistic related to the number of blocks a player mined. Players’ statistic increases when the player mines a block of the specified type. It never increases for a player in Creative Mode. 

      The statistic name for BLOCK_MINED is used to specify the type of blocks. It can be the resource location of any block.

      minecraft:mined
      ITEM_BROKEN Statistics related to the number of items a player ran their durability negative. Players’ statistic increases when a player runs the durability of one item of the specified type negative. Durability runs negative when the item’s durability loss–condition is met and the item already has a durability of 0. 

      The statistic name for ITEM_BROKEN is used to specify the type of items. It can be the resource location of any item or block for which items exist.

      minecraft:broken
      ITEM_CRAFTED Statistics related to the number of items crafted, smelted, etc. Players’ statistic increases by an amount equal to the number of items crafted or smelted, upon removing a block or item from the output of an interface, like a crafting table, a furnace, or a villager‘s output slot. 

      The statistic name for ITEM_CRAFTED is used to specify the type of items. It can be the resource location of any item or block for which items exist.

      minecraft:crafted
      ITEM_USED Statistics related to the number of block or item used. Players’ statistic increases when a player uses a block or item. "Use" is defined as when: 

      Players’ statistics do not increase when items are used on mobs—whether to name, tame, feed, breed, saddle, leash, shear, dye, milk, or gather stew from—when armor is equipped directly with use, when leather armor is washed in a cauldron, and instances mentioned above.

      The statistic name for ITEM_USED is used to specify the type of items. It can be the resource location of any item or block for which items exist.

      minecraft:used
      ITEM_PICKED_UP Statistics related to the number of dropped items a player picked up. Players’ statistic increases when the player picks up a dropped item of the specified type. 

      The statistic name for ITEM_PICKED_UP is used to specify the type of items. It can be the resource location of any item or block for which items exist.

      minecraft:picked_up
      ITEM_DROPPED Statistics related to the number of items that droped. Players’ statistic increases when a player drops an item of the specified type from inventory. 

      The statistic name for ITEM_DROPPED is used to specify the type of items. It can be the resource location of any item or block for which items exist.

      minecraft:dropped
      ENTITY_KILLED Statistics related to the number of entities a player killed. Players’ statistic increases when a player kills an entity of the specified type. 

      The statistic name for ENTITY_KILLED is used to specify the type of entities. It can be the resource location of any entity.

      minecraft:killed
      ENTITY_KILLED_BY Statistics related to the times of a player being killed by entities. Players’ statistic increases when the player is killed by an entity of the specified type. 

      The statistic name for ENTITY_KILLED is used to specify the type of entities. It can be the resource location of any entity.

      minecraft:killed_by

      List of custom statistic names

      Statistic name Description Resource location
      Animals Bred The number of times the player bred two mobs. minecraft:animals_bred
      Armor Pieces Cleaned The number of dyed leather armors washed with a cauldron. minecraft:clean_armor
      Banners Cleaned The number of banner patterns washed with a cauldron. minecraft:clean_banner
      Barrels Opened The number of times the player has opened a Barrel. minecraft:open_barrel
      Bells Rung The number of times the player has rung a Bell. minecraft:bell_ring
      Cake Slices Eaten The number of cake slices eaten. minecraft:eat_cake_slice
      Cauldrons Filled The number of times the player filled cauldrons with water buckets. minecraft:fill_cauldron
      Chests Opened The number of times the player opened chests. minecraft:open_chest
      Damage Absorbed The amount of damage the player has absorbed in tenths of 1♥. minecraft:damage_absorbed
      Damage Blocked By Shield The amount of damage the player has blocked with a shield in tenths of 1♥. minecraft:damage_blocked_by_shield
      Damage Dealt The amount of damage the player has dealt in tenths of 1♥. Includes only melee attacks. minecraft:damage_dealt
      Damage Dealt (Absorbed) The amount of damage the player has dealt that were absorbed, in tenths of 1♥. minecraft:damage_dealt_absorbed
      Damage Dealt (Resisted) The amount of damage the player has dealt that were resisted, in tenths of 1♥. minecraft:damage_dealt_resisted
      Damage Resisted The amount of damage the player has resisted in tenths of 1♥. minecraft:damage_resisted
      Damage Taken The amount of damage the player has taken in tenths of 1♥. minecraft:damage_taken
      Dispensers Searched The number of times interacted with dispensers. minecraft:inspect_dispenser
      Distance Climbed The total distance traveled up ladders or vines. minecraft:climb_one_cm
      Distance Crouched The total distance walked while sneaking. minecraft:crouch_one_cm
      Distance Fallen The total distance fallen, excluding jumping. If the player falls more than one block, the entire jump is counted. minecraft:fall_one_cm
      Distance Flown Distance traveled upwards and forwards at the same time, while more than one block above the ground. minecraft:fly_one_cm
      Distance Sprinted The total distance sprinted. minecraft:sprint_one_cm
      Distance Swum The total distance covered with sprint-swimming. minecraft:swim_one_cm
      Distance Walked The total distance walked. minecraft:walk_one_cm
      Distance Walked on Water The distance covered while bobbing up and down over water. minecraft:walk_on_water_one_cm
      Distance Walked under Water The total distance you have walked underwater. minecraft:walk_under_water_one_cm
      Distance by Boat The total distance traveled by boats. minecraft:boat_one_cm
      Distance by Elytra The total distance traveled by elytra. minecraft:aviate_one_cm
      Distance by Horse The total distance traveled by horses. minecraft:horse_one_cm
      Distance by Minecart The total distance traveled by minecarts. minecraft:minecart_one_cm
      Distance by Pig The total distance traveled by pigs via saddles. minecraft:pig_one_cm
      Distance by Strider The total distance traveled by striders via saddles. minecraft:strider_one_cm
      Droppers Searched The number of times interacted with droppers. minecraft:inspect_dropper
      Ender Chests Opened The number of times the player opened ender chests. minecraft:open_enderchest
      Fish Caught The number of fish caught. minecraft:fish_caught
      Games Quit The number of times "Save and quit to title" has been clicked. minecraft:leave_game
      Hoppers Searched The number of times interacted with hoppers. minecraft:inspect_hopper
      Interactions with Anvil The number of times interacted with anvils. minecraft:interact_with_anvil
      Interactions with Beacon The number of times interacted with beacons. minecraft:interact_with_beacon
      Interactions with Blast Furnace The number of times interacted with Blast Furnaces. minecraft:interact_with_blast_furnace
      Interactions with Brewing Stand The number of times interacted with brewing stands. minecraft:interact_with_brewingstand
      Interactions with Campfire The number of times interacted with Campfires. minecraft:interact_with_campfire
      Interactions with Cartography Table The number of times interacted with Cartography Tables. minecraft:interact_with_cartography_table
      Interactions with Crafting Table The number of times interacted with crafting tables. minecraft:interact_with_crafting_table
      Interactions with Furnace The number of times interacted with furnaces. minecraft:interact_with_furnace
      Interactions with Grindstone The number of times interacted with Grindstones. minecraft:interact_with_grindstone
      Interactions with Lectern The number of times interacted with Lecterns. minecraft:interact_with_lectern
      Interactions with Loom The number of times interacted with Looms. minecraft:interact_with_loom
      Interactions with Smithing Table The number of times interacted with Smithing Tables. minecraft:interact_with_smithing_table
      Interactions with Smoker The number of times interacted with Smokers. minecraft:interact_with_smoker
      Interactions with Stonecutter The number of times interacted with Stonecutters. minecraft:interact_with_stonecutter
      Items Dropped The number of items dropped. This does not include items dropped upon death. If a group of items are dropped together, eg a stack of 64, it only counts as 1. minecraft:drop
      Items Enchanted The number of items enchanted. minecraft:enchant_item
      Jumps The total number of jumps performed. minecraft:jump
      Mob Kills The number of mobs the player killed. minecraft:mob_kills
      Music Discs Played The number of music discs played on a jukebox. minecraft:play_record
      Note Blocks Played The number of note blocks hit. minecraft:play_noteblock
      Note Blocks Tuned The number of times interacted with note blocks. minecraft:tune_noteblock
      Number of Deaths The number of times the player died. minecraft:deaths
      Plants Potted The number of plants potted onto flower pots. minecraft:pot_flower
      Player Kills The number of players the player killed (on PvP servers). Indirect kills do not count. minecraft:player_kills
      Raids Triggered The number of times the player has triggered a Raid. minecraft:raid_trigger
      Raids Won The number of times the player has won a Raid. minecraft:raid_win
      Shulker Boxes Cleaned The number of times the player has washed a Shulker Box with a cauldron. minecraft:clean_shulker_box
      Shulker Boxes Opened The number of times the player has opened a Shulker Box. minecraft:open_shulker_box
      Sneak Time The time the player has held down the sneak button (tracked in ticks). minecraft:sneak_time
      Talked to Villagers The number of times interacted with villagers (opened the trading GUI). minecraft:talked_to_villager
      Targets Hit The number of times the player has shot a target block. minecraft:target_hit
      Time Played The total amount of time played (tracked in ticks). This is not necessarily displayed in minutes - it displays in seconds, minutes, hours or days whichever makes the most sense. If the game is paused this number ceases to increase. If "5.50 h" is displayed this means that you have played for 5 hours and 30 minutes (not 50 minutes). minecraft:play_time
      Time Since Last Death The time since the player‘s last death (tracked in ticks). minecraft:time_since_death
      Time Since Last Rest The time since the player’s last rest (tracked in ticks). If this value is greater than 1.00 h, phantoms can spawn. minecraft:time_since_rest
      Time with World Open The total amount of time the world was opened (tracked in ticks). Unlike Play Time, if the game is paused this number continues to increase. [1.17] minecraft:total_world_time
      Times Slept in a Bed The number of times the player has slept in a bed. minecraft:sleep_in_bed
      Traded with Villagers The number of times traded with villagers. minecraft:traded_with_villager
      Trapped Chests Triggered The number of times the player opened trapped chests. minecraft:trigger_trapped_chest
      Water Taken from Cauldron The number of times the player took water from cauldrons with glass bottles. minecraft:use_cauldron

      Storage

      The file structure is JSON based and takes the following format:

      • : The root tag.
        • DataVersion: The data version of the game version the file was last saved in.
        • stats: The tag that stores the actual statistics.
          • <statisticType>: A compound that saves all statistics of this type.
            • <statisticName>: The value of the statistic specified in this tag’s name.

      Exemple, un joueur avance d’un block (minecraft.custom:minecraft.walked_one_cm) et casse 1 oak log (minecraft.mined:minecraft.oak_log) :

      {
        "stats": {
           "minecraft:mined": {
              "minecraft:oak_log": 1
           },
           "minecraft:custom": {
              "minecraft:walked_one_cm": 100
           }
        },
        "DataVersion": 2633
      }

      Distance is stored in centimeters (1 block = 100 cm), and time is stored in ticks (1 tick = 0.05 s).

      RÉCUPÉRER LE NOM DU JOUEUR

      https://sessionserver.mojang.com/session/minecraft/profile/UUID_du_joueur

       

      {
        "id" : "552619cf701e424dd59c89a29ed4400a",
        "name" : "toto",
        "properties" : [ {
          "name" : "textures",Sk7Fsf5gOiAiaHR0cDovL3RleHR1cmVAgfQogIA1KfQ=="
        } ]
      }

       

       

 

Aucun commentaire

 

Laissez un commentaire