April 11, 20232 yr 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"); } }
April 11, 20232 yr 2 hours ago, zulul123 said: public class Test extends MethodProvider { TestTwo testTwo = new TestTwo(); public void testLog() { testTwo.logFromTestTwo(); } } Need to exchange context with testTwo as well
April 11, 20232 yr Developer Either pass the Methodprovider object to the other class or exchangeContext
Create an account or sign in to comment