Skip to content

Conversation

@TheNullicorn
Copy link
Contributor

@TheNullicorn TheNullicorn commented Sep 8, 2021

The Java API is missing a number of guild features (such as ranks, as pointed out in #463), so this PR aims to add those, as well as refactoring areas of the Java API relating to guilds.

GuildReply.java

  • Added documentation
  • Made immutable
  • Removed unnecessary boxed types (namely Boolean)
  • Added equals and hashCode
  • Added some missing stats:
    • Guild.getRanks()
    • Guild.getPreferredGames()
    • Guild.getExperienceForGame(GameType) - from web API's guildExpByGameType field
    • Guild.getAchievementHighScore(GuildAchievement) - from web API's achievements field
    • Member.getExperienceEarned(LocalDate) - from web API's members[i].expHistory field
  • Renamed some methods (e.g. get_id() -> getId(), getCreated() -> getCreationDate(), etc)
    • Original methods haven't been deleted, just deprecated.
    • Future updates can remove the originals if necessary.
  • Fixed some confusing behavior by Guild.getLegacyRanking()
    • Previously, it returned 0 for guilds created after the guild update (those without a ranking)
      • 0 was also used to represent 1st place (for "The Foundation" guild).
      • Now, it returns -1 in those cases.
    • For guilds that did have a ranking, the ranking returned would be zero-based
      • This is no longer the case (1 == 1st place, 2 == 2nd place, and so on)

Banner.java

  • Added documentation
  • Made immutable
  • Added equals and hashCode
  • Renamed some methods
    • Banner.getBase() --> Banner.getBaseColor()
    • Pattern.getPattern() --> Pattern.getType()
    • Same as above: the original names were not deleted, just deprecated.

GetGuildExample.java

  • Rewritten to better showcase the guild API (and general usage of the Java API)
    • Includes the methods added above
    • Partially copied from GetPlayerExample

GuildAchievement.java

Resolves #463

EDIT When making this, I purposefully left out 3 fields in particular. The reason for this is that they represent the guild's internal state, and I wouldn't be very surprised if the devs eventually chose to hide/remove them (like they have in the past with certain fields in the "player" endpoint). These fields are:
  • guild.chatMute
  • guild.members[i].mutedTill
  • guild.hideGmTag
If there's any demand for these fields and the devs can confirm that they're intended to be public, I'd be fine adding them. But I'd rather not add them in the first place if there's any chance of them suddenly becoming inaccessible and breaking someone's app.

Copy link
Member

@ConnorLinfoot ConnorLinfoot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, thanks for contributing! 😄

@ConnorLinfoot ConnorLinfoot merged commit 797b00e into HypixelDev:master Sep 28, 2021
@TheNullicorn TheNullicorn deleted the guild-ranks branch September 28, 2021 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants