liblocator 0.0.1__tar.gz

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.
@@ -0,0 +1,7 @@
1
+ Copyright © 2026 lostssss
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: liblocator
3
+ Version: 0.0.1
4
+ Summary: Get the locator bar colour of any minecraft player
5
+ Author-email: lostssss <imaginegameservice@gmail.com>
6
+ Project-URL: Homepage, https://github.com/LostShadowGD/liblocator
7
+ Keywords: minecraft,color
8
+ Classifier: Programming Language :: Python
9
+ Classifier: Programming Language :: Python :: 3
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: requests>=2.0.0
14
+ Dynamic: license-file
15
+
16
+ # liblocator
17
+
18
+ A small Python library to fetch the locator bar colour of any Minecraft player!
19
+
20
+ ## Usage
21
+
22
+ In the terminal, run:
23
+ ```
24
+ liblocator-cli <username>
25
+ ```
26
+
27
+ to get the colour of a player. You can use liblocator as a library, like this:
28
+
29
+ ```
30
+ import liblocator
31
+ colour = liblocator.getDotColour("lostssss")
32
+ ```
33
+ which returns a list like this:
34
+ ```
35
+ ['#8aadc1', [138, 173, 193]]
36
+ ```
37
+ (which is hex code + RGB).
38
+
39
+ ### Multiple Usernames
40
+
41
+ Separate multiple usernames with commas, like this:
42
+
43
+ ```
44
+ liblocator-cli Grian,PearlescentMoon
45
+ ```
46
+
47
+ ### Hex-Only Output
48
+
49
+ The --hex flag makes liblocator simply print the hex code of the player's locator bar dot, and nothing else, like this:
50
+
51
+ ```
52
+ liblocator-cli Smallishbeans --hex
53
+ ```
54
+ this can be useful to embed liblocator in projects made in other languages.
@@ -0,0 +1,39 @@
1
+ # liblocator
2
+
3
+ A small Python library to fetch the locator bar colour of any Minecraft player!
4
+
5
+ ## Usage
6
+
7
+ In the terminal, run:
8
+ ```
9
+ liblocator-cli <username>
10
+ ```
11
+
12
+ to get the colour of a player. You can use liblocator as a library, like this:
13
+
14
+ ```
15
+ import liblocator
16
+ colour = liblocator.getDotColour("lostssss")
17
+ ```
18
+ which returns a list like this:
19
+ ```
20
+ ['#8aadc1', [138, 173, 193]]
21
+ ```
22
+ (which is hex code + RGB).
23
+
24
+ ### Multiple Usernames
25
+
26
+ Separate multiple usernames with commas, like this:
27
+
28
+ ```
29
+ liblocator-cli Grian,PearlescentMoon
30
+ ```
31
+
32
+ ### Hex-Only Output
33
+
34
+ The --hex flag makes liblocator simply print the hex code of the player's locator bar dot, and nothing else, like this:
35
+
36
+ ```
37
+ liblocator-cli Smallishbeans --hex
38
+ ```
39
+ this can be useful to embed liblocator in projects made in other languages.
@@ -0,0 +1,55 @@
1
+ import requests
2
+
3
+ class LocatorException(Exception):
4
+ def __init__(self, message):
5
+ super().__init__("ERROR: " + str(message))
6
+
7
+ class LocatorColourFinder:
8
+ def getColours(self, number: int):
9
+ number &= 0xFFFFFFFF
10
+ return [
11
+ (number >> 16) & 255,
12
+ (number >> 8) & 255,
13
+ number & 255
14
+ ]
15
+
16
+ def hashUUID(self, _value):
17
+ result = (_value ^ (_value >> 32)) & 4294967295
18
+ if result >= 2147483648:
19
+ result -= 4294967296
20
+ return result
21
+
22
+ def getHash(self, _uuid: str):
23
+ uuidArray = _uuid.split("-")
24
+
25
+ most = int(uuidArray[0], 16) & 4294967295
26
+ most <<= 16
27
+ most |= int(uuidArray[1], 16) & 65535
28
+ most <<= 16
29
+ most |= int(uuidArray[2], 16) & 65535
30
+
31
+ least = int(uuidArray[3], 16) & 65535
32
+ least <<= 48
33
+ least |= int(uuidArray[4], 16) & 281474976710655
34
+
35
+ return self.hashUUID(most ^ least)
36
+
37
+ def getHex(self, col: list[int]):
38
+ return "#" + "".join(f"{c:02x}" for c in col)
39
+
40
+ def getDotColour(username: str):
41
+ r = requests.get(f"https://playerdb.co/api/player/minecraft/{username}")
42
+ if r.status_code == 200:
43
+ try: uuid = r.json()["data"]["player"]["id"]
44
+ except KeyError:
45
+ raise LocatorException("Player information parsing failed.")
46
+
47
+ finder = LocatorColourFinder()
48
+ hashCode = finder.getHash(uuid.lower())
49
+
50
+ colour = finder.getColours(hashCode)
51
+ hex = finder.getHex(colour)
52
+
53
+ return [hex, colour]
54
+ else:
55
+ raise LocatorException(f"Failed to fetch player information. Status code: {r.status_code}")
@@ -0,0 +1,46 @@
1
+ import click
2
+ import liblocator
3
+
4
+ def askForUsername():
5
+ return input("Enter player username: ")
6
+
7
+ def findSinglePlayer(username, hex):
8
+ if username:
9
+ colourData = liblocator.getDotColour(username)
10
+ else:
11
+ if not hex:
12
+ print("\033[1m\033[38;5;48m", "Welcome to liblocator-cli", "\033[0m")
13
+ print("")
14
+ username = askForUsername()
15
+ colourData = liblocator.getDotColour(username)
16
+ else:
17
+ print("ERROR: No username passed with hex flag.")
18
+ raise SystemExit(0)
19
+
20
+ if hex:
21
+ print(f"{colourData[0]}")
22
+ else:
23
+ print(f"\033[1m{username}'s locator bar colour is {colourData[0]}!", "\033[0m")
24
+ print("")
25
+ print(f"HEX: {colourData[0]}")
26
+ print(f"RGB: {str(colourData[1]).replace('[', '(').replace(']', ')')}")
27
+
28
+ print(f"\033[48;2;{colourData[1][0]};{colourData[1][1]};{colourData[1][2]}m PREVIEW \033[0m")
29
+
30
+ @click.command()
31
+ @click.argument('username', required=False)
32
+ @click.option('--hex', is_flag=True, help='Exclusively prints the hex code. Requires a username to be passed.')
33
+ def find(username, hex):
34
+ if username == None:
35
+ findSinglePlayer(username, hex)
36
+ elif "," in username:
37
+ names = [name.strip() for name in username.split(",") if name.strip()]
38
+ for name in names:
39
+ findSinglePlayer(name, hex)
40
+ if not hex:
41
+ print("")
42
+ else:
43
+ findSinglePlayer(username, hex)
44
+
45
+ if __name__ == '__main__':
46
+ find()
@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: liblocator
3
+ Version: 0.0.1
4
+ Summary: Get the locator bar colour of any minecraft player
5
+ Author-email: lostssss <imaginegameservice@gmail.com>
6
+ Project-URL: Homepage, https://github.com/LostShadowGD/liblocator
7
+ Keywords: minecraft,color
8
+ Classifier: Programming Language :: Python
9
+ Classifier: Programming Language :: Python :: 3
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: requests>=2.0.0
14
+ Dynamic: license-file
15
+
16
+ # liblocator
17
+
18
+ A small Python library to fetch the locator bar colour of any Minecraft player!
19
+
20
+ ## Usage
21
+
22
+ In the terminal, run:
23
+ ```
24
+ liblocator-cli <username>
25
+ ```
26
+
27
+ to get the colour of a player. You can use liblocator as a library, like this:
28
+
29
+ ```
30
+ import liblocator
31
+ colour = liblocator.getDotColour("lostssss")
32
+ ```
33
+ which returns a list like this:
34
+ ```
35
+ ['#8aadc1', [138, 173, 193]]
36
+ ```
37
+ (which is hex code + RGB).
38
+
39
+ ### Multiple Usernames
40
+
41
+ Separate multiple usernames with commas, like this:
42
+
43
+ ```
44
+ liblocator-cli Grian,PearlescentMoon
45
+ ```
46
+
47
+ ### Hex-Only Output
48
+
49
+ The --hex flag makes liblocator simply print the hex code of the player's locator bar dot, and nothing else, like this:
50
+
51
+ ```
52
+ liblocator-cli Smallishbeans --hex
53
+ ```
54
+ this can be useful to embed liblocator in projects made in other languages.
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ liblocator/__init__.py
5
+ liblocator/cli.py
6
+ liblocator.egg-info/PKG-INFO
7
+ liblocator.egg-info/SOURCES.txt
8
+ liblocator.egg-info/dependency_links.txt
9
+ liblocator.egg-info/entry_points.txt
10
+ liblocator.egg-info/requires.txt
11
+ liblocator.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ liblocator-cli = liblocator.cli:find
@@ -0,0 +1 @@
1
+ requests>=2.0.0
@@ -0,0 +1 @@
1
+ liblocator
@@ -0,0 +1,26 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "liblocator"
7
+ version = "0.0.1"
8
+ description = "Get the locator bar colour of any minecraft player"
9
+ readme = "README.md"
10
+ authors = [{ name = "lostssss", email = "imaginegameservice@gmail.com" }]
11
+ license-files = ["LICENSE"]
12
+ classifiers = [
13
+ "Programming Language :: Python",
14
+ "Programming Language :: Python :: 3",
15
+ ]
16
+ keywords = ["minecraft", "color"]
17
+ dependencies = [
18
+ "requests>=2.0.0",
19
+ ]
20
+ requires-python = ">=3.9"
21
+
22
+ [project.urls]
23
+ Homepage = "https://github.com/LostShadowGD/liblocator"
24
+
25
+ [project.scripts]
26
+ liblocator-cli = "liblocator.cli:find"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+