minecraft-data-v1 3.1.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,8 +27,8 @@ uuid | `await <MC>.uuid(<playerName>);`
27
27
 
28
28
 
29
29
 
30
- > Used APIs: https://api.mojang.com/, https://mc-heads.net/
30
+ > Used APIs: https://api.mojang.com/, https://mc-heads.net/, https://api.capes.dev/
31
31
 
32
- > If you have any issues, join this [Discord server](https://discord.gg/n25aytTSXX) for help.
32
+ > If you have any issues or questions, join this [Discord server](https://discord.gg/n25aytTSXX) for help.
33
33
 
34
34
 
@@ -1,22 +1,19 @@
1
- const fetch = require("node-fetch");
2
1
  const decode = require("../utils/decode.js");
3
2
  const id = require("./uuid.js");
4
- const names = require("./names.js")
5
- const skinRender = require("./skinRender.js");
3
+ const skinRender = require("./skin.js");
6
4
  const profile = async (user) => {
7
5
  if (!user) throw new TypeError(errors.noName);
8
6
  if (typeof user != "string") throw new TypeError(errors.noString);
9
- const uuid = await id(user);
10
- const history = await fetch("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid);
11
- const json = await history.json();
7
+ const UUID = await id(user);
12
8
  const render = await skinRender(user);
9
+ const history = await fetch("https://sessionserver.mojang.com/session/minecraft/profile/" + UUID);
10
+ const json = await history.json();
13
11
  const data = json["properties"][0].value;
14
12
  const string = decode(data);
15
13
  const stringJson = JSON.parse(string);
16
14
  const userInformation = {
17
15
  name: stringJson.profileName,
18
- //names: await names(user),
19
- uuid: uuid,
16
+ uuid: UUID,
20
17
  textures: {
21
18
  skin: {
22
19
  textureSkin: stringJson.textures.SKIN.url,
@@ -1,16 +1,15 @@
1
- const fetch = require("node-fetch")
2
1
  const uuid = require("./uuid.js");
3
2
  const errors = require("../utils/errors.js");
4
3
  const skinRender = async (user) => {
5
4
  if (!user) throw new TypeError(errors.noName);
6
5
  if (typeof user != "string") throw new TypeError(errors.noString);
7
- let name = await uuid(user);
8
- const history = await fetch("https://api.capes.dev/load/" + user);
9
- const json = await history.json();
6
+ let UUID = await uuid(user);
7
+ const response = await fetch("https://api.capes.dev/load/" + user);
8
+ const json = await response.json();
10
9
  return {
11
- skin: "https://mc-heads.net/body/" + name,
10
+ skin: "https://mc-heads.net/body/" + UUID,
12
11
  cape: json.minecraft.exists ? json.minecraft.frontImageUrl : "No cape",
13
- head: "https://mc-heads.net/head/" + name,
12
+ head: "https://mc-heads.net/head/" + UUID,
14
13
  }
15
14
  }
16
15
 
@@ -1,11 +1,9 @@
1
- const fetch = require("node-fetch");
2
1
  const errors = require("../utils/errors.js");
3
2
  const uuid = async (user) => {
4
3
  if (!user) throw new TypeError(errors.noName);
5
4
  if (typeof user != "string") throw new TypeError(errors.noString);
6
- const url = "https://api.mojang.com/users/profiles/minecraft/";
7
- const result = await fetch(url + user)
8
- const json = await result.json().catch(err => console.log(err))
5
+ const response = await fetch("https://api.mojang.com/users/profiles/minecraft/" + user)
6
+ const json = await response.json().catch(err => console.log(err))
9
7
  return json.id;
10
8
  }
11
9
 
package/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  module.exports = {
2
2
  head: require("./userMethods/getHead.js"),
3
- //names: require("./userMethods/getNames.js"),
4
3
  skin: require("./userMethods/getSkin.js"),
5
4
  uuid: require("./userMethods/getUuid.js"),
6
5
  cape: require("./userMethods/getCape.js"),
package/package.json CHANGED
@@ -1,15 +1,12 @@
1
1
  {
2
2
  "name": "minecraft-data-v1",
3
- "version": "3.1.0",
3
+ "version": "3.3.0",
4
4
  "description": "Minecraft profile data",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
- "keywords": [],
9
+ "keywords": ["minecraft", "data", "game", "profile"],
10
10
  "author": "",
11
- "license": "ISC",
12
- "dependencies": {
13
- "node-fetch": "^2.7.0"
14
- }
11
+ "license": "ISC"
15
12
  }
@@ -1,14 +0,0 @@
1
- const fetch = require("node-fetch")
2
- const uuid = require("./uuid.js");
3
- const names = async (user) => {
4
- if (!user) throw new TypeError("A name is required.");
5
- if (typeof user != "string") throw new TypeError("Names error | 2");
6
- let name = await uuid(user);
7
- const history = await fetch("https://api.mojang.com/user/profiles/" + name + "/names");
8
- const json = await history.json();
9
- const array = json.map(e => e.name);
10
- return array;
11
-
12
- }
13
-
14
- module.exports = names;
@@ -1,10 +0,0 @@
1
- const profile = require("../baseMethods/profile");
2
- const errors = require("../utils/errors.js");
3
- const getNames = async (player) => {
4
- if (!player) throw new TypeError("A name is required.");
5
- if (typeof player != "string") throw new TypeError("The name must be a string.");
6
- const user = await profile(player);
7
- return user.names;
8
- }
9
-
10
- module.exports = getNames;