Jump to content

Trying to use multiple classes


zulul123

Recommended Posts

Hi.

Trying to split up my script into multiple classes but getting null pointer error when trying to access methods from a different class like in this example:

public class Main extends Script {
    Test test = new Test();

    @Override
    public void onStart() throws InterruptedException {
        test.exchangeContext(getBot());
    }

    @Override
    public int onLoop() throws InterruptedException {
        test.testLog();
        return 256;
    }

    @Override
    public void onExit() throws InterruptedException {}
}

 

public class Test extends MethodProvider {

    TestTwo testTwo = new TestTwo();

    public void testLog() {
        testTwo.logFromTestTwo();
    }

}

 

public class TestTwo extends MethodProvider {

    public void logFromTestTwo() {
        log("Test Two");
    }

}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...