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

Tebex-PMMP v3.0 #50

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Tebex-PMMP v3.0 #50

wants to merge 5 commits into from

Conversation

Muqsit
Copy link
Contributor

@Muqsit Muqsit commented Mar 10, 2020

Introduction

This is a complete rewrite of the Tebex-PMMP plugin, aiming bug fixes, improvements and easing ways to add features in the future.

What's New

  • Tebex-PMMP now runs multi-threaded and the number of workers can be configured (worker-limit in config.yml, default: 2).
  • /buy now supports two types of GUIs - inventory and form. The default GUI type is inventory but this can be configured (categories-gui-type in config.yml).
  • Gamertags with spaces are now escaped! (Escape player name with spaces for reliability #46)
  • All API calls are now asynchronous. However, /tebex secret <secret> will voluntarily block the main thread in an attempt to avoid TebexPlugin::getApi() and TebexPlugin::getInformation() from being nullable on runtime when a valid secret is provided.
  • Added TebexAPI class (TebexPlugin::getApi()) to let other plugins call tebex endpoints directly. Do note the TebexAPI is isolated from the plugin (the plugin relies on TebexAPI but TebexAPI doesn't rely on the plugin). Since all API calls are asynchronous, you'll need to handle the response via a callback. For example: TebexPlugin::getApi()->getInformation(TebexResponseHandler::onSuccess(function(TebexInformation $info) : void{}));
  • Lazy loading: Online command queue will stop ticking when no players are found online. It will be scheduled to resume when PlayerJoinEvent next gets triggered. A similar lazy loading applies to the category GUI (/buy) - the categories are freshly fetched every 3 minutes without the involvement of a task. Only when a category GUI is requested while the plugin holds an expired category response is, the response is freshly fetched asynchronously.
  • The API calls now run over a dedicated thread pool than multiple AsyncTasks.
  • You can now check the latency of the latest API call via /tebex info.

Bug Fixes

Poggit Integration

Since this plugin now depends upon poggit libraries, once integrated, poggit will handle the .phar creation (along with the libraries) and run lint checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants