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

Added addon request system to request data from an addon in spigot plugins #400

Merged
merged 1 commit into from
Dec 18, 2018

Conversation

HyKurtis
Copy link
Contributor

@HyKurtis HyKurtis commented Dec 17, 2018

So I've been trying to directly get a players island level from one of my plugins but I've been having issues because spigot plugins can not use classes from Addons. (This was discussed in this issue: #352)

I see there is an option to listen for AddonEvent to receive data, but this would requiring caching of any data received, and this could be a struggle if wanting to obtain offline player levels (as it was in my case)

I've added this system so that you can request data from Addons, and Addons can add handlers for these requests.

Here is an example of a request handler (to be put in an Addons code), for responding to a level request. This code would be ran through the main class of the Addon using #registerRequestHandler.

image

Here is an example of request to an Addon (to be put in a spigot plugin), to request a player's island level.

image

I've tested this myself and it works perfectly. This would be an amazing help for developers trying to obtain data from Addons as it would remove the need to cache data after listening through AddonEvent.

I made an effort to maintain the code style of your plugin, there shouldn't be any inconsistencies.

I hope you consider my pull request.

@tastybento
Copy link
Member

Thanks for the submission, we'll look at it!

Copy link
Member

@Poslovitch Poslovitch left a comment

Choose a reason for hiding this comment

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

I approve. This PR is well documented and follows our - implicit - code guidelines.

@Poslovitch Poslovitch changed the base branch from master to develop December 17, 2018 05:18
@tastybento tastybento merged commit 8da55b6 into BentoBoxWorld:develop Dec 18, 2018
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

3 participants