hiscore: modify the ui on the edt only
This commit is contained in:
@@ -194,7 +194,7 @@ public class HiscorePanel extends PluginPanel
|
|||||||
|
|
||||||
if (localPlayer != null)
|
if (localPlayer != null)
|
||||||
{
|
{
|
||||||
executor.execute(() -> lookup(localPlayer.getName()));
|
lookup(localPlayer.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -363,7 +363,7 @@ public class HiscorePanel extends PluginPanel
|
|||||||
{
|
{
|
||||||
searchBar.setText(username);
|
searchBar.setText(username);
|
||||||
resetEndpoints();
|
resetEndpoints();
|
||||||
lookup();
|
executor.execute(this::lookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lookup()
|
private void lookup()
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import com.google.common.collect.ImmutableList;
|
|||||||
import com.google.common.collect.ObjectArrays;
|
import com.google.common.collect.ObjectArrays;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@@ -213,23 +212,12 @@ public class HiscorePlugin extends Plugin
|
|||||||
|
|
||||||
private void lookupPlayer(String playerName)
|
private void lookupPlayer(String playerName)
|
||||||
{
|
{
|
||||||
executor.execute(() ->
|
SwingUtilities.invokeLater(() ->
|
||||||
{
|
{
|
||||||
try
|
if (!navButton.isSelected())
|
||||||
{
|
{
|
||||||
SwingUtilities.invokeAndWait(() ->
|
navButton.getOnSelect().run();
|
||||||
{
|
|
||||||
if (!navButton.isSelected())
|
|
||||||
{
|
|
||||||
navButton.getOnSelect().run();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
catch (InterruptedException | InvocationTargetException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
hiscorePanel.lookup(playerName);
|
hiscorePanel.lookup(playerName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user