Advertisement
FALSkills

Untitled

Jan 24th, 2021
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. public void register() {
  2. final BotApi api = ContextResolver.resolve();
  3. final Thread scriptThread = Thread.currentThread();
  4. api.eventDispatcher().on(PauseRequestEvent.class, e -> {
  5. scriptThread.suspend();
  6. });
  7. api.eventDispatcher().on(ResumeRequestEvent.class, e -> {
  8. scriptThread.resume();
  9. });
  10. api.eventDispatcher().on(StopRequestEvent.class, e -> {
  11. try {
  12. scriptThread.stop();
  13. } catch(Exception | Error err){
  14.  
  15. }
  16. });
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement