Lol_marcus Posted November 27, 2020 Share Posted November 27, 2020 As soon as it collects the chaos rune, it starts lagging and giving null point exception errors. I have NO idea why. Can anyone shed some light please? @Override public int onLoop() throws InterruptedException { GroundItem cRune = getGroundItems().closest("Chaos rune"); if (cRune.isVisible() && cRune != null) { cRune.interact("Take"); Sleep.sleepUntil(() -> !cRune.isVisible(), 1000); } else { getWorlds().hopToF2PWorld(); sleep(random(500, 1500)); } return 700; } 1 Quote Link to comment Share on other sites More sharing options...
Gunman Posted November 27, 2020 Share Posted November 27, 2020 @Lol_marcus Try swapping the .isVisible() and null check around in the first if statement. And your sleep condition may also throw an NPE. If it does just change it out with !cRune.Exists() 1 Quote Link to comment Share on other sites More sharing options...
Lol_marcus Posted November 27, 2020 Author Share Posted November 27, 2020 7 minutes ago, Gunman said: @Lol_marcus Try swapping the .isVisible() and null check around in the first if statement. And your sleep condition may also throw an NPE. If it does just change it out with !cRune.Exists() Did both and it seems to have stabilized. Thanks for that. 2 Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted November 28, 2020 Share Posted November 28, 2020 7 hours ago, Lol_marcus said: Did both and it seems to have stabilized. Thanks for that. Always null check first, code will read from left to right ^^ 1 Quote Link to comment Share on other sites More sharing options...