EverythingRS - Command Tutorial

Join Our Support Discord If you need more help or for some reason cannot understand the tutorial please join our support Discord. We're always available to help!

Getting Started

Registration and secret key

  • 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.
  • Now go to your dashboard and you should see your secret key

Things Included with the Commands API

  • 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

Making the commands work with your server

  • 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.
Add the code below into Commands.java and you're all done!
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();
}
In CommandPacketListener under
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();
}

Fin

  • You are finished with the tutorial and can now search for any osrs item, rs2 item, osrs npc, rs2 npcs, or osrs object quickly. If you have any suggestions for more commands be sure to let me know on our Discord!