Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public final Prompt acceptInput(ConversationContext context, String input) {
- // BUKKIT-5611
- if (!Bukkit.isPrimaryThread()) {
- final ConversationContext _context = context;
- final String _input = input;
- Future<Prompt> future = Bukkit.getScheduler().callSyncMethod(KraftRPGPlugin.getInstance(), new Callable<Prompt>() {
- @Override
- public Prompt call() throws Exception {
- return EditorPrompt.this.acceptInput(_context, _input);
- }
- });
- new RuntimeException("Prompt called from non-main thread!").printStackTrace();
- boolean interrupted = Thread.interrupted();
- Prompt ret = null;
- try {
- ret = future.get();
- } catch (InterruptedException e) {
- interrupted = true;
- } catch (ExecutionException e) {
- e.getCause().printStackTrace();
- }
- if (interrupted) Thread.currentThread().interrupt();
- return ret;
- }
- // Existing code here
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement