runelite-client: load plugins on the main thread
This commit is contained in:
@@ -28,6 +28,7 @@ import com.google.common.util.concurrent.AbstractIdleService;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
|
||||||
public abstract class Plugin extends AbstractIdleService
|
public abstract class Plugin extends AbstractIdleService
|
||||||
@@ -42,4 +43,17 @@ public abstract class Plugin extends AbstractIdleService
|
|||||||
Overlay overlay = getOverlay();
|
Overlay overlay = getOverlay();
|
||||||
return overlay != null ? Arrays.asList(overlay) : Collections.EMPTY_LIST;
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user