http api: rename OSB ge classes with OSB prefix
This commit is contained in:
@@ -35,9 +35,9 @@ import okhttp3.Request;
|
|||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class GrandExchangeClient
|
public class OSBGrandExchangeClient
|
||||||
{
|
{
|
||||||
public GrandExchangeResult lookupItem(int itemId) throws IOException
|
public OSBGrandExchangeResult lookupItem(int itemId) throws IOException
|
||||||
{
|
{
|
||||||
final HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
final HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("osb")
|
.addPathSegment("osb")
|
||||||
@@ -59,7 +59,7 @@ public class GrandExchangeClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
final InputStream in = response.body().byteStream();
|
final InputStream in = response.body().byteStream();
|
||||||
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), GrandExchangeResult.class);
|
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), OSBGrandExchangeResult.class);
|
||||||
}
|
}
|
||||||
catch (JsonParseException ex)
|
catch (JsonParseException ex)
|
||||||
{
|
{
|
||||||
@@ -28,7 +28,7 @@ import java.time.Instant;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class GrandExchangeResult
|
public class OSBGrandExchangeResult
|
||||||
{
|
{
|
||||||
private int item_id;
|
private int item_id;
|
||||||
private int buy_average;
|
private int buy_average;
|
||||||
@@ -35,12 +35,12 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/osb/ge")
|
@RequestMapping("/osb/ge")
|
||||||
public class GrandExchangeController
|
public class OSBGrandExchangeController
|
||||||
{
|
{
|
||||||
private final GrandExchangeService grandExchangeService;
|
private final OSBGrandExchangeService grandExchangeService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public GrandExchangeController(GrandExchangeService grandExchangeService)
|
public OSBGrandExchangeController(OSBGrandExchangeService grandExchangeService)
|
||||||
{
|
{
|
||||||
this.grandExchangeService = grandExchangeService;
|
this.grandExchangeService = grandExchangeService;
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ import org.sql2o.Sql2o;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class GrandExchangeService
|
public class OSBGrandExchangeService
|
||||||
{
|
{
|
||||||
private static final String CREATE_GRAND_EXCHANGE_PRICES = "CREATE TABLE IF NOT EXISTS `osb_ge` (\n"
|
private static final String CREATE_GRAND_EXCHANGE_PRICES = "CREATE TABLE IF NOT EXISTS `osb_ge` (\n"
|
||||||
+ " `item_id` int(11) NOT NULL,\n"
|
+ " `item_id` int(11) NOT NULL,\n"
|
||||||
@@ -56,7 +56,7 @@ public class GrandExchangeService
|
|||||||
private final Sql2o sql2o;
|
private final Sql2o sql2o;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public GrandExchangeService(@Qualifier("Runelite SQL2O") Sql2o sql2o)
|
public OSBGrandExchangeService(@Qualifier("Runelite SQL2O") Sql2o sql2o)
|
||||||
{
|
{
|
||||||
this.sql2o = sql2o;
|
this.sql2o = sql2o;
|
||||||
|
|
||||||
@@ -73,8 +73,8 @@ import net.runelite.client.ui.NavigationButton;
|
|||||||
import net.runelite.client.util.ImageUtil;
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.StackFormatter;
|
import net.runelite.client.util.StackFormatter;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
import net.runelite.http.api.osbuddy.GrandExchangeClient;
|
import net.runelite.http.api.osbuddy.OSBGrandExchangeClient;
|
||||||
import net.runelite.http.api.osbuddy.GrandExchangeResult;
|
import net.runelite.http.api.osbuddy.OSBGrandExchangeResult;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Grand Exchange",
|
name = "Grand Exchange",
|
||||||
@@ -86,7 +86,7 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
{
|
{
|
||||||
private static final int OFFER_CONTAINER_ITEM = 21;
|
private static final int OFFER_CONTAINER_ITEM = 21;
|
||||||
private static final int OFFER_DEFAULT_ITEM_ID = 6512;
|
private static final int OFFER_DEFAULT_ITEM_ID = 6512;
|
||||||
private static final GrandExchangeClient CLIENT = new GrandExchangeClient();
|
private static final OSBGrandExchangeClient CLIENT = new OSBGrandExchangeClient();
|
||||||
private static final String OSB_GE_TEXT = "<br>OSBuddy Actively traded price: ";
|
private static final String OSB_GE_TEXT = "<br>OSBuddy Actively traded price: ";
|
||||||
|
|
||||||
private static final String BUY_LIMIT_GE_TEXT = "<br>Buy limit: ";
|
private static final String BUY_LIMIT_GE_TEXT = "<br>Buy limit: ";
|
||||||
@@ -346,7 +346,7 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final GrandExchangeResult result = CLIENT.lookupItem(itemId);
|
final OSBGrandExchangeResult result = CLIENT.lookupItem(itemId);
|
||||||
final String text = geText.getText() + OSB_GE_TEXT + StackFormatter.formatNumber(result.getOverall_average());
|
final String text = geText.getText() + OSB_GE_TEXT + StackFormatter.formatNumber(result.getOverall_average());
|
||||||
geText.setText(text);
|
geText.setText(text);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user