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

ClickEvent.callback() #803

Closed
zml2008 opened this issue Jul 28, 2022 · 1 comment · Fixed by #860
Closed

ClickEvent.callback() #803

zml2008 opened this issue Jul 28, 2022 · 1 comment · Fixed by #860

Comments

@zml2008
Copy link
Member

zml2008 commented Jul 28, 2022

Many of our platform implementations have implementation of a system which, using a serverside function cache accessed by a command run on the client.

It would improve usability and discoverability to expose this system as part of common API.

downsides

This callback API would need to be implemented on each platform, and could not have a sensible default implementation - most other service providers can at least function without specific platform support

implementation

  • ClickEvent.callback(Consumer<? super Audience>)
  • A CallbackProvider service for platforms to implement
  • options for single-use vs multi-user/time-based expiration callbacks?
@PierreSchwang
Copy link

Sounds like a great idea, imo time-based expiration should be the default behaviour - that all consumers expire after like 3 or 4 minutes, which is more than enough to execute one mouse click. Otherwise the Map (or whereever the pending Callbacks are stored) might get quite full. Otherwise, are there any ideas regarding mass-creating callbacks? Due to e.g. spamming a specific commands which creates callbacks? Or should this be a user-thingy to handle?

A CallbackProvider service for platforms to implement

Not sure if I just forgot something important, but why is a Provider for each platform required? Shouldn't a generalized api be enough for that? Basically
player clicks message -> executes command (like /adv 0123456789abcdef whatsoever) -> which then calls the generalized api (like ConsumerStorage#<A extends Audience>click(A audience))?
Therefor "only" command handlers must be implemented for each platform, which may keep the overhead rather low? But, I must admit, that might not be that clean tbf

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

Successfully merging a pull request may close this issue.

2 participants