jaqobb / namemc

Lightweight, straightforward, easy-to-use and fast NameMC Java wrapper
Apache License 2.0
24 stars 7 forks source link

Callback of the UUID even when the profile does not exist. #6

Open Koskolonium opened 4 days ago

Koskolonium commented 4 days ago

I have a unique problem with the project. Within my plugin DDoSDefender, my goal is to verify player accounts before the main class of the server by utilizing the UUID from the LoginStart packet to check whether the player's profile exists.

Currently, I’m encountering an issue: when bots send a UUID that should not correspond to any existing profile, the .fetch(playerUUID); method consistently returns the same UUID I sent instead of providing an indication that the profile does not exist (Like a null value or 0) (I also checked many Bot UUID's against NameMC and they do not exist).

I’m unsure whether this is a problem with my code or if it’s an intended feature of the wrapper. Despite attempting several solutions, I have not been able to resolve the issue.

If you’d like to discuss this further, I would be happy to provide more details on Discord. You can reach me at the username Koskolonium.

jaqobb commented 3 days ago

Unfortunately, not much can be done about this. As long as the UUID you provided is a valid UUID, NameMC's API endpoint will give a result regardless of whether there is a Minecraft account with that UUID or not (empty array in case of non-existing profiles). It does not work like their frontend (that returns 404 if Minecraft account with a specific UUID was not found) and as such simply using the available API does not give the ability to determine the existence of a Minecraft account (or at the very least one saved on the NameMC's side).

Server fetching works in a similar way, preventing me from being able to verify whether the provided address is actually valid.

For this, NameMC would have to update their API endpoints or you would need to use a different library to verify the UUID.

Alternatively, I could add custom UUID verification myself with a way to bypass that check if you are sure the Minecraft account with that UUID exists.

Koskolonium commented 3 days ago

Unfortunately, not much can be done about this. As long as the UUID you provided is a valid UUID, NameMC's API endpoint will give a result regardless of whether there is a Minecraft account with that UUID or not (empty array in case of non-existing profiles). It does not work like their frontend (that returns 404 if Minecraft account with a specific UUID was not found) and as such simply using the available API does not give the ability to determine the existence of a Minecraft account (or at the very least one saved on the NameMC's side).

Server fetching works in a similar way, preventing me from being able to verify whether the provided address is actually valid.

For this, NameMC would have to update their API endpoints or you would need to use a different library to verify the UUID.

Alternatively, I could add custom UUID verification myself with a way to bypass that check if you are sure the Minecraft account with that UUID exists.

i see that is unfortunate, if you do want to add custom UUID Verification that would be very useful but i wont pressure you, i will look into other sources.