Skip to content
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

Packet helper cleanup #2404

Merged
merged 7 commits into from Dec 2, 2022
Merged

Conversation

tal5
Copy link
Member

@tal5 tal5 commented Dec 1, 2022

Changes

  • resetWorldBorder now uses Player#setWorldBorder(null) on 1.18+.
  • setWorldBorder now uses Player#setWorldBorder on 1.18+.
  • showDemoScreen now has the API implementation as the default in PacketHelper as opposed to a version check in the mechanism code.
  • resetTabListHeaderFooter was removed in favor of Player#setPlayerListHeaderFooter(null, null), this API can't be used to set actual text as it doesn't support advanced text formatting.
  • showEquipment now uses Player#sendEquipmentChange on 1.18+.
  • openBook was removed in favor of Player#openBook.
  • showExperience and resetExperience were removed in favor of Player#sendExperienceChange.
  • showSignEditor's opening an actual sign functionality was replaced by Player#openSign on 1.18+, and it was changed to void as it's return value is now unused.
  • Let Intellij cleanup imports.

Notes

  • resetEquipment was not replaced as Player#sendEquipmentChange only takes one slot -> item pair at a time but the packet allows several, which means switching to Spigot's method would be 6x more packets, let me know if it should still be replaced.
  • respawn was not replaced by Player.Spigot#respawn as the NMS method currently used has a few more features (e.g. handles the world being hardcore and respawns the player in spectator mode if so) which the Spigot method does not, let me know if it should still be replaced / replaced and have the extra functionality replicated with API.
  • PlayerTag.edit_sign's error handling is slightly different, it will now error if an input is given but it isn't a valid LocationTag, but still default to opening a fake editor for back-support, let me know if that should be reverted.
  • This PR has been tested on Paper and Spigot, 1.19.2 and 1.16.5.

@mcmonkey4eva mcmonkey4eva merged commit b83f2a0 into DenizenScript:dev Dec 2, 2022
@tal5 tal5 deleted the Packet_Helper_Cleanup branch December 13, 2022 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants