EssentialsX / Essentials

The modern Essentials suite for Spigot and Paper.
https://essentialsx.net
GNU General Public License v3.0
1.9k stars 966 forks source link

fix backwards compatibility breakages from 1.21 api changes #5854

Closed CyberFlameGO closed 1 day ago

CyberFlameGO commented 2 days ago

Information

This PR fixes #5851.

Details

Proposed fix:
Get the top inventory via reflection, and get the bottom inventory via getting clicked inventory rather than via view.

Environments tested:

Will test later on and populate these fields - just drafting the PR for review

OS:

Java version:

Demonstration:
N/A - if this PR will work then there is nothing to screenshot other than lack of exceptions in logs

JRoy commented 1 day ago

I do not think reflection is the way to go here, especially considering that some of this code could run multiple times per tick. (And if we did we did go the reflection route I'd want to use cached MethodHandles).

I think the best route here is using a provider, I will open a PR with this shortly. Thanks for looking into this anyway.