First download our everythingrs-api.jar from here and include it into your project.
After adding the everything-rs.jar into your project the next step is to create an account, once the account is created you must register onto the toplist as we use the toplist data in many of our api's.
At the moment we provide 5 different commands related to search which give you quicker access to our Tools page.
::sitem which is short for "searchitem" will give you results for RS2 items.
::ositem short for "Old School Item" will give you results for OSRS items.
::snpc short for "Search NPC" will give you results for RS2 NPCs.
::osnpc short for "Old School NPC" will give you results for OSRS NPCs
::osobject short for "Old School Object" will give you results for OSRS Objects
This part of the tutorial is for PI & Ruse, but can easily be changed to work with any server. If you want me to add a snippet on the thread so it can work with your framework leave a comment with the server base you want the snippet for.
if (playerCommand.startsWith("sitem") || playerCommand.startsWith("snpc") ||
playerCommand.startsWith("ositem") || playerCommand.startsWith("osnpc") ||
playerCommand.startsWith("osobject")) {
String[] args = playerCommand.split(" ");
final String command = playerCommand;
new Thread() {
public void run() {
synchronized(c) {
try {
String query = args[1];
com.everythingrs.commands.Search[] searchResults = com.everythingrs.commands.Search
.searches("secret_key", command, query);
if (searchResults.length > 0)
if (searchResults[0].message != null) {
c.sendMessage(searchResults[0].message);
return;
}
c.sendMessage("-------------------");
for (com.everythingrs.commands.Search search: searchResults) {
c.sendMessage(search.name + ":" + search.id);
}
c.sendMessage("Finished search with " + searchResults.length + " results");
c.sendMessage("-------------------");
} catch (Exception e) {
c.sendMessage("Api Services are currently offline. Please check back shortly");
e.printStackTrace();
}
}
}
}.start();
}
public static void playerCommands(
Add
if (command[0].equalsIgnoreCase("sitem") || command[0].equalsIgnoreCase("snpc") ||
command[0].equalsIgnoreCase("ositem") || command[0].equalsIgnoreCase("osnpc") ||
command[0].equalsIgnoreCase("osobject")) {
new Thread() {
public void run() {
synchronized(c) {
try {
String query = command[1];
com.everythingrs.commands.Search[] searchResults = com.everythingrs.commands.Search
.searches("secret_key", command[0], query);
if (searchResults.length > 0)
if (searchResults[0].message != null) {
player.getPacketSender().sendMessage(searchResults[0].message);
return;
}
player.getPacketSender().sendMessage("-------------------");
for (com.everythingrs.commands.Search search: searchResults) {
player.getPacketSender().sendMessage(search.name + ":" + search.id);
}
player.getPacketSender()
.sendMessage("Finished search with " + searchResults.length + " results");
player.getPacketSender().sendMessage("-------------------");
} catch (Exception e) {
player.getPacketSender()
.sendMessage("Api Services are currently offline. Please check back shortly");
e.printStackTrace();
}
}
}
}.start();
}