Closed kpalang closed 8 years ago
The progress display display runs for all jobs.
Currently there is no event for block queue change. There are events informing you of Job added/removed and job state changed (indicates that all blocks are placed). To get the exact number of queued blocks please do:
For API please go to: https://github.com/SBPrime/AsyncWorldEdit-API
Alright, now I'm getting NPE, on the Queue declaration:
IAsyncWorldEdit asyncWorldEdit = (IAsyncWorldEdit) Bukkit.getPluginManager().getPlugin("AsyncWorldEdit");
IPlayerEntry playerEntry = asyncWorldEdit.getPlayerManager().getConsolePlayer;
IBlockPlacer iBlockPlacer = asyncWorldEdit.getBlockPlacer();
Queue<IBlockPlacerEntry> iBlockPlacerEntryQueue = iBlockPlacer.getPlayerEvents(playerEntry).getQueue();
Also, do i understand correctly that i need to get the size of the queue to get the number of blocks still to place?
TCS
You get NPE because the BlocksPlacer has the entry ONLY if the player has any operations queued. If the queue is empty the entry is null.
Yes to get the amount of blocks you need to get the size. I don't know what exactly are you planning to to bu I suggest using the progress display API.
Alright, i got the first method working. How would I use the mentioned Progress Display API? I need the time left variable. I noticed a setMessage method in the IProrgressDisplay, but as far as I understand it's a setter, not getter.
TCS
I think I got everything I need. I understood how interfaces work and I should manage on my own now. Thank you once again for answering just enough to lead me on the right track!
TCS
Ok,if you have more questions don't hesitate to ask.
Hello, I need to get current queue size to decide, if next job is allowed by my players. I have looked at several progress display extensions https://github.com/SBPrime/AsyncWorldEdit but I as I understand, they only work when pasting is in progress. I basically want to copy
/awe jobs
behavior, but instead of outputting the results to a string message, the variables would be available for separate use.Thanks in advance, TCS