-
Notifications
You must be signed in to change notification settings - Fork 152
Add player object #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add player object #260
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it ends up being merged, but it definitely answers some basic questions and ambiguities around stuff, such as networkLevel
field.
Co-authored-by: mdashlw <mdashlw@gmail.com>
Just gonna make this a draft until I'm sure it's good. Are there any other methods you think would be helpful on a player object? Also, thoughts on |
I was wondering if this was being done. That's a LOT of work for you, man, good luck (I'm a little under the impression that you're going to map most if not all of the Player JsonObject? Probably overkill) |
Sorry to disappoint, but that wasn't my plan for the PR. This is mainly for providing a layer of null-safety over the player structure, making it easier to access deeply nested fields which could potentially be missing. Player objects have no defined structure and are constantly changing, so mapping out the entire thing would be unrealistic. I did provided some utility methods for common fields though, such as those related to rank, experience, etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor changes that I can also change once this is merged if needed but looks good. The current plan is to include this in 4.0.0 which we'll hopefully work on getting everything merged and released sometime this month.
Java/src/main/java/net/hypixel/api/adapters/PlayerTypeAdapter.java
Outdated
Show resolved
Hide resolved
Example/src/main/java/net/hypixel/example/GetPlayerExample.java
Outdated
Show resolved
Hide resolved
I've resolved the requested changes, so it should be ready to merge. Right now I've got an |
using lastLogin and lastLogout is not deperecated in any way |
Thanks for all the help. Wasn't able to get to a few of your reviews today, but hopefully by tomorrow. If you spot anything else in the changes, or if I prematurely closed one of the conversations, let me know. |
Apologies, I think I pressed re-review twice by mistake. I've left a few of the conversations open for you to look over, but I'm pretty confident the rest are addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I've made the example a bit more friendly for new users, and cleared up some vague docs. I think I'm happy with this now, but reviews are still welcome. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this looks much more friendly!
It was fun helping you, nullicorn. GG on the merge, time to implement this in my applications |
Thanks for all the helpful comments! Not used to that sort of review, so it was a really nice learning experience |
Provides weak encapsulation around player response JSON in the form of the
Player
objectUnstableHypixelObject
, which itself wraps the actual response JSONnull
)getRaw()
Adds an optional API for filtering unwanted/unneeded properties from objects (based on MongoDB projections)
PropertyFilter#include(String[])
and the static constructorPropertyFilter#including(String[])
UnstableHypixelObject
support filtering via theirfilter(PropertyFilter)
methodHypixelAPI
HypixelAPI#getPlayerByUuid(UUID, PropertyFilter)
Updates
GetPlayerExample
to reflect these changes