Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2022-04-21 07:19:54 +02:00
4 changed files with 23 additions and 74 deletions

View File

@@ -32,7 +32,6 @@ import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.jagex.oldscape.pub.OAuthApi;
import com.jagex.oldscape.pub.OtlTokenResponse;
import com.openosrs.client.OpenOSRS;
import com.openosrs.client.game.PlayerManager;
import com.openosrs.client.ui.OpenOSRSSplashScreen;
@@ -53,9 +52,8 @@ import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import javax.inject.Provider;
@@ -96,8 +94,6 @@ import net.runelite.http.api.RuneLiteAPI;
import net.runelite.http.api.worlds.World;
import net.runelite.http.api.worlds.WorldResult;
import okhttp3.Cache;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
@@ -126,9 +122,6 @@ public class RuneLite
@Inject
private net.runelite.client.plugins.PluginManager pluginManager;
@Inject
private OkHttpClient okHttpClient;
@Inject
private ExternalPluginManager externalPluginManager;
@@ -687,68 +680,6 @@ public class RuneLite
try
{
log.info("Initializing OTL token requester with access token");
oAuthApi.setOtlTokenRequester(url ->
{
CompletableFuture<OtlTokenResponse> f = new CompletableFuture<>();
okHttpClient.newCall(new Request.Builder()
.url(url)
.header("Authorization", "Bearer " + accessToken)
.get()
.build())
.enqueue(new Callback()
{
private void complete(boolean success, String token)
{
f.complete(new OtlTokenResponse()
{
@Override
public boolean isSuccess()
{
return success;
}
@Override
public String getToken()
{
return token;
}
});
}
@Override
public void onFailure(Call call, IOException e)
{
log.error("HTTP error while performing OTL request", e);
complete(false, null);
}
@Override
public void onResponse(Call call, Response response) throws IOException
{
if (response.code() != 200)
{
log.error("Non-OK response performing OTL request: {}", response.code());
complete(false, null);
response.close();
return;
}
if (response.body() == null)
{
log.error("OK response with empty body from OTL request");
complete(false, null);
response.close();
return;
}
log.debug("Successful OTL response");
complete(true, response.body().string());
response.close();
}
});
return f;
});
}
catch (LinkageError ex)
{

View File

@@ -328,7 +328,7 @@ public class ClueScrollPlugin extends Plugin
final boolean isXMarksTheSpotOrb = event.getItemId() == ItemID.MYSTERIOUS_ORB_23069;
if (isXMarksTheSpotOrb || event.getMenuOption().equals("Read"))
{
final ItemComposition itemComposition = itemManager.getItemComposition(event.getId());
final ItemComposition itemComposition = itemManager.getItemComposition(event.getItemId());
if (isXMarksTheSpotOrb
|| itemComposition.getName().startsWith("Clue scroll")

View File

@@ -1127,6 +1127,18 @@ public class MenuEntrySwapperPlugin extends Plugin
entries[index1] = entry2;
entries[index2] = entry1;
// Item op4 and op5 are CC_OP_LOW_PRIORITY so they get added underneath Use,
// but this also causes them to get sorted after client tick. Change them to
// CC_OP to avoid this.
if (entry1.isItemOp() && entry1.getType() == MenuAction.CC_OP_LOW_PRIORITY)
{
entry1.setType(MenuAction.CC_OP);
}
if (entry2.isItemOp() && entry2.getType() == MenuAction.CC_OP_LOW_PRIORITY)
{
entry2.setType(MenuAction.CC_OP);
}
client.setMenuEntries(entries);
// Update optionIndexes

View File

@@ -289,12 +289,18 @@ class StatusBarsOverlay extends Overlay
{
final MenuEntry[] menu = client.getMenuEntries();
final int menuSize = menu.length;
final MenuEntry entry = menuSize > 0 ? menu[menuSize - 1] : null;
if (menuSize == 0)
{
return 0;
}
final MenuEntry entry = menu[menuSize - 1];
final Widget widget = entry.getWidget();
int restoreValue = 0;
if (entry != null && entry.getParam1() == WidgetInfo.INVENTORY.getId())
if (widget != null && widget.getId() == WidgetInfo.INVENTORY.getId())
{
final Effect change = itemStatService.getItemStatChanges(entry.getIdentifier());
final Effect change = itemStatService.getItemStatChanges(widget.getItemId());
if (change != null)
{