WonderfulMang Posted January 5, 2016 Share Posted January 5, 2016 Hello! I'm new to this community, but i'm not new to java and when i realized that i could create a script using java I jumped at the chance. I'm getting an NPE and it crashes(not really, just very slow and unresponsive) OSBOT, i can't even look at the logs as it just fills up with useless messages that tell me I have an NPE. I would really love to look at the stacktrace and see which lines I need to specifically look at but it's too quick for me. I've been trying to use debug messages and see where the problem is myself. Hopefully someone can take the time to search where the NPE would be. Note that not all values aren't filled as they are not being used yet. Much appreciated ~WonderfulMang Main.class HatchetType TreeType WoodcuttingState WoodcuttingStyle DraynorStyle This is all of my current code. Quote Link to comment Share on other sites More sharing options...
Token Posted January 5, 2016 Share Posted January 5, 2016 Didn't go through all of those but from a quick look I can tell you that there's a problem in your WoodcuttingStyle constructor. It takes 3 arguments, an area name, an area and a main instance. You don't store that main object that is passed anywhere even though you created a main field in your class (which remains null) and you are using that later on in your code, which probably generates NPE's. thats supposed to be public WoodcuttingStyle(String areaName, Area bank, Main main) { this.areaName = areaName; this.bank = bank; this.main = main; } 1 Quote Link to comment Share on other sites More sharing options...
WonderfulMang Posted January 5, 2016 Author Share Posted January 5, 2016 (edited) Didn't go through all of those but from a quick look I can tell you that there's a problem in your WoodcuttingStyle constructor. It takes 3 arguments, an area name, an area and a main instance. You don't store that main object that is passed anywhere even though you created a main field in your class (which remains null) and you are using that later on in your code, which probably generates NPE's. thats supposed to be public WoodcuttingStyle(String areaName, Area bank, Main main) { this.areaName = areaName; this.bank = bank; this.main = main; } Nice catch! I suppose I completely missed that on my part. Thank you Edit: seems to have fixed my problem. Thank you very much. Edited January 5, 2016 by WonderfulMang Quote Link to comment Share on other sites More sharing options...