runelite-client: load plugins on the main thread

This commit is contained in:
Adam
2017-05-14 18:52:40 -04:00
parent c49fe33cf9
commit aebeba06ad

View File

@@ -28,6 +28,7 @@ import com.google.common.util.concurrent.AbstractIdleService;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.Executor;
import net.runelite.client.ui.overlay.Overlay;
public abstract class Plugin extends AbstractIdleService
@@ -42,4 +43,17 @@ public abstract class Plugin extends AbstractIdleService
Overlay overlay = getOverlay();
return overlay != null ? Arrays.asList(overlay) : Collections.EMPTY_LIST;
}
/**
* Override AbstractIdleService's default executor to instead execute in
* the main thread. Prevents plugins from all being initialized from
* different threads, which causes the plugin order on the navbar to be
* undefined
* @return
*/
@Override
protected Executor executor()
{
return r -> r.run();
}
}