Skip to main content

rs07

import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.ui.World;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import java.sql.*;

@ScriptManifest(author = "Sibbernski", name = "Sibbernski7Qp", info = "hekkoi", version = 0.1, logo = "")
public class Main extends Script {

    @Override
    public void onStart() throws InterruptedException {
    }

    @Override
    public int onLoop() throws InterruptedException {
        muling();
        return 10000;
    }

    public void muling(){
        try
        {
            // create a mysql database connection
            String myDriver = "org.gjt.mm.mysql.Driver";
            String myUrl = "jdbc:mysql://localhost/muling";
            Class.forName(myDriver);
            Connection conn = DriverManager.getConnection(myUrl, "root", "");

            // the mysql insert statement
            String query = " insert into mulerequest (botname, place, world)"
                    + " values (?, ?, ?)";

            // create the mysql insert preparedstatement
            PreparedStatement preparedStmt = conn.prepareStatement(query);
            preparedStmt.setString (1, myPlayer().getName());
            preparedStmt.setString (2, "FALADOR");
            preparedStmt.setInt    (3, worlds.getCurrentWorld());

            // execute the preparedstatement
            preparedStmt.execute();

            conn.close();
        }
        catch (Exception e)
        {
            System.err.println("Got an exception!");
            System.err.println(e.getMessage());
        }
    }

}