-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
[feature] New event driver + api #396
Conversation
Deploying with Cloudflare Pages
|
State of event changes. This comment will be updated as I continue to migrate them. All events:
Breaking changes to the public api
Re-implementationsThe following events are implemented in the new system with the same name but carry the new Client interface.
Removed or made privateThese events have either been removed because they served no extra purpose or are only available within the plugin package
ExamplesHere's an example of how the old essentials integration worked, and how the new API is used in the new implementation. OldApiEventDriver driver = AudioApi.getInstance().getEventDriver();
Essentials ess = (Essentials) Bukkit.getServer().getPluginManager().getPlugin("Essentials");
if (driver.isSupported(ClientRequestVoiceEvent.class)) {
driver.on(ClientRequestVoiceEvent.class)
.setHandler(event -> {
User usr = ess.getUser(event.getRequester().getOwner().getUniqueId());
if (usr == null) return;
boolean isMuted = usr.isMuted();
if (isMuted) {
OpenAudioLogger.toConsole("Blocking voicechat for " + event.getRequester().getUser().getName() + " because they are muted on Essentials");
event.setCanceled(true);
}
});
} NewEventApi.getInstance().registerHandler(ClientEnableVoiceEvent.class, event -> {
User user = ((Essentials) Bukkit.getServer().getPluginManager().getPlugin("Essentials")).getUser(event.getClient().getActor().getUniqueId());
if (user == null) return;
if (user.isMuted()) {
OpenAudioLogger.toConsole("Blocking voicechat for " + event.getClient().getActor().getName() + " because they are muted on Essentials");
event.setCancelled(true);
}
}); |
Setup new event api which is actually usable for the separate API maven package.
Goals: