ge plugin: submit trades even when not logged in
This commit is contained in:
@@ -43,6 +43,7 @@ public class RuneLiteAPI
|
||||
private static final Logger logger = LoggerFactory.getLogger(RuneLiteAPI.class);
|
||||
|
||||
public static final String RUNELITE_AUTH = "RUNELITE-AUTH";
|
||||
public static final String RUNELITE_MACHINEID = "RUNELITE-MACHINEID";
|
||||
|
||||
public static final OkHttpClient CLIENT;
|
||||
public static final Gson GSON = new Gson();
|
||||
|
||||
@@ -27,7 +27,7 @@ package net.runelite.http.api.ge;
|
||||
import com.google.gson.Gson;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
import static net.runelite.http.api.RuneLiteAPI.JSON;
|
||||
@@ -39,12 +39,14 @@ import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class GrandExchangeClient
|
||||
{
|
||||
private static final Gson GSON = RuneLiteAPI.GSON;
|
||||
|
||||
private final UUID uuid;
|
||||
@Setter
|
||||
private UUID uuid;
|
||||
@Setter
|
||||
private String machineId;
|
||||
|
||||
public void submit(GrandExchangeTrade grandExchangeTrade)
|
||||
{
|
||||
@@ -52,8 +54,17 @@ public class GrandExchangeClient
|
||||
.addPathSegment("ge")
|
||||
.build();
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString())
|
||||
Request.Builder builder = new Request.Builder();
|
||||
if (uuid != null)
|
||||
{
|
||||
builder.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString());
|
||||
}
|
||||
if (machineId != null)
|
||||
{
|
||||
builder.header(RuneLiteAPI.RUNELITE_MACHINEID, machineId);
|
||||
}
|
||||
|
||||
Request request = builder
|
||||
.post(RequestBody.create(JSON, GSON.toJson(grandExchangeTrade)))
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
Reference in New Issue
Block a user