2 Progress API
Jesse Boyd edited this page 2017-02-23 15:09:34 +11:00

Note, If you want to process EditSession changes instead, use the EditSession event instead:

  • wiki.sk89q.com/wiki/WorldEdit/API/Hooking_EditSession
  • For that you need to be added in the FAWE config extent.allowed-plugins or Settings.EXTENT.ALLOWED_PLUGINS

Tracking the progress of an EditSession, or queue is simple:

editSession.getQueue().setProgressTracker(new RunnableVal2<ProgressType, Integer>() {
    @Override
    public void run(ProgressType type, Integer amount) {
        // FAWE can start on the queue before the full size is known
        switch (type) {
            case QUEUE:
                // <amount> chunks are in the queue
            case DISPATCH:
                // <amount> chunks left in the queue
            case DONE:
                // The queue is empty (finishing up)
        }
    }
});

To use the default progress tracker (titles) see: https://github.com/boy0001/FastAsyncWorldedit/blob/master/core/src/main/java/com/boydti/fawe/object/progress/DefaultProgressTracker.java

Notifications for the default are only given if > 64 chunks are queued (up to 4,194,304 blocks), since otherwise it finishes too quickly to be useful, though you can do whatever you like with a custom tracker.